How Does OKEx Calculate Liquidation?

·

Understanding how a cryptocurrency exchange calculates liquidation is crucial for any trader engaging in leveraged positions. Liquidation, often called "getting liquidated" or "being stopped out," is a risk management process that automatically closes a trader's leveraged position when their initial margin is mostly or entirely lost. This mechanism protects both the trader from further losses and the exchange from potential unpaid debts.

At its core, the process involves comparing a position's maintenance margin requirement against the trader's equity in real-time. When the equity falls to or below the maintenance margin level, the liquidation engine is triggered. The specific formula and data points used can vary by platform.

On many major exchanges, the calculation is not based on a single price source. To prevent market manipulation through "wick" or "spike" events, a mark price is often used. This price is typically derived from a combination of the spot index price from several major exchanges and a decaying funding rate premium. The general formula can be simplified as: Mark Price = Spot Index Price + (Time-Decayed Premium).

This method helps protect traders from being liquidated by abnormal, short-term price movements that may not reflect the broader market trend. While this is a significant benefit, a potential downside is that during periods of extreme volatility, you might be unable to manually close a position before the automated system does it for you.

For traders, this means constantly monitoring your margin ratio is essential. Your equity is the total value of your account assets if all positions were closed at the current mark price. The margin ratio is a key metric, often expressed as: Margin Ratio = (Maintenance Margin / Equity) * 100%. When this ratio hits 100%, liquidation occurs.

The Step-by-Step Liquidation Process

The journey to a liquidation event follows a clear, automated process:

  1. Position Opening: A trader opens a leveraged position by depositing initial margin.
  2. Price Movement: The market moves against the trader's position.
  3. Equity Depletion: The unrealized loss increases, causing the trader's equity to decrease.
  4. Margin Call: Some platforms may issue a warning or "margin call" when equity approaches the maintenance margin level, urging the trader to add more funds.
  5. Liquidation Trigger: The system continuously calculates the margin ratio. Once equity equals the maintenance margin (Margin Ratio = 100%), the liquidation process is automatically triggered.
  6. Order Execution: The exchange's system begins closing the position by executing market orders.
  7. Bankruptcy Handling: If the position is closed at a worse price than expected, resulting in a loss greater than the initial margin, the exchange may use an insurance fund to cover the difference. If the insurance fund is insufficient, a process like auto-deleveraging (ADL) may be used to socialize the loss among profitable traders.

Key Factors Influencing Liquidation

Several variables directly impact your liquidation price and risk:

To effectively manage this risk, many advanced traders utilize real-time risk management tools that provide precise calculations and alerts.

Frequently Asked Questions

What is the difference between liquidation and a stop-loss?
A stop-loss is a voluntary order set by a trader to close a position at a specific price to cap losses. Liquidation is an involuntary, forced closure executed by the exchange's system when your margin is depleted. You control a stop-loss; the exchange controls liquidation.

Can I avoid being liquidated?
Yes, by actively managing your positions. You can avoid liquidation by depositing additional margin to increase your equity (a process known as "margin top-up") or by partially closing your position to reduce your exposure and maintenance margin requirement.

What happens if my liquidated position causes a debt?
Most major exchanges maintain an insurance fund filled with fees from liquidations. If a position is closed at a loss that exceeds the trader's remaining equity, this insurance fund is used to cover the gap. This prevents the debt from being passed on to other traders.

Why did I get liquidated if the price didn't hit my calculated price?
This often occurs because exchanges use a mark price for liquidation calculations, not the last traded price on their own platform. The mark price, derived from an index of external spot markets, may differ from the platform's trading price, especially during volatile or low-liquidity periods.

Is the liquidation process the same for all contract types?
The fundamental principle is the same for perpetual swaps and futures contracts. However, delivery/futures contracts have an expiry date, which can add time-based pressure, while perpetual swaps rely on funding rates to anchor the price, which can also impact margin calculations.

What is a forced Liquidation?
"Forced liquidation" is simply another term for the standard liquidation process. It emphasizes that the closure of the position is not by the trader's choice but is mandated and executed by the exchange's risk management system once certain thresholds are breached.