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
- 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
If short
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.