Liquidation refers to an event when margin level hits the Maintenance Margin, the position has to be closed and you lose all your Position Margin. It is triggered when the Mark Price hits the Liquidation Price.
Liquidation Price (Isolated Margin, traders are allowed to add in the extra margin to position)
Initial Margin Rate = 1/Leverage
Maintenance Margin Rate (MMR) is based on Tiered Margin.
Liquidation Price = Entry Price * (1 - Initial Margin Rate + Maintenance Margin Rate) - Extra Margin Added/ Contract Size
Trader place a long entry of 1 BTC at 10,000 USDT with 50x leverage. Assuming no extra margin added.
Liquidation Price = 10,000 USDT * (1 - 2% + 0.5%) = 9,850 USDT
Liquidation Price = Entry Price * (1 + Initial Margin Rate - Maintenance Margin Rate) + Extra Margin Added/ Contract Size
Trader place a short entry of 1 BTC at 8,000USDT with 40x leverage. Assuming no extra margin added.
Liquidation Price = 8,000 USDT * (1 + 2.5% - 0.5%) = 8160 USDT
Liquidation Price (Margin type: Cross Margin)
Comparing to Isolated Margin, Liquidation Price under Cross Margin mode might keep changing as the available balance will be affected by the other trading pairs. Under cross margin mode, the initial margin used for each position is isolated from the account balance but the remaining balance is shared. The available balance will be affected by the unrealized P&L that occurred by all existing positions. Liquidation only happened when the available balance = 0 and each position do not have enough maintenance margin respectively.
Example 1(Only one unhedged position):
Under Cross Margin, assuming trader A holding a 2BTC Long position at 10,000 USDT. The current available balance is 2,000 USDT, current mark price = 10,500USDT, unrealized profit(Mark Price) is 1,000 USDT.
Initial Margin = 2*10,000*1% = 200USDT
Maintenance Margin = 2 *10,000*0.5% = 100USDT
Available Balance = 2,000USDT
Total Sustainable Loss = Available Balance + Initial Margin - Maintenance Margin
= 2,000 + 200 -100 USDT
= 2,100 USDT
With 2,100USDT, the position can sustain a price loss of 1,050 USDT (2,100/2). Therefore, the liquidation price of this position would be 9,450USDT (10,500-1050).
Using the above logic, we can derive the liquidation price (Long) as below.
Current Mark Price (MP) - Liquidation Price(LP) = [Available Balance (AB) + Initial Margin (IM) - Maintenance Margin (MM)]/ Exposed Position Size (EPS)
LP (Long) = MP - (AB+IM-MM)/EPS
LP (Short) = MP+(AB+IM-MM)/EPS
Example 2 (One hedged position):
Under Cross Margin, assuming trader B holding a 2BTC Long position with entry price at 10,000 USDT. The current available balance is 3,000 USDT, current Mark Price is 9,500 USDT, unrealized loss for the Long position (Mark Price) is 1,000 USDT. At the same time, he is holding a Short position of 1BTC with entry price at 9,500 USDT.
For the short position, it will never be getting liquidated as the Contract Size of Long position > Contract Size of Short position, whenever the price goes up, the unrealized profit for long position is always greater than the unrealized loss of the short position.
For the long position, we only need to consider the net exposure of the position abs(Long - Short ) = abs(2BTC - 1BTC) = 1BTC when calculating the liquidation price.
IM = 1*10,000*1% = 100USDT
MM = 1*10,000*0.5% = 50USDT
AB = 3,000 USDT
LP (Long) = 9,500 - (3,000+100-50)/1 = 6,450 USDT
Example 3 (Multiple unhedged positions)
Under Cross Margin, assuming trader C holding a 2BTC Long position with entry price at 10,000 USDT. The current available balance is 2,500 USDT, current mark price 11,500USDT, unrealized profit for the BTC Long position (Mark Price) is 3,000 USDT. At the same time, he is holding a Short position of 100ETH with entry price at 200 USDT, current mark price 205 USDT, an unrealized loss for the ETH short position (Mark Price) is 500 USDT.
For BTC position,
IM = 2*10,000*1% = 200USDT
MM = 2*10,000*0.5% = 100USDT
AB = 2,500 USDT
LP (Long) = 11,500 - (2,500+200-100)/2 = 10,200 USDT
The liquidation price for a long/short position might be higher/lower than its entry price, as the unrealized profit of the position will be shared with the other position in loss.
For ETH position,
IM = 100*200*2%= 400USDT
MM = 100*200*1%= 200USDT
AB = 2,500 USDT
LP (Short) = 205 + (2,500+400-200)/100 = 232 USDT