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

# Liquidation

When a margin account is liquidated, what it costs in each mode, and how to avoid it.

A margin account is liquidated when its equity falls below its maintenance margin, measured at the mark price.

> Equity = collateral + unrealized PnL at mark − funding owed

| Detail        | Isolated                                       | Cross                                                                        |
| ------------- | ---------------------------------------------- | ---------------------------------------------------------------------------- |
| Trigger       | Equity below the position's maintenance margin | Equity below the account's total maintenance margin                          |
| What closes   | That position                                  | Every position in the cross account                                          |
| Fee           | The position's remaining collateral            | Each position's maintenance rate on its notional, capped at remaining equity |
| What you keep | The rest of your balance is untouched          | Whatever equity is left                                                      |

### Isolated positions

* **Trigger:** equity below the position's maintenance margin, for example 0.22% of notional on a small BTC position.
* **What happens:** Imperial closes the position and settles it on Solana.
* **Fee:** the remaining collateral of the position is kept as the liquidation fee. Your loss is limited to the collateral you put in that position.

### Cross accounts

* **Trigger:** equity below the account's total maintenance margin: each position's maintenance on its mark notional, reduced by [Portfolio Margin](https://docs.imperial.trade/margin-and-risk/portfolio-margin.md) for hedged accounts.
* **What happens:** **every** position in the cross account is closed together. Cross liquidation is full, not partial.
* **Fee:** each position pays its own maintenance rate on its mark notional, for example about 0.23% on a $50,000 BTC position. The total is capped at your remaining equity, and whatever is left stays in your account. Because the fee is about the size of the maintenance margin, expect little to be left.

### Who liquidates

Imperial's keeper watches every account in real time and runs liquidations. Liquidation isn't permissionless: no third party can liquidate your position early or at a worse price.

### Bad debt

If a position loses more than its collateral before it can be closed, Imperial absorbs the shortfall. Your balance can't go negative, and other traders are never auto-deleveraged to cover it.

### Avoiding liquidation

* Use lower leverage or add collateral.
* Set a stop loss. It must sit before your liquidation price.
* On cross margin, remember that **closing one leg of a hedge can raise the margin on the rest**.
* TradFi markets can be liquidated while the underlying market is closed (see [Markets](https://docs.imperial.trade/trading/markets.md)).
* Link Telegram to get approaching-liquidation alerts.
