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

# Reference

### Liquidation

#### Trigger Condition

A liquidation is triggered when the Account Margin Ratio (AMR) falls below the Maintenance Margin Ratio (MMR):

account\_margin\_ratio < maintenance\_margin\_ratio

RWAPerp uses the Mark Price to determine whether liquidation is triggered. The Maintenance Margin Ratio changes dynamically based on market parameters and position size.

#### Liquidation Price

The liquidation price is calculated by the RWAPerp risk engine based on total account collateral, all positions, the Mark Price, dynamic margin requirements, and unsettled PnL. Refer to the estimated liquidation price displayed on the RWAPerp trading interface.

#### Liquidation Process

1\. Trigger: The system detects that the account margin ratio has fallen below the maintenance margin ratio.

2\. Cancel & Freeze: The system cancels all open orders for the account and freezes withdrawals, transfers, and other operations.

3\. Partial Liquidation: The system calculates the position size that needs to be liquidated to restore the account margin ratio to the Initial Margin Ratio (IMR).

4\. Liquidator Takeover: Qualified liquidators with sufficient collateral may take over the liquidated position at a discount per system rules. RWAPerp typically does not sell the entire position directly into the order book.

5\. Insurance Fund Backstop: If the account is insolvent, or the remaining collateral is insufficient to cover liquidation costs, unprocessed positions and debt may be transferred to the insurance fund.

<br>


---

# 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://rwaperp-1.gitbook.io/rwaperp-docs/risk-and-liquidation/reference.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.
