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

# Liquidations

Liquidation is the forced closure of a wallet's positions when its equity falls below the minimum margin requirement. It is a critical safety mechanism that protects the solvency of the platform and prevents losses from affecting other traders.

## When Does Liquidation Occur?

A wallet's equity — its total value — is determined by index pricing and changes independently of any trading activity. When a wallet's equity falls below its total maintenance margin requirement, the wallet becomes eligible for liquidation.

## How Liquidation Works

When a wallet is liquidated, all open positions are closed at the **close price**, resulting in zero quote balance and zero equity. The close price is derived from the index price, adjusted by the maintenance margin fraction and the wallet's current equity ratio:

```
Close Price = Index Price ± Close Price Adjustment

Close Price Adjustment = Index Price × Maintenance Margin Fraction × Equity / Total Maintenance Margin Requirement
```

The close price adjustment is **subtracted** for long positions and **added** for short positions.

Profits and losses resulting from liquidation are absorbed by the **insurance fund**.

## Insurance Fund

The insurance fund absorbs profits and losses that result from liquidations. If the insurance fund cannot absorb a liquidation, the system proceeds with auto-deleveraging (ADL).

## Auto-Deleveraging (ADL)

In the event that the insurance fund cannot absorb a liquidation, the system falls back to **auto-deleveraging (ADL)**. During ADL, positions of the liquidated wallet are closed directly against opposing positions at the close price. ADL results in the same zero collateral and zero equity outcome for the liquidated wallet, and forcibly realizes unrealized PnL for the selected counterparty wallets.

While avoiding ADL is a priority, it is a necessary last resort to protect the solvency of the system.

#### ADL Counterparty Selection

Counterparty wallets are selected at the time of ADL according to each position's ADL score. The score favors positions with high leverage and high unrealized profit:

```
ADL Score = Margin Ratio × PnL Percent

Margin Ratio = Total Maintenance Margin Requirement / Equity

PnL Percent = Position Unrealized PnL / MAX(1, Equity − Total Unrealized PnL)
```

Multiple counterparty positions may be selected to fully offset a single liquidated position.

#### ADL Risk Indicator

Each open position reports an `adlQuintile` value (1–5) indicating the estimated risk of being selected as an ADL counterparty at the current index price. A value of **1** indicates low risk; **5** indicates the highest risk. Traders can monitor this value to assess and manage their ADL exposure.

***

## After Liquidation

Liquidated wallets are not locked or restricted. A wallet that has been liquidated may immediately deposit funds and resume trading.

***

## Avoiding Liquidation

To reduce the risk of liquidation:

* **Monitor your margin ratio** — Keep it well below 1. The closer it is to 1, the closer you are to liquidation.
* **Use conservative leverage** — Lower leverage means more collateral relative to your position, providing a larger buffer.
* **Set stop-loss orders** — Automatically close positions before they reach your liquidation price.
* **Manage position size** — Larger positions require more margin. Consider the incremental margin requirements for positions that exceed a market's base position size.
* **Maintain excess free collateral** — Having available collateral beyond your margin requirements provides a safety buffer.
