# Liquidation Strategy

# Explanation

# Overview

The Liquidation Strategy feature allows exchange operators to define the order in which instruments are liquidated when an account becomes undercollateralized across multiple instruments sharing the same margin currency. This ordering is crucial for minimizing the impact of liquidations on both users and the exchange's insurance fund.

# Key Concepts

  • Liquidation Priority: Instruments are liquidated in the order specified by the strategy list
  • Default Ordering: Instruments not explicitly listed are processed last, in order of their creation
  • Cross-Margin Impact: All instruments sharing the same margin currency are affected by the strategy
  • Maintenance Margin: The minimum required ratio of account balance over position risk (calculated as position size × current mark price). This ratio must be maintained to avoid liquidation.
  • Liquidation Price: The price at which the account's equity over its risk exactly equals the maintenance margin ratio. When the mark price falls strictly below this threshold, liquidation is triggered.
  • Bankruptcy Price: The price at which the account's equity becomes exactly zero.
  • Risk Limit: Configurable position size thresholds that determine the maintenance margin requirement. Higher risk limits allow for larger positions but require higher maintenance margin ratios (lower leverage).

# Calculating Liquidation Price

The liquidation price is the mark price at which the account's equity would exactly equal the minimum required margin.

For a long position:

Liquidation Price = (Marked Price × Size - Balance) / ((1 - Maintenance Margin) × Size)

For a short position:

Liquidation Price = (Marked Price × Size - Balance) / ((1 + Maintenance Margin) × Size)

# Liquidation Process

Liquidation is triggered when an account's leverage exceeds the maintenance margin requirement for its current risk limit. The liquidation workflow processes instruments in breadth-first order according to the strategy list. For each instrument, it attempts these steps sequentially:

  1. Lower Risk Limits: Applied to all instruments first
  2. Cancel Orders: Processed if risk limit reduction is insufficient
  3. Partial Position Liquidation: Attempted to achieve lower risk limits
  4. Full Position Takeover: Last resort if previous steps fail

# Step Evaluation

The workflow intelligently evaluates each step's effectiveness:

  • Steps are skipped if they don't improve the margin position
  • If liquidating a position at a loss doesn't resolve undercollateralization, the workflow moves to the next instrument or step
  • The process stops immediately if the account regains sufficient collateralization

# Liquidation Fees

Two types of fees can be applied during liquidation:

  1. Taker Fees: Applied to the liquidated account. The amount is capped to ensure the transferred position doesn't create an immediate loss for the insurance fund.

  2. Maker Fees: Applied to the insurance fund itself, capped at its current equity. If the insurance fund has insufficient equity to pay the liquidation maker fees, these fees are waived.

# Important Considerations

  • Liquidity Priority: Exchanges typically prioritize more liquid instruments to minimize market impact
  • Strategy Validation: Non-existent instruments in the strategy list are silently ignored
  • Dynamic Nature: Early liquidations can affect the need to liquidate subsequent instruments based on:
    • Realized gains or losses from initial liquidations
    • Market prices at the time of liquidation
    • Available liquidity in each market

# Example

Consider an account with positions in XBTUSD, ETHUSD, and LTCUSD. The exchange has configured strategy:

[
  "XBTUSD",
  "ETHUSD"
]

The workflow would:

  1. Process XBTUSD first, attempting all steps
  2. Move to ETHUSD if needed
  3. Finally handle LTCUSD (unlisted) if the account remains undercollateralized

# Notes

  • Changes to the strategy take effect immediately for new liquidations
  • The strategy applies only to instruments sharing the same margin currency

# Reference

# API Endpoints

# Get Current Strategy

GET /Instrument/LiquidationStrategy

Response

[
  "XBTUSD",
  "ETHUSD"
]

Returns an ordered list of instrument symbols representing the current liquidation priority.

# Set Strategy

POST /Instrument/LiquidationStrategy

Request Body

[
  "XBTUSD",
  "ETHUSD"
]

Response: Returns the updated liquidation strategy list.