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 = \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

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

If short

$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 = \frac{total \space account \space value}{total \space position \space notional}$

## Open Margin Fraction [OMF]

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

## Total Account Value

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

## Position notional

$Position \space notional = position \space size \times mark$

## Position Open Notional

$Position \space open \space notional = position \space open \space size \times mark$

## Position Open Size

$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