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

# What Is Liquidation in Perpetual Trading? How It Works & How to Avoid It

Liquidation is the automatic closure of a leveraged perpetual position when your margin balance falls below the maintenance margin level required to keep it open. The protocol closes your position and takes the collateral assigned to it. You don't lose more than you deposited — but you do lose the margin for that position.

Understanding liquidation is essential before using leverage. It's not a punishment or an error — it's a core part of how leveraged trading manages risk.

> **NFA.** Perpetual futures are leveraged products that carry a high risk of loss.

### Why Liquidation Exists

When you open a leveraged position, you're controlling a notional value larger than your actual collateral. If the market moves against you far enough, your losses can theoretically exceed your deposit.

To prevent traders from going into negative balances — and to protect the protocol from bad debt — perpetual trading platforms enforce a minimum margin level called the **maintenance margin**. If your margin drops below this threshold, the protocol liquidates your position automatically, before you can lose more than you put in.

Think of it as a hard floor: the protocol would rather close your trade at a loss than risk being left holding an uncollateralized position.

### Your Liquidation Price

Every leveraged position has a **liquidation price** — the specific mark price at which your position would be automatically closed.

The liquidation price is set the moment you open a trade. It depends on three things:

1. **Your entry price** — where you opened the position
2. **Your leverage** — higher leverage means the liquidation price is closer to your entry
3. **Your margin** — more collateral relative to position size means more buffer

**Rough rule of thumb:**

* At **10x leverage**, a \~10% move against you can trigger liquidation
* At **5x leverage**, it takes a \~20% move
* At **2x leverage**, it takes a \~50% move

The liquidation price is always displayed on your position panel before and after you open a trade. On AFX, you'll see it listed alongside your entry price and unrealized PnL. Check it before confirming any order.

### What Happens When You're Liquidated

The process happens automatically when the **mark price** (not the last traded price — the oracle-derived reference price) reaches your liquidation threshold:

1. **Position is closed** — the protocol forcibly closes your position at the best available price
2. **Remaining margin is taken** — your collateral for that position is used to cover the loss
3. **Insurance fund covers shortfall** — if the position closes at a price worse than your liquidation price (gap risk in fast markets), the protocol's insurance fund covers the difference
4. **If insurance fund is depleted** — in extreme cases, an auto-deleveraging (ADL) mechanism may partially unwind profitable positions on the other side to cover the loss. This is rare and a last resort.

**You do not receive any remaining margin once liquidation is triggered.** The entire collateral assigned to that position is gone. This is why managing your liquidation price matters — even a small buffer can mean the difference between surviving a volatile candle and losing your margin entirely.

### Isolated Margin vs Cross Margin

How much of your funds are at risk during liquidation depends on your margin mode:

#### Isolated Margin

Each position has its own dedicated margin. Only the collateral you explicitly assigned to that position can be liquidated — the rest of your account balance is protected.

* **Advantage:** One position getting liquidated doesn't affect others
* **Disadvantage:** A single position can be liquidated without access to your broader balance as a buffer

#### Cross Margin

All available collateral in your account is shared across all open positions. The platform draws from your full balance to keep any position from being liquidated.

* **Advantage:** More cushion before any single position hits its liquidation price
* **Disadvantage:** A losing position can draw down your entire account balance, potentially affecting multiple positions at once

Most beginners start with isolated margin — it limits the blast radius of any single bad trade.

### How to Avoid Liquidation

Liquidation is avoidable with disciplined position management:

**1. Use lower leverage** The higher your leverage, the closer your liquidation price is to your entry. Starting at 2x–5x gives significantly more room for price movement before a liquidation threshold is hit. Treat higher leverage as an advanced tool, not a default setting.

**2. Add margin to an at-risk position** If the market moves against you and your liquidation price is getting close, you can deposit more collateral into the position. This lowers your effective leverage and moves the liquidation price further away.

**3. Set a stop-loss before your liquidation price** A stop-loss order exits your position at a price you choose — before the protocol forces a liquidation. This means you control the exit, keep any remaining margin, and avoid the full loss of collateral that liquidation triggers. Set your stop-loss with enough buffer above the liquidation price to account for fast market moves.

**4. Monitor your margin ratio** Most trading interfaces display a margin ratio or health indicator that shows how close you are to liquidation. Check it regularly, especially during volatile market periods. On AFX, this is visible in real time on your position panel.

**5. Account for funding rate drag** Funding payments reduce your margin balance over time if you're on the paying side. A position that starts well-capitalized can creep toward its liquidation price if a high funding rate slowly erodes your margin. Factor expected funding costs into your position sizing. See [What Is a Funding Rate?](/basics/what-is-funding-rate.md)

### Liquidation vs Stop-Loss: Key Difference

These are often confused:

|                     | **Stop-Loss**                              | **Liquidation**                                     |
| ------------------- | ------------------------------------------ | --------------------------------------------------- |
| **Triggered by**    | A price level you set                      | The protocol's maintenance margin threshold         |
| **Who controls it** | You                                        | The protocol                                        |
| **Outcome**         | Position closed; remaining margin returned | Position closed; all margin for that position taken |
| **Control**         | Fully in your hands                        | Automatic, no override                              |

A stop-loss is not a protection against liquidation — it's a tool to exit a position *before* liquidation takes your margin. The two work together: set a stop-loss above your liquidation price to keep control of your exit.

### FAQ

**What happens when you get liquidated in crypto?** Your position is automatically closed by the protocol when your margin falls below the maintenance margin level. The collateral assigned to that position is taken to cover the loss. You don't owe anything beyond what you deposited, but you lose that margin entirely.

**Do you lose all your money in liquidation?** You lose the margin assigned to the liquidated position — not necessarily your entire account balance. If you're using isolated margin, only the collateral for that specific position is at risk. If you're using cross margin, your full account balance acts as a buffer, but a large loss can draw it down significantly.

**What is the liquidation price?** The liquidation price is the specific mark price at which your position would be automatically closed. It's calculated at the moment you open the trade based on your entry price, leverage, and collateral amount. It's displayed in your position panel and doesn't change unless you add or remove margin.

**How do you avoid liquidation in crypto perpetual trading?** Use lower leverage, set a stop-loss order above your liquidation price, monitor your margin ratio regularly, and add margin if a position moves against you. Accounting for funding rate costs before entering a long-duration trade also helps prevent gradual margin erosion.

***

### Internal Links

* [What Is a Perpetual DEX?](/basics/what-is-a-perpetual-dex.md) — how on-chain perp protocols handle liquidations via smart contracts
* [How to Trade Perpetuals On-Chain](/how-to-guides/how-to-trade-perpetuals-on-chain-a-step-by-step-guide.md) — where to find your liquidation price and margin ratio while trading
* [What Is a Funding Rate?](/basics/what-is-funding-rate.md) — how funding payments can slowly erode margin and bring a position closer to liquidation
* [On-Chain Perps vs CEX Perps](/basics/on-chain-vs-cex-perps.md) — how liquidation mechanisms differ between DEX and centralized platforms

**Trade on AFX →** [app.afx.xyz/trade](https://app.afx.xyz/trade) *(NFA — perpetual futures carry a high risk of loss. Availability varies by jurisdiction.)*


---

# 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.afx.xyz/basics/what-is-liquidation.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.
