# Liquidation

> When a position is liquidated, how the liquidation price is calculated and how to avoid it.

Source: https://docs.botradix.com/liquidation/

Liquidation closes a position when its equity reaches maintenance or falls below it. It limits further exposure under the contract rules; it does not guarantee protecting the remaining collateral or vault from losses.

## When it happens

- **Cross positions:** when the account's health factor reaches 1 or less, that is, when equity falls to the total maintenance margin (0.5% of the size of your cross positions, or the market's own value if it has one).
- **Isolated positions:** when the position's margin plus its PnL, minus funding, falls to its maintenance margin (0.5% of its size, or the market's own value) or less.

The maintenance margin of a position is fixed when it is opened. See [Leverage and margin](https://docs.botradix.com/margin/#initial-and-maintenance-margin).

The terminal warns you when the health factor drops below 1.25.

## Liquidation price

**Isolated positions.** The price can move against you by roughly:

```text
distance ≈ 1 / leverage − 0.5% (maintenance)
```

| Leverage | Approximate adverse move to liquidation |
|---|---|
| 5x | 19.5% |
| 10x | 9.5% |
| 25x | 3.5% |
| 50x | 1.5% |
| 100x | 0.5% |

This is a linear approximation with no funding or margin changes and 0.5% maintenance. Opening and service fees are paid separately from isolated margin and do not reduce it. The actual price depends on funding (funding paid while the position is open moves the liquidation price closer), margin additions or withdrawals, the maintenance stored in the position, market orientation and rounding.

**Cross positions.** The liquidation price depends on your whole account. For a single cross position, approximately:

```text
long:  liquidation price ≈ entry × (1 − (cross collateral − maintenance) / size)
short: liquidation price ≈ entry × (1 + (cross collateral − maintenance) / size)
```

> **Example.** A 1,000 USDC short entered at 100, with 200 USDC of cross collateral and a 5 USDC maintenance margin: liquidation ≈ 100 × (1 + 195 / 1,000) = 119.5. Adding collateral moves it further away; withdrawing collateral moves it closer.

The terminal estimates liquidation prices from available account data. Prices, funding, margin and other positions can change before execution; the estimate is not a guaranteed execution price.

## What happens at liquidation

Since version 2.1, a liquidation is a **single execution that closes the whole position** at the current oracle price.

| | Isolated position | Cross position |
|---|---|---|
| Loss covered by | That position's margin | Your free USDC collateral |
| Penalty | With the v2.2 reference values, the remaining margin of the position (split 90% to the vault and 10% to the BAQ reserve); penalty and split are adjustable in the current code. In practice the full isolated margin is lost | No additional penalty; losses are collected under the collateral rules |
| Settlement scope under the current code | Position margin; fees are charged separately | Shared collateral; other positions can also reach liquidation |

If a cross loss exceeded your USDC, the excess would be covered by the committed BAQ reserve and then by the vault. Under the code in force, your deposited BAQ is not sold to cover losses; this does not remove BAQ price risk or the risk of logic changes during the open phase.

## Who liquidates

The protocol **keeper** monitors positions and executes liquidations with current signed prices. The liquidation function is public (anyone may call it for a liquidatable position) and pays no reward. Liquidations never charge an execution fee.

Liquidation requires a current oracle price for the market. While a market is closed (`SESSION_CLOSED`), ordinary opens, closes and liquidations that need an open-session price are suspended. Challenge, freezing and emergency procedures have their own rules and allow closes at fixed prices when their conditions are met. A fixed market (frozen or in an emergency) counts in your account's health, in every calculation, at its fixed price and funding index, never at the live oracle price. Closing a session alone does not stop valid funding.

## Auto-deleveraging is not a liquidation

Auto-deleveraging (ADL) also closes positions without your request, but for the opposite reason: it reduces or closes **winning** positions when the vault is at risk, without a closing fee or penalty. The profit cap applies and funding is settled; the net is paid from available liquidity and any uncovered part becomes a deferred payment, so immediate payment of the entire gross gain is not guaranteed. See [Backed take profit and auto-deleveraging](https://docs.botradix.com/margin/#backed-take-profit-and-auto-deleveraging).

## How to avoid it

- Use lower leverage: the table above shows how quickly high leverage reaches liquidation.
- A **stop loss** can reduce exposure before liquidation, but its execution and price depend on the oracle, the keeper and market conditions.
- Add collateral (cross) or margin (isolated) when the health factor approaches 1.25.
- Remember that withdrawing collateral moves cross liquidation prices closer.
- Watch funding on long-held positions.

> [!CAUTION]
> In fast markets the price can jump past your stop loss or liquidation price. A liquidation is final.
