Skip to main content
In our trading system, per-position metrics are derived from position value and quantity. Entry price, unrealized PnL, notional value, margin requirements, and liquidation price all update in real time as the mark price changes. See Mark Price for how the mark price itself is calculated.

Key Definitions

Average Entry Price & Notional Value

Unrealized PnL

Unrealized PnL reflects the current profit or loss on an open position, based on the mark price relative to the average entry price.
Because positionQty is signed, this formula naturally handles both directions:
  • Long (positionQty > 0): profit when markPrice > avgEntryPrice
  • Short (positionQty < 0): profit when markPrice < avgEntryPrice

Position Margin & Maintenance Margin

Position margin is the collateral locked to support an open position. Maintenance margin is the minimum collateral required to keep the position open. The maintenance margin rate (MMR) is fixed at 5% and applied to every position regardless of size. The liquidation trigger depends on the position’s marginMode:
  • Cross margin (C): at risk when crossMarginEquity falls below the sum of maintenance margins across all cross margin positions.
  • Isolated margin (I): at risk when the position’s isolatedPositionEquity falls below its own maintenance margin.

Liquidation Price

The liquidation price is the mark price at which a position will be forcibly closed due to insufficient margin. The formula has the same shape in both margin modes — only the definition of marginAvailable differs.
marginAvailable is the equity cushion remaining after covering maintenance margin. It differs from availableBalance (See Available Balance for the formula), which is based on position margin and open order margin. For account-wide health metrics derived from these per-position values, see Cross Margin Ratio and Simulated Cross Margin Ratio.

Usage in API

These calculations are used in the Get Account Positions and Get Account Balances responses. Note that several formula variable names differ from their corresponding response field names: avgEntryPrice is not returned directly — derive it from value / quantity in the positions response. markPrice is not returned on the positions response either — read it from the marketBalancesMap entry for the market in Get Account Balances, or from the MARK entry on Get Market Data.