Skip to content

Accounting and PnL

Unrealized PnL

Unrealized PnL reflects the potential gain or loss if a position were closed at the current mark price. For a long position, it is the difference between the current value and the entry cost. For a short position, the sign is reversed.

uPnLlong=NmarkNentry\text{uPnL}_{\text{long}} = N_{\text{mark}} - N_{\text{entry}}

uPnLshort=NentryNmark\text{uPnL}_{\text{short}} = N_{\text{entry}} - N_{\text{mark}}

Where the notional values are the position size multiplied by the mark price and average entry price respectively. When a position is increased, the average entry price adjusts to reflect the blended cost basis. When a position is partially closed, the cost basis scales down proportionally and the closed portion realizes PnL.

Realized PnL

PnL is realized when a position is reduced or closed. It is the difference between the exit notional (at fill price) and the entry notional (at average entry price), sign-adjusted for side. Realized PnL is credited or debited directly to the account's margin balance.

Funding payments also affect the margin balance. Each funding application adjusts the balance by the position's share of the hourly funding rate.

Total Account Value

For cross-margin accounts, equity is the sum of the margin balance and unrealized PnL across all cross-margin positions, minus any margin allocated to isolated positions:

Cross Equity=Mbalance+uPnLcrossMisolated\text{Cross Equity} = M_{\text{balance}} + \sum \text{uPnL}_{\text{cross}} - M_{\text{isolated}}

The margin balance includes all deposits, withdrawals, realized PnL, funding payments, and fees accumulated over the account's lifetime.

For isolated-margin positions, equity is evaluated independently per position:

Isolated Equity=Misolated+uPnLisolated position\text{Isolated Equity} = M_{\text{isolated}} + \text{uPnL}_{\text{isolated position}}

Available Margin

Available cross margin is the portion of equity that can be used to open new positions or be withdrawn. It is equity minus the margin already committed to existing positions and resting orders:

Mavailable=Cross EquityMinitialTotal Order MarginM_{\text{available}} = \text{Cross Equity} - M_{\text{initial}} - \text{Total Order Margin}

An order or withdrawal is rejected if it would cause available margin to fall below zero. Note that the available margin has no impact on liquidations or account health, which is entirely determined by the account's maintenance margin requirements.