Unified derivatives position data.
Represents an open position on a derivatives exchange (futures, swaps, options).
Fields
id- Position IDsymbol- Unified symbol (e.g., "BTC/USDT:USDT")timestamp- Last update time in millisecondsdatetime- ISO 8601 datetime stringside- "long" or "short"contracts- Number of contractscontract_size- Size of one contractnotional- Absolute position value denominated bynotional_currency. The numeric value preserves the venue's published unit.notional_currency- Unified currency code that denominatesnotional. Populated whenevernotionalis populated on the unified read path.base_quantity- Absolute position size in the base currency. Populated only for Deribit future rows fromsize_currency. It isnilfor Deribit options and other venues; theircontractsmay already be base-denominated.leverage- Current leverageunrealized_pnl- Unrealized profit/lossrealized_pnl- Realized profit/losscumulative_funding- Funding settled for the positionpending_funding- Funding not yet settled into cash balancetotal_fees- Fees paid while opening or changing the positionnet_settlements- Net USD paid or received from settlementscollateral- Collateral amountentry_price- Average entry pricemark_price- Current mark priceliquidation_price- Estimated liquidation pricemargin_mode- "cross" or "isolated"isolated- Whether the position uses isolated marginhedged- Whether position is in hedge modemaintenance_margin- Required maintenance marginmaintenance_margin_percentage- Maintenance margin as a fraction (0.1 = 10%)initial_margin- Required initial margininitial_margin_percentage- Initial margin as a fraction (0.1 = 10%)margin_ratio- Current margin ratio as a fraction (0.1 = 10%)last_update_timestamp- Last update timestamplast_price- Last traded pricestop_loss_price- Stop loss pricetake_profit_price- Take profit pricepercentage- PnL in percent points (10 = 10%)margin- Position margininfo- Raw exchange response
Summary
Functions
Returns true if the position is long.
Returns true if the position has positive unrealized PnL.
JSON Schema for the Position unified type.
Returns true if the position is short.
Types
@type t() :: %Bourse.Position{ base_quantity: number() | nil, collateral: number() | nil, contract_size: number() | nil, contracts: number() | nil, cumulative_funding: number() | nil, datetime: String.t() | nil, entry_price: number() | nil, hedged: boolean() | nil, id: String.t() | nil, info: map() | nil, initial_margin: number() | nil, initial_margin_percentage: number() | nil, isolated: boolean() | nil, last_price: number() | nil, last_update_timestamp: integer() | nil, leverage: number() | nil, liquidation_price: number() | nil, maintenance_margin: number() | nil, maintenance_margin_percentage: number() | nil, margin: number() | nil, margin_mode: String.t() | nil, margin_ratio: number() | nil, mark_price: number() | nil, net_settlements: number() | nil, notional: number() | nil, notional_currency: String.t() | nil, pending_funding: number() | nil, percentage: number() | nil, realized_pnl: number() | nil, side: String.t() | nil, stop_loss_price: number() | nil, symbol: String.t() | nil, take_profit_price: number() | nil, timestamp: integer() | nil, total_fees: number() | nil, unrealized_pnl: number() | nil }
Functions
Returns true if the position is long.
Returns true if the position has positive unrealized PnL.
@spec schema() :: map()
JSON Schema for the Position unified type.
Returns true if the position is short.