Trading on leverage can be risky. Make sure you are aware of the liquidation rules outlined below before applying margin.
What are Liquidations?
Liquidations are a part of leveraged trading. Traders that elect to use leverage are using the collateral they deposited as margin to borrow money from the protocol. Traders may choose to do this in order to open a larger position and have more exposure to a particular asset, i.e. leveraged exposure.
When this occurs, the protocol must protect itself by ensuring that there is enough margin for the position to settle any losses that occur. There is a prescribed minimum ratio between a position's value and its margin for each asset (Minimum Maintenance Margin).
If a position drops below its Minimum Maintenance Margin, liquidators are incentivized by the protocol to take over positions so a user's remaining collateral may settle the losses that have occurred. ReadInsurance Fund for what happens when prices move rapidly and/or liquidations don't happen in time.
How do Liquidations work?
In the Drift v2 margin system, all positions within a subaccount (deposits, borrows, and perpetuals positions) are cross-margined.
As such, liquidations are calculated based on your account level leverage rather than isolated to the leverage present in your perpetuals and/or borrow account.
You can be liquidated when your totalCollateral becomes less than yourmaintenanceMarginRequirement. Your total collateral is the weighted value of your deposits and perp pnl. Your margin requirement is the weighted value of your borrows and perp positions.
Once your total collateral value falls below your margin requirement, liquidations will first cancel any open orders + LP positions. After this, until your account's total collateral is above the maintenanceMarginRequirement + liqBufferRatio liquidators can iteratively liquidate any portion of assets and liabilities over a throttled time window (to avoid single price instance from a heavily deleveraging account). The liqBufferRatio is set on the Drift State Account and is meant to sufficiently bring an account away from the liquidation boundary but heavily punish users.
The Health measure on the user page can help visualise how close a user is to liquidation territory. At 0 Health, a user can get liquidated.
Health = log(max(0, (1 - marginRequirement/totalCollateral) * 100) + 1) / log(100)
The user's trade price at liquidation for a perpetual position will be based on the oracle price. The penalty / fee that is set per market, likely above the normal taker fee, in order to give the liquidator a rebate.
Liquidations triggered and positions will be liquidated using margin engine prices.
In the case of an extreme oracle error (): the market will pause most fills, liquidations, and funding rate updates.
- You deposit 500 USDC and you long 200 SOL-PERP at $25
- Your position value is $5000 USDC and your margin/collateral is $500 USDC, you have 10x leverage
Note that the Minimum Maintenance Margin for a SOL-PERP is 5% (see Minimum Maintenance Margin for assets here: Margin
Your total collateral is $500 * 1.00 = $500 and your margin requirement is $5000 * .05 = 250
You are liquidated if the price of SOL decreases by 5.28% to $23.6825. This is because your perp pnl is 200 * $25 * -.0527 = -263.5 and thus your total collateral is $500 - 263.5 = $236.5while your margin requirement is $23.6825 * 200 * .05 = $236.825.
Being a Liquidator
Read Liquidators if you want to learn more about being a liquidator on the platform. Liquidators earn a fee for their services.