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

# Liquidation Mechanism

#### Partial Liquidation First

When a position breaches maintenance margin:

**Step 1: Partial Reduction**

* Position is reduced proportionally
* Goal: Restore account to safe margin levels
* Minimizes capital loss for trader
* Prevents unnecessary full liquidations

**Step 2: Full Liquidation (If Needed)** Only if partial liquidation insufficient:

* Entire position closed
* Liquidation penalty applied
* Insurance fund covers any shortfall

**Liquidation Penalty** Calibrated to:

* Prevent predatory liquidations
* Discourage excessive leverage
* Ensure liquidators have incentive
* Maintain system health

***

### Insurance & Backstop Mechanisms

**Insurance Fund**

* Protocol-owned reserve funded by liquidation penalties
* Covers losses when liquidations occur below maintenance margin
* Transparent balance published on-chain

**Backstop Auction** In extreme scenarios where insurance is insufficient:

1. Position auctioned to liquidators
2. Dutch auction format (price decreases over time)
3. Ensures orderly liquidation even in illiquid conditions
4. Protects against cascading failures

**Social Loss Distribution** Last resort if all backstops exhausted:

* Losses distributed proportionally across profitable traders
* Transparent and verifiable process
* Historical precedent from successful exchanges

***

### Liquidation Example

**Scenario**: Trader has 10 ETH-PERP long at $3,000 (30,000 USD position)

* Initial margin: 10% ($3,000)
* Maintenance margin: 5% ($1,500)
* Current collateral: $2,000

**ETH drops to $2,900**:

* Position value: $29,000
* Margin requirement: $1,450 (still safe ✅)

**ETH drops to $2,800**:

* Position value: $28,000
* Margin requirement: $1,400
* **Liquidation triggered** ⚠️

**Partial Liquidation**:

* 5 ETH-PERP closed at $2,800 = $14,000 reduction
* Remaining position: 5 ETH-PERP long
* New position value: $14,000
* Margin requirement: $700
* Current collateral: $2,000 - loss
* **Account restored to health** ✅


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.opaldex.com/risk-engine/liquidation-mechanism.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
