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

# Liquidation

When a trader's margin ratio reaches 100%, the system initiates liquidation to prevent further losses. AFX employs a multi-layered liquidation system designed to minimize the impact on traders while maintaining platform solvency.

## Liquidation Trigger

Liquidation is triggered when:

```
Margin Ratio = Maintenance Margin (MM) / Position Equity = 100%
```

The trigger condition is the same for both Cross and Isolated margin modes, but the Equity calculation differs:

**Isolated Margin:**

```
Position Equity = Position Margin + Isolated Unrealized PNL
              = Initial Margin + Close Fee + Added Margin + Isolated Unrealized PNL
```

**Cross Margin:**

```
Position Equity = Wallet Balance + Cross Unrealized PNL - Isolated Balance (IB)
```

Where IB = total margin locked in isolated positions.

## Margin Ratio Alerts

For users registered with email, the system sends warning notifications at the following thresholds:

| Margin Ratio | Alert                                            |
| ------------ | ------------------------------------------------ |
| 50%          | First warning — add margin recommended           |
| 67%          | Second warning — add margin urgently recommended |
| 100%         | Liquidation triggered                            |

## Liquidation Process

See [Liquidation Process](/trading-rules/liquidation-process.md) for the detailed multi-phase liquidation flow.

## Auto-Deleveraging (ADL)

In extreme market conditions where normal liquidation cannot fully close a position, the Auto-Deleveraging system is activated. See [ADL](/trading-rules/adl.md) for details.

## Estimated Liquidation Price

The estimated liquidation price is displayed on the trading interface for reference. The formulas are:

**Long position:**

```
Liq. Price = (1 - 1/L) × 1/(1 - MMR - feeRate) × Entry Price
```

**Short position:**

```
Liq. Price = (1 + 1/L) × 1/(1 + MMR + feeRate) × Entry Price
```

Where:

* **L** = Effective leverage = Position Value / Equity
* **MMR** = Maintenance Margin Rate (see [Risk Limits](/trading-rules/risk-limits.md))
* **feeRate** = Taker fee rate

The estimated liquidation price is rounded to the tick size (up for longs, down for shorts) and is for reference only — actual liquidation depends on the real-time margin ratio reaching 100%.


---

# 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:

```
GET https://docs.afx.xyz/trading-rules/liquidation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
