Api position history

ApiPositionHistory

A position lifecycle record.

When status is PARTIALLY_CLOSED, the position is still open. Fields that describe the close event (close_time, position_close_mark_price) will be omitted, and leverage reflects the current value

Name
Lite
Type Required
Default
Description
sub_account_id
sa
string True Trading account ID which held this position
instrument
i
string True Asset this position was for
open_time
ot
string True Timestamp of first trade that opened this lifecycle
status
s
PositionCloseStatus True
is_long
il
boolean True True if the closed position was long
margin_type
mt
PositionMarginType True
close_time
ct
string False
None
Timestamp when the position lifecycle ended. Omitted when status is PARTIALLY_CLOSED
entry_price
ep
string True Average entry price at 9 decimals
exit_price
ep1
string True Average exit price at 9 decimals
position_close_mark_price
pc
string False
None
Mark price at close. Omitted when status is PARTIALLY_CLOSED
realized_pnl
rp
string True Cumulative realized PnL in quote currency
cumulative_fee
cf
string True Cumulative fees in quote currency
cumulative_realized_funding_payment
cr
string True Cumulative realized funding payment in quote currency
closed_volume_base
cv
string True Sum of abs(reducingTradeSize) across all reducing trades
closed_volume_quote
cv1
string True Sum of abs(reducingTradeSize) * tradePrice across all reducing trades
max_open_interest_base
mo
string True Max absolute position size reached during lifecycle
max_open_interest_quote
mo1
string True Max abs(size) * entryVWAP reached during lifecycle
cumulative_initial_margin
ci
string True Sum of markPrice * abs(tradeSize) / leverage for position-increasing trades
max_initial_margin
mi
string True High-water mark of cumulativeInitialMargin during lifecycle
leverage
l
string True Leverage at time of close. When status is PARTIALLY_CLOSED, this is the current leverage
unrealized_pnl
up
string False
None
The unrealized PnL of the position, expressed in quote asset decimal units
unrealized_pnl = (mark_price - entry_price) * size where size is signed (negative for short positions)
Only present when status is PARTIALLY_CLOSED
PositionCloseStatus
Value Description
CLOSED = 1 Position fully closed via reducing trade or flip
LIQUIDATED = 2 Position closed via liquidation
SETTLED = 3 Position closed via settlement
PARTIALLY_CLOSED = 4 Position partially closed
PositionMarginType
Value Description
ISOLATED = 1 Isolated Margin Mode: each position is allocated a fixed amount of collateral
CROSS = 2 Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions