> For the complete documentation index, see [llms.txt](https://docs.koo.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.koo.xyz/risk-and-liquidations/liquidations-and-adl.md).

# Liquidations & ADL

## 1. Risk Ratio and Maintenance Margin

### 1.1 What is Risk Ratio?

The **Risk Ratio** is the sole triggering metric for forced liquidation in Cross Margin mode. It is defined as the ratio of the total maintenance margin required for all open positions and active orders relative to the total account margin available.

$$\text{Risk Ratio} = \frac{\sum \text{Position Maintenance Margin} + \text{Pending Order Maintenance Margin} + \text{Estimated Closing Fees}}{\text{Total Account Margin} - \text{Estimated Opening Fees}}$$

***

### 1.2 Maintenance Margin Calculation Logic

To prevent account equity shocks caused by unfilled orders during volatile market conditions, Koo.xyz incorporates **both active positions and open orders** into the maintenance margin calculation.

Rather than summing all values linearly, the system analyzes the **worst-case scenario** between long and short directions. Positions and orders in opposite directions offset each other, lowering the total maintenance margin requirement and increasing capital efficiency.

**Calculation Example:**

* **Positions & Active Orders:**
  * **Current Position:** 1 BTC Long
  * **Pending Orders:** 2 BTC Buy Limit + 3 BTC Sell Limit
  * **Current Mark Price:** 60,000 USDC
  * **MMR:** 0.5%

**Worst-Case Scenario Analysis:**

<table><thead><tr><th width="275.30078125">Scenario</th><th>Maximum Position (Net Long / Short)</th></tr></thead><tbody><tr><td><strong>If all Buy orders fill</strong></td><td>1 + 2 = 3 BTC (Net Long)</td></tr><tr><td><strong>If all Sell orders fill</strong></td><td>1 - 3 = -2 BTC (Net Short)</td></tr></tbody></table>

The system selects the maximum absolute net exposure: **3 BTC**.

$$\text{Maintenance Margin} = 3 \times 60{,}000 \times 0.5% = 900 \text{ USDC}$$

> **💡 Capital Efficiency:** Without hedging logic, a simple summation would require 6 BTC\* 60,000 \* 0.5% = 1,800 USDC. The offsetting logic reduces the margin requirement by **50%**.

***

#### 1.3 Risk Ratio Calculation Example

**Account Portfolio & Orders:**

* **Total Account Margin:** 5,000 USDC
* **BTC/USDC Long Position:** Mark Price = 62,000 | Size = 0.1  | MMR = 0.5%
* **ETH/USDC Short Order:** Mark Price = 3,000 | Size = 10  | MMR = 0.8%
* **Taker Fee Rate:** 0.06%

**Calculation Process:**

* **Position Maintenance Margin:** 62,000 \* 0.1  \* 0.5% = 31 USDC
* **Pending Order Maintenance Margin:** 3,000 \* 10 \* 0.8% = 24 USDC
* **Estimated Closing Fees:** 62,000 \* 0.1 \* 0.06% = 3.72 USDC
* **Estimated Opening Fees:** 3,000 \* 10 \* 0.06% = 18 USDC

$$\text{Risk Ratio} = \frac{31 + 24 + 3.72 + 18}{5{,}000 - 18} = \frac{76.72}{4{,}982} \approx 1.54%$$

***

## 2. Forced Liquidation Triggers

### 2.1 Risk Ratio Thresholds

| Risk Ratio | Trigger Action                                                             |
| ---------- | -------------------------------------------------------------------------- |
| **90%**    | The system automatically cancels all active pending orders in the account. |
| **100%**   | Forced liquidation is triggered.                                           |

### 2.2 Partial Liquidation for Large Positions

When total position value reaches **600,000 USDC**, the system executes **partial liquidation** rather than closing the entire position at once. This incrementally reduces the Risk Ratio back to a safe level, mitigating market impact slippage.

> **⚠️ Important Notice:** In Cross Margin mode, the estimated liquidation price is for reference only. **A Risk Ratio reaching 100% is the sole trigger for liquidation.** Traders are advised to monitor account Risk Ratio closely and set stop-loss orders in advance.

***

## 3. Liquidation Price Calculation

While liquidation in Cross Margin mode is triggered by Risk Ratio rather than individual asset liquidation prices, estimating liquidation prices helps traders evaluate position safety.

### 3.1 Formula

$$\text{AMR} = \frac{\text{Total Account Margin}}{\sum |\text{Mark Value}|}$$

$$\text{Liquidation Price} = \text{Mark Price} \times \left(1 - \text{side} \times (\text{AMR} - \text{MMR} - \text{Taker Fee})\right)$$

Where:

* **AMR (Account Margin Ratio):** Reflects overall account margin adequacy.
* **side:** +1 for Long positions; -1 for Short positions.
* **MMR:** Maintenance Margin Rate for the specific pair.

***

### 3.2 Calculation Example

**Account Portfolio:**

* **Total Account Margin:** 1,000 USDC
* **BTC/USDC Long Position:** Mark Price = 62,000 | Size = 0.01  (620 USDC value) | MMR = 0.5% | Taker Fee = 0.06%
* **ETH/USDC Short Position:** Mark Price = 3,800 | Size = -1 (3,800 USDC value) | MMR = 1.0% | Taker Fee = 0.06%

**Step 1: Calculate Account Margin Ratio (AMR)**

$$\text{AMR} = \frac{1{,}000}{620 + 3{,}800} = \frac{1{,}000}{4{,}420} \approx 22.62%$$

**Step 2: Calculate Liquidation Price for BTC/USDC Long (side = +1)**

$$\text{Liq Price}\_{\text{BTC}} = 62{,}000 \times \left(1 - 1 \times (22.62% - 0.5% - 0.06%)\right) = 62{,}000 \times (1 - 0.2206) = 48{,}322.8\text{ USDC}$$

**Step 3: Calculate Liquidation Price for ETH/USDC Short (side = -1)**

$$\text{Liq Price}\_{\text{ETH}} = 3{,}800 \times \left(1 - (-1) \times (22.62% - 1.0% - 0.06%)\right) = 3{,}800 \times (1 + 0.2156) = 4{,}619.28\text{ USDC}$$

***

## 4. Auto-Deleveraging (ADL)

### 4.1 What is Auto-Deleveraging (ADL)?

Auto-Deleveraging (ADL) is the platform's ultimate safety mechanism to preserve overall solvency. ADL is triggered when an account experiences bankruptcy (account equity or position value falls below zero) and the platform Insurance Fund cannot fully absorb the deficit.

During liquidation, positions that cannot be closed in the open market at prices better than the bankruptcy price are taken over by the **Insurance Fund**. If extreme market conditions deplete the Insurance Fund, ADL is activated, matching bankruptcy positions directly against opposing profitable accounts based on a system ranking.

***

### 4.2 ADL Execution Logic

When ADL is triggered, the platform ranks opposing profitable accounts based on a combined score of **PnL Percentage** and **Effective Leverage**:

$$\text{ADL Ranking Metric} = \text{Unrealized PnL %} \times \text{Effective Leverage}$$

* **Priority Matching:** Accounts with higher rankings (higher profits and higher leverage) are selected first for auto-deleveraging.
* **Execution Price:** Selected positions are closed at the current **Mark Price** at the moment of ADL activation directly against the bankrupt positions, preventing bad debt accumulation on the exchange.

***

### 4.3 Core Principles of ADL

* **Platform Solvency Protection:** ADL acts as the final line of defense against system-wide default.
* **Uninvolved Accounts Are Safe:** Users without open positions are never subjected to loss socialization.
* **Transparent Ranking:** Counterparties are chosen objectively based on open, deterministic PnL and leverage metrics.

***

### 4.4 How to Reduce ADL Risk

1. **Lower Leverage:** Reduce effective leverage to lower your ADL ranking score.
2. **Take Partial Profits:** Realize gains on highly profitable positions to decrease unrealized PnL percentage.
3. **Monitor Account Health:** Adjust positions proactively during periods of extreme market volatility.

***

> **⚠️ Risk Warning:** Trading cryptocurrency derivatives involves high market risk. Please monitor your Risk Ratio closely and utilize stop-loss orders to manage your downside exposure effectively.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.koo.xyz/risk-and-liquidations/liquidations-and-adl.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
