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

# Liquidation

Liquidation is a risk control mechanism that forcibly closes positions when a trader's margin is insufficient to cover potential losses. BBX implements a structured forced liquidation process to protect both individual traders and the overall market stability.

**Liquidation**

Liquidation is triggered when a position's available margin falls to or below the maintenance margin requirement. At this point, the position can no longer safely absorb further losses.

Upon triggering forced liquidation:

* The system will forcibly close the position.
* The maintenance margin is reduced to zero.
* All open orders for the affected contract will be canceled to free up margin.

**Mark Price**

BBX uses the mark price — not the last traded price — to assess liquidation conditions, preventing unnecessary forced liquidation from brief price anomalies, low-liquidity trades, or short-term market manipulation. Liquidation is only triggered when the mark price reaches the liquidation price.

**Partial Liquidation**

Rather than closing the entire position at once, BBX uses partial liquidation wherever possible. Partial liquidation:

* Gradually reduces position size.
* Reduces maintenance margin requirements.
* Minimizes market impact.
* Increases the probability of position survival.

**Open Order Handling**

When liquidation is triggered:

* All pending open orders for the same contract will be canceled.
* The margin reserved for those orders will be released.
* Open orders for other contracts are unaffected.

**Margin Modes**

BBX supports both Isolated Margin Mode and Cross Margin Mode.

**1) Isolated Margin Mode**

In isolated margin mode, each position has an independent margin allocation. Losses are limited to the margin allocated to that position and do not affect other balances in the account.

Liquidation Price Formulas (Isolated):

* Long Position: (Average Entry Price × Quantity × Contract Value + Maintenance Margin − Initial Margin) ÷ (Quantity × Contract Value) (rounded up)
* Short Position: (Average Entry Price × Quantity × Contract Value − Maintenance Margin + Initial Margin) ÷ (Quantity × Contract Value) (rounded down)

**2) Cross Margin Mode**

In cross margin mode, all available account balances serve as shared margin for all positions. The initial margin is calculated for a specific position, while all remaining available balances collectively support all open positions.

Liquidation occurs only when:

* Available margin falls to zero, AND
* Maintenance margin requirements can no longer be met.

**Liquidation Outcomes:**

* If losses exceed the margin, all margin is lost.
* If losses are less than the margin, the remaining margin is returned.
* Liquidation execution is irreversible and may be filled at unfavorable prices during periods of extreme market volatility.

⚠️ **Perpetual contracts carry extremely high risk.** Leverage amplifies losses, and liquidation is irreversible. Only use funds you can afford to lose entirely.
