Skip to content

Margin

Margin Mode

When opening a position, a margin mode is selected. Cross margin is the default, which allows for maximal capital efficiency by sharing collateral between all other cross margin positions. Isolated margin is also supported, which allows an asset's collateral to be constrained to that asset. Liquidations in that asset do not affect other isolated positions or cross positions. Similarly, cross liquidations or other isolated liquidations do not affect the original isolated position.

Some assets are isolated-only, which functions the same as isolated margin with the additional constraint that margin cannot be removed. Margin is proportionally removed as the position is closed.

Order Margin Reservation

In order to ensure account health and overall protocol safety, margin checks are performed when placing limit orders. Each limit order consumes an amount of Order Margin.

Order Margin does not directly affect position margin, account health, or overall liquidation status. It is used as a check when accounts place limit orders to ensure that they have enough margin to handle the resting orders. Order Margin will affect an account's overall available margin to use for trading.

We calculate order margin for a singular market as follows:

Npos=signed notional of position=positionmark priceN_{\text{pos}} = \text{signed notional of position} = \text{position} * \text{mark price}

B=total bid notional=bidslimit priceorder sizeB = \text{total bid notional} = \sum_{\text{bids}}\text{limit price} * \text{order size}

A=total ask notional=askslimit priceorder sizeA = \text{total ask notional} = \sum_{\text{asks}} \text{limit price} * \text{order size}

Ebids=Npos+BE_{\text{bids}} = |N_{\text{pos}} + B|

Easks=NposAE_{\text{asks}} = |N_{\text{pos}} - A|

Emax=max(Ebids,Easks)E_{\text{max}} = \max(E_{\text{bids}}, E_{\text{asks}})

Market Order Margin=EmaxNposleverage\text{Market Order Margin} = \frac{E_{\text{max}} - |N_{\text{pos}}|}{\text{leverage}}

This is summed across all markets with resting orders to produce the total requirement:

Total Order Margin =marketsMarket Order Margin\text{Total Order Margin } = \sum_{\text{markets}} \text{Market Order Margin}

The Available Order Margin used for placing new orders is calculated as follows:

Mcross=Mbalance+Cross uPnLMisolatedM_{\text{cross}} = M_{\text{balance}} + \text{Cross uPnL} - M_{\text{isolated}}

Mavailable=McrossMpos initial crossTotal Order MarginM_{\text{available}} = M_{\text{cross}} - M_{\text{pos initial cross}} - \text{Total Order Margin}