Accounts whose total value falls below the maintenance margin requirement may have their positions automatically closed by the liquidation engine. Positions are closed at the liquidation price described below. Profits or losses from liquidations are taken on by the insurance fund.
During a liquidation, the liquidator is allowed to take on up to the entire account balance of the liquidated account, potentially leaving it with zero margin and position. Partial liquidation is also permitted, in which case the liquidator will take on proportional amounts of the account’s margin and position.
When an account is liquidated, up to the entire value of the account may be taken as penalty and transferred to the Insurance Fund. The liquidation engine will attempt to leave funds in accounts of positive value where possible after they have paid the Maximum Liquidation Penalty of 1%.
The liquidation price of a position is calculated as follows, depending on whether it is a short or long position:
Close Price (Short) = P × (1 + (M × V / W))
Close Price (Long) = P × (1 − (M × V / W))
Pis the oracle price for the market
Mis the maintenance margin fraction for the market
Vis the total account value, as defined above
Wis the total maintentance margin requirement, as defined above
This formula is chosen such that the ratio
V / W is unchanged as individual positions are liquidated.
Assume an initial margin requirement of 10% and a maintenance margin requirement of 7.5%.
Trader A deposits 1000 USDC, then opens a short perpetual position of 1 XYZ (hypothetical asset) at a price of 2000 USDC. Their account balance is +3000 USDC, -1 XYZ. The oracle price is 2000 USDC/XYZ, making their margin percentage 50%.
Over time, the price of XYZ increases, and the oracle price hits 2791 USDC, at which point Trader A’s position is below the maintenance margin requirement and becomes liquidatable. The liquidator, which has a balance of +100 USDC, 0 XYZ, liquidates A’s position successfully at a best price on the books of $2800, and taking a 1% fee ($28).
This leaves Account A with 3000 - 2800- 28 = 172 USDC, and bringing the liquidator's balance to +2928 USDC, -1 XYZ. The liquidator then closes the short position on the market at a price of 2800 USDC, bringing its final balance to +128 USDC, 0 XYZ.
Example 2 - Partial Liquidation
Suppose Trader A has an account balance of +3000 USDC, -1 XYZ, but due to a rapidly increasing price in the underlying spot market, the oracle is now 2900 USDC, giving A a margin percentage of only 3.45%.
The liquidator, which has a balance of +100 USDC, 0 XYZ, would liquidate Trader A’s account. However, at the current oracle price, a full liquidation is not possible since it would leave the liquidator with a margin percentage of 6.90%. The liquidator executes a partial liquidation, taking on 60% of Trader A’s balances. This leaves A with 1200 USDC, -0.4 XYZ, and the liquidator with 1900 USDC, -0.6 XYZ.
At an oracle price of 2900 USDC, the liquidator’s account has a nominal value of 160 USDC, giving it a hypothetical profit of 60 USDC.
Trader A’s remaining position still has a margin percentage of 3.45%, and their remaining balance may be liquidated if they don’t make a deposit or trade out of their position.
What price is used to determine liquidations?
The Oracle Price is used to determine liquidations.