Standard Liquidation:
- Positions with the highest PnL are liquidated first
- Any realized profit is given back to the user
- Any realized losses come from the user's margin
- All positions are liquidated at a discounted price (typically 50% of MMR Percentage on that market)
- Only exception here is if the discounted price crosses the bankruptcy price in the account. In this case, we use the bankruptcy price
- The full position is attempted to be liquidated
- If a position cannot be taken over by the liquidator, it waits until the account becomes healthy again or goes bankrupt
- The profit from the liquidator's unwinding is split into the Insurance Fund (30% goes there) and the liquidator margin account (70% goes back)
Bankrupt Liquidation:
- The whole account is queued for liquidation (all positions must be liquidated)
- Most profitable position is liquidated first
- All liquidations happen at mark price. No liquidation discount is given.
- Any profit from closing positions is given to the user/liquidatee account
- On closing each position, if the user is unable to cover the losses with margin available, the liquidator needs to add the required amount of capital to remove the bad debt. This margin is injected into the system for solvency.
- In case a liquidator is unable to take over a full position + the amount of capital required to eliminate bad debt from that position, ADL is triggered