Margin

Definitions

Warning!

For liquidation and stability purposes, the mark price used for calculating margin fractions and liquidation thresholds will be the index price of the underlying for perpetual futures. This is to protect traders against large liquidation cascades or liquidity shortages.

Mark Price

mark=best bid+best ask2mark = \frac{best \space bid + best \space ask}{2}
  • When the book is one sided (only bids or only asks), the mark is index price * (1 ± one sided multiplier) where - when only asks, + when only bids ( for funding calculation purposes)
  • When there are no orders on either side of the book, the mark is the last mark price.

Index Price

Oracle price of the underlying asset.

Unrealized PnL

If long

PnLunrealized=position size×(markpurchase price)PnL_{unrealized} = position \space size \times (mark - purchase \space price)

If short

PnLunrealized=position size×(sale pricemark)PnL_{unrealized} = position \space size \times (sale \space price - mark)

Realized PnL

Realized PnL refers to a program-specific variable, rather than the general concept of realized pnl.

It refers to any PnL on a market that has been realized but not settled on the margin account balance yet. This amount of PnL is not yet reflected on the margin account, so would not collect nor pay supply/ borrow APY.

Ex: After Alice's maker order gets filled, she receives some positive realized PnL. However, this PnL is not yet settled/ reflected on her margin account. It is parked in this intermediate state that we call Realized PnL.

Realized PnL is automatically and instantaneously settled to the margin account in most cases, except when it accumulates through maker fills, in which case it is settled by an automatic crank. Otherwise, the user can choose to settle pnl using settle pnl instruction.

Margin Fraction [MF]

MF=total account valuetotal position notionalMF = \frac{total \space account \space value}{total \space position \space notional}

Open Margin Fraction [OMF]

OMF=min(total account value, collateral+PnLrealized)total open position notionalOMF = \frac{min(total \space account \space value, \space collateral+ PnL_{realized})}{total \space open \space position \space notional}

Total Account Value

Total Account Value=collateral+PnLrealized+PnLunrealizedTotal \space Account \space Value = collateral + PnL_{realized} + PnL_{unrealized}

Position notional

Position notional=position size×markPosition \space notional = position \space size \times mark

Position Open Notional

Position open notional=position open size×markPosition \space open \space notional = position \space open \space size \times mark

Position Open Size

Position open size=max(abs(size if all buy orders get filled),abs(size if all sell orders get filled))Position \space open \space size = max(abs(size \space if \space all \space buy \space orders \space get \space filled), abs(size \space if \space all \space sell \space orders \space get \space filled))
Previous
Account Risk