Liquidations

A liquidation occurs when the a trader's margin fraction dips below the maintenance margin ratio, indicating that their account is insufficiently collateralized.

Traders will be liquidated when their margin fraction (MF) dips below the maintenance margin ratio (MMR).

A strategy's margin fraction and maintenance margin ratio are defined as follows:

# strategy_value = strategy_collateral + all_positions(unrealized_pnl)
# notional_value = all_positions(position_size * mark_price)

margin_fraction = strategy_value / notional_value
maintenance_margin_ratio = 0.6 / max_leverage

From the equation above, you can see how if the market moves unfavorably against your position, your margin fraction will decrease since your strategy value will decrease due to a more negative unrealized PNL. If this dips below the MMR, you will be liquidated.

Although the technical definition of a liquidation trigger is MF < MMR, you can also think of it as when the mark price crosses the liquidation price based on a trader's position. Things get a little more complicated in a cross-margined paradigm with multiple positions open across markets, however this approximation/estimate can be a good, more intuitive way to think about things. The estimated liquidation price for any given position is as follows:

estimated_liquidation_price = (collateral - position_size * position_side * avg_entry_px) / (position_size * (mmr - position_side))

More explanation on how this formula was derived can be found here.

A strategy (and all its positions) will be entirely liquidated when the liquidation price is met. Partial liquidations are not currently supported.

Liquidation Checklist

If a trader is liquidated, three important things will happen:

  1. any remaining collateral will be taken.

  2. any open orders will be canceled

  3. any open positions will be closed, more on this in the next section...

Liquidation Position Closing

This is a little trickier as there are two paths this can take, the first of which the likelier (and happier) path, and the second of which being the far less likely path. A detailed demonstration of the following materials can be found here.

In either scenario, the exchange will essentially buy liquidated positions from the liquidated trader at their bankruptcy price, and exchanged with open orders on the book until the position has been fully closed. A position's bankruptcy price is the price at which their losses exactly equals the collateral deposited, computed in the following manner: bankruptcy_price = mark_px - position_side * (total_account_value / position_size)

In other words, a liquidated long position will be matched with any open bids in the order book, and a liquidated short position will be matched with any open shorts in the order book. The prices at which these positions are offloaded to other traders are called the closing prices.

  • Happy path: in the scenario where the closing price is more favorable than the bankruptcy price (in the case of a liquidated long, the closing price is higher than the bankruptcy price, and in the case of a liquidated short, the closing price is lower than the bankruptcy price), this positive spread is credited to the insurance fund.

  • Adverse path: in the scenario where the closing price is less favorable thank the bankruptcy price, the negative spread is debited from the insurance fund. If the insurance fund is insufficiently capitalized to handle this drawdown, it results in an auto-deleveraging (ADL) event. More on this in the next section...

Auto-Deleveraging (ADL)

Auto-deleveraging is an extremely rare outcome, but final resort, the exchange would take in the event the insurance fund was not sufficiently capitalized to handle a liquidation drawdown. The key premise of auto-deleveraging lies with the invariant that the long and short positions at all times is zero-sum (i.e. there are just as many longs as there are shorts). Thus, for every undercollateralized/liquidated position, there are positions of equal size that are profitable. Auto-deleveraging forcibly closes positions to match the amount being liquidated, closing positions in order of most profitable to least.

Last updated