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

# Liquidation

A liquidation occurs when the value of a trader’s account falls below the required maintenance margin due to adverse price movement. Maintenance margin represents the minimum collateral required to keep a position open.

For assets listed on Zion, maintenance margin is determined based on the maximum leverage allowed for that market. Maximum leverage ranges between 3x and 40x, which implies maintenance margin requirements between 16.7% and 1.25%, respectively.

If a trader’s account equity drops below the maintenance margin threshold, the protocol attempts to close the position by submitting market liquidation orders to the order book. These orders target the full position size and may result in a partial or complete close depending on available liquidity. If the position is successfully reduced or closed such that maintenance requirements are satisfied again, any remaining collateral stays in the trader’s account.

If the account equity falls below two-thirds of the maintenance margin and the position cannot be liquidated through the order book, a backstop liquidation is triggered through the Liquidator Vault.

***

#### Cross Margin vs Isolated Margin

| Type            | What is Transferred During Backstop Liquidation | Effect on Account Equity                       |
| --------------- | ----------------------------------------------- | ---------------------------------------------- |
| Cross Margin    | All cross collateral and open positions         | Account equity may be fully depleted           |
| Isolated Margin | Only the specific isolated position + margin    | Other positions and balances remain unaffected |

During backstop liquidations, the maintenance margin is **not returned** to the trader. This margin acts as a buffer ensuring that the Liquidator Vault can operate sustainably and remain profitable on average. Traders can avoid reaching this stage by actively managing risk through stop-loss orders or manually closing positions before the liquidation price is reached.

Liquidations are executed using the **mark price**, which is derived from external market data combined with Zion’s internal order book state. This approach prevents manipulation and reduces the risk of liquidations being triggered by temporary order book spikes.Partial Liquidation Rules

***

#### System Design

* The majority of liquidations are routed directly to the **public order book**, allowing market participants to compete for liquidation flow.
* Zion **does not impose a liquidation clearance fee**. This preserves user capital while maintaining protocol safety.

***

#### Partial Liquidations

| Condition                                     | Action Taken                                                                   |
| --------------------------------------------- | ------------------------------------------------------------------------------ |
| Position > 100,000 USDC (10,000 USDC testnet) | Initially liquidates **20%** of the position via market order                  |
| After a partial liquidation occurs            | 30-second cooldown; additional events attempt to close full remaining position |

This mechanism reduces market impact while still allowing positions to be progressively reduced when necessary.

***

#### Liquidator Vault

Backstop liquidations are handled through the **Zion Liquidator Vault**, a decentralized safety mechanism designed to absorb positions that cannot be closed through the order book.

| Eligibility                                        | Action                   |
| -------------------------------------------------- | ------------------------ |
| Position falls below **2/3 of maintenance margin** | Transferred to the vault |

Profits generated through the Liquidator Vault are **distributed back into the ecosystem**, benefiting the broader community and protocol participants.

***

#### Liquidation Price Calculation

* **Estimated liquidation price** is shown when a position is opened.
* True liquidation price may shift due to:
  * Funding payments
  * Changes in unrealized PnL from other positions
  * Adjustments to available collateral in cross margin accounts

| Margin Type     | Effect of Leverage on Liquidation Price                    |
| --------------- | ---------------------------------------------------------- |
| Cross Margin    | Liquidation price does **not directly depend** on leverage |
| Isolated Margin | Leverage **directly affects** liquidation price            |

If the account does not have sufficient collateral to meet initial margin requirements, the estimated liquidation price assumes the account is topped up.

The liquidation price formula:

```
liq_price = price - side * margin_available / position_size / (1 - l * side)
```

Where:

Where:

```
l = 1 / MAINTENANCE_LEVERAGE
```

Maintenance leverage depends on the margin tier corresponding to the position size.

```
side = 1 for long positions
side = -1 for short positions
```

```
margin_available (cross) = account_value - maintenance_margin_required
margin_available (isolated) = isolated_margin - maintenance_margin_required
```
