> For the complete documentation index, see [llms.txt](https://xdex.gitbook.io/xdex/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xdex.gitbook.io/xdex/star-here/trading-perpetual-contracts/contract-liquidations.md).

# Contract Liquidations

Learn about XDEX's liquidation mode

Liquidations on an exchange refer to the automated process of closing leveraged trading positions when a trader's account balance, or "margin," gets too low to cover potential losses.

Just as a car running low on fuel would need to stop to avoid stalling, liquidations prevent traders from going into debt by ensuring their losses don't exceed their initial investment.

Liquidation mechanisms vary for each exchange, which sets unique and publicly available maintenance weights that are used to determine the risk profile of a given market. Some exchanges might have tighter liquidation thresholds, meaning your position could get liquidated more quickly if the market moves against you. Others might offer more leniency, giving you a bit more room before liquidation kicks in.

Liquidations safeguard an exchange's solvency by settling accounts between traders, maintaining fairness, and preventing potential disruptions that could arise from underfunded positions amid volatility.

You can find XDEX’s market specifications, including maintenance weights, in the “**Perpetual Contracts**” section.

Efficiently structured liquidation processes on XDEX are supplemented by risk management tooling for users, including portfolio and position health indicators on the front-end along with trigger orders.

***

XDEX uses Oracle Price to avoid liquidation caused by low liquidity or market manipulation.

Under cross margin mode, when available balance decreases to 0 and position margin decreases to maintenance margin level, the position is liquidated.

Liquidations protect the protocol and users from the risk of systemic bankruptcy. When an account's ***maintenance health*****&#x20;falls below 0**, it enters liquidation. The assets and perpetual positions of the subaccount will be closed in the following order:

1. **Orders are canceled**.
2. **LPs are decomposed**.
3. **Assets are liquidated (Spot Balances/Long Spreads/Perps)**.
4. **Liabilities are liquidated (Borrows/Short Spreads)**.

Any user can purchase assets from the liquidating account at a discount or pay off its liabilities at a markup until the underwater account's ***Initial Health*****&#x20;rises above 0**.

If, at any point during the liquidation process, the ***Initial Health*****&#x20;of the account exceeds 0**, liquidation will cease.
