Liquidation, ADL, Insurance Fund, IMR, MMR
Liquidation of your position is an event when the Mark price of the contract falls below the liquidation price (in the case of a Long) or rises above it (in the case of a Short). At this moment, a Fill Or Kill market order will be placed for the entire volume of the position.
There are concepts that are inseparably linked with liquidation and should be discussed in the same context. Namely: IMR and MMR, Bankruptcy Price, Insurance Fund, and ADL.
IMR and MMR
Before engaging in trading, it's crucial to understand the terms IMR and MMR, which are fundamental when opening positions and for liquidations in general on all exchanges where perpetual trading is available. Some exchanges set a fixed rate for these values, while others adjust them based on the size of the position to determine more accurate figures. We've chosen the latter approach.
IMR (Initial Margin Rate): This is the percentage of the total value of a position that a trader must provide as collateral when opening a margin position. The initial margin provides the initial capital required to open a position based on the leverage and size. In simple terms, if a trader wants to buy assets worth $10 000 with 10x leverage, he will need to provide an initial margin of $1 000 (assuming the IMR is 10%).
MMR (Maintenance Margin Rate): This is the minimum percentage of the total value of a position that a trader must maintain in his account to keep his position open. If the collateral in the trader's account falls below this level due to losses, the position can be automatically liquidated. Maintenance margin serves as protection against possible excess losses in case of unfavorable market movements.
Both IMR and MMR are determined considering the exchange's liquidity and trader activity to ensure the utmost stability of the last price when executing liquidation orders even in a highly volatile market.
For NEXDEX, the IMR and MMR values for each market can be found in the terminal under the "Details" tab.
A major misconception is that exchanges are interested in liquidations. In such situations, exchanges actually bear the highest risks, especially when the insurance fund is depleted and ADL ensues. Those most interested in liquidations are the ones the market is moving towards, as they can exert more pressure on the trend and amplify it with the "fuel" of liquidated positions.
The difference between the initial margin of a position and the margin set at the liquidation price is the risk buffer, calculated based on the MMR value. The maximum amount of margin a trader can spend equals the value of the initial margin, from this, the bankruptcy price is set. Based on the MMR value, the liquidation price is calculated, which occurs before the bankruptcy price, with risks predetermined based on the nominal size of the position and leverage.
In simple terms, the lower the margin in relation to the volume of the position, the higher the leverage, the stricter the MMR requirements, and the sooner liquidation will occur. That is, the greater the difference between margin and position volume, the greater the risk is in setting the liquidation price, starting earlier than would be the case with a position with less leverage. Moreover, liquidation occurs slightly earlier for larger positions, even with low leverage. All of this is done to ensure there's enough liquidity to close the position above the bankruptcy price while exerting minimal pressure on the market price.
Insurance Fund
What will happen if, in the end, the position is liquidated at a price worse than the bankruptcy price? So it would take more margin to make up the difference? - Correct!
This is why the Insurance Fund mechanism was introduced. In such a case, the missing margin will be compensated from the Insurance Fund.
However, if the position is liquidated at a better price than the bankruptcy price, the difference will instead go into the Insurance Fund.
As you might have guessed, the values of IMR and MMR are set in such a way that the Insurance Fund tends to grow, but considering that traders will use their margin to the maximum extent possible.
The trend shows that the newer the exchange, the stricter its liquidation criteria, meaning that liquidation starts slightly earlier than on exchanges with higher liquidity. However, with the presence of strong market makers, even young exchanges can relax the MMR criterion and initiate the liquidation later, knowing that there will be enough liquidity in the order book for its execution.
You can view the values and dynamics of the Insurance Funds for each market on Dune immediately after the Mainnet launch.
ADL (Auto-Deleveraging)
What will happen if the Insurance Fund is completely exhausted and there is no one to cover the missing margin during mass liquidations below the bankruptcy price?
In such a situation, the ADL scenario within the contract will take effect, in which the Insurance Fund is completely depleted. All positions in profit (having a positive PNL) will be forcibly liquidated (closed with a market order), but only at a profit.
This procedure will aid the market by providing liquidity from those who were in the green, to buy out (liquidate) the orders of those who faced liquidation. Such an event can occur if the market consistently moves in one direction, while the holders of profitable positions refuse to lock in their profits, and the holders of unprofitable positions are constantly being liquidated.
For example, when the market goes up, Long position holders profit, while Short position holders get liquidated. To liquidate a Short, it needs to be closed by buying, meaning there should be a seller on the other side. This seller could be someone taking profits from a Long or someone opening a Short. But opening a Short goes against the trend, and taking profits from a Long might be premature. Where do you get the funds to cover liquidations if the insurance fund runs out? That's why profitable positions are sometimes forcibly closed to provide the needed liquidity for liquidations.
ADL is a last resort that comes into play under the most adverse developments. In the case of NEXDEX, when the Insurance Fund is depleted by 10% over the last 8 hours, an ADL scale will automatically appear on all profitable positions. The degree of its filling corresponds to the degree of the Insurance Fund's exhaustion. When the scale is full, all profitable positions will be forcibly closed with market orders of the FOK (Fill Or Kill) type, regardless of the set Slippage Tolerance. This means traders are likely to extract less profit than they could have by closing the position on their own.
Therefore, if you see the ADL scale, it's recommended that you independently close your profitable positions as soon as possible. By doing so, you ensure a more careful closure for yourself and help the exchange deplete the Insurance Fund less and avoid taking extreme measures.
ADL and liquidation orders are executed without taking into account Slippage tolerance settings, as they are immediate orders with mandatory execution.
NEXDEX Risk Management
What do we do in an emergency when the insurance fund has not yet been exhausted and we need to minimize the possibility of an ADL occurring?
• Reducing Maximum Leverage and Position Size: If the Fund has been depleted by 10% or lower within 8 hours, both the maximum leverage and the maximum position size are reduced at the interface and API levels.
• Carefully Selected IMR and MMR Values: IMR and MMR values are thoughtfully chosen based on the position size. This nuanced approach is designed to ensure that the risks are spread out and the insurance fund remains healthy.
• Opportunity to Replenish the Insurance Fund: There's a provision to add funds to the Insurance Fund through a transaction. This ensures that we, independently or in collaboration with the community, can refill the fund's balance, if needed.
• ADL Scale: The ADL scale shows the rate at which the fund is depleting. This allows traders with profitable positions to close them earlier, reducing the strain on the fund and providing liquidity to the market when they close their positions.
• Negative Commission for Maker Orders: By rewarding those who provide liquidity to the order book, we reduce the chance of a liquidity shortage for the liquidation of unprofitable positions and the utilization of the Insurance Fund. Offering a negative commission for maker orders essentially means that the exchange pays traders who add liquidity, incentivizing them to keep the market liquid. The size of Makers' reward is 0.01% of the position size.
By implementing these measures, the exchange can ensure a balanced ecosystem, reduce the risks of catastrophic liquidation events, and provide a more secure trading environment for all its users.
How to minimize Liquidation?
• Set a Stop Loss: The simplest yet effective method. Establish a Stop Loss during the position's opening phase or within the SL/TP window for an already open position.
• Monitor Margin Usage: Always keep an eye on the margin usage of your open positions. If the value reaches 100%, the position is subject to liquidation. Remember, all Cross-margin positions share a single margin usage value. Therefore, the liquidation of one position can trigger the liquidation of others and exhaust the available margin.
• Activate Notifications: Adjust your terminal settings to be notified when margin usage reaches 60-80%. This will serve as a warning to potentially unfavorable developments.
• Choose Margin Type Wisely: Be cautious when selecting the type of margin. If you're a novice trader, it's advised to trade with Isolated margin to minimize the risk of substantial losses.
• Avoid Adding to a Losing Position: Refrain from increasing a position that's already at a significant loss. Merely moving the liquidation price doesn't assure it won't be reached.
• Exercise Caution with Leverage: Avoid opening positions with high leverage, like more than 10x. While it might amplify potential gains, it can also magnify losses, making liquidation more likely.
Formulas
Initial Margin Requirement
This is the requirement for the ratio of margin to the order's notional as well as the mark price when creating a new position. The idea behind the additional mark price requirement is to minimize the liquidation risk when traded prices and mark prices temporally diverge too far from each other. Given the initial margin ratio, an order must fulfill two requirements:
The margin must fulfill:
Margin ≥ InitialMarginRatio * Price * Quantity
, e.g., in a market with maximally 20x leverage, the initial margin ratio would be 0.05. Any new position will have a margin which is at least 0.05 of its notional.The margin must fulfill the mark price requirement:
Margin >= Quantity * (InitialMarginRatio * MarkPrice - PNL)
PNL is the expected profit and loss of the position if it was closed at the current MarkPrice. Solved for MarkPrice this results in:
Maintenance Margin Requirement
Throughout the lifecycle of an active position, if the following margin requirement is not met, the position is subject to liquidation. (Note: for simplicity of notation but without loss of generality, we assume the position considered does not have any funding).
For Longs:
Margin >= Quantity * MaintenanceMarginRatio * MarkPrice - (MarkPrice - EntryPrice)
For Shorts:
Margin >= Quantity * MaintenanceMarginRatio * MarkPrice - (EntryPrice - MarkPrice)
Last updated