# Margin & Liquidation

## Margin & Liquidation

This page explains how **margin level** works in Portal and how to avoid liquidation when trading with leverage.

***

### What is Margin Level?

**Margin level** helps you understand the health of your leveraged position:

**Margin level** = (**balance** + **collateral**) / **total debt**\
(Default: 999.00 when no positions are open)

* **Balance** = any unrealized PnL (profit or loss)
* **Collateral** = tokens you’ve deposited as margin
* **Total Debt** = borrowed amount + accumulated funding cost

***

### Risk Tiers

<table><thead><tr><th width="155.84375">Risk Level</th><th width="178.6328125">Margin Level Range</th><th>Action</th></tr></thead><tbody><tr><td><strong>Low Risk</strong></td><td>≥ 1.5</td><td>Position is healthy. Monitor market only.</td></tr><tr><td><strong>Medium Risk</strong></td><td>1.15 ≤ x &#x3C; 1.5</td><td>Consider adding collateral or repaying.</td></tr><tr><td><strong>High Risk</strong></td><td>1.10 ≤ x &#x3C; 1.15</td><td>Immediate action strongly recommended.</td></tr><tr><td><strong>Liquidation</strong></td><td>&#x3C; 1.10</td><td>Position will be liquidated automatically.</td></tr></tbody></table>

{% hint style="warning" %}
⚠️ **Liquidation Risk**

When margin level drops below 1.10, your position is subject to forced liquidation to repay borrowed tokens.
{% endhint %}

***

### What is Total Debt?

Your **total debt** includes:

* **Borrowed tokens** used to open a position
* **Funding cost**, which accrues hourly:

`Funding cost = balance × funding rate × time`

The longer your position is open, the more cost you accumulate — increasing liquidation risk.

***

### How to Avoid Liquidation

* **Add collateral** to increase your margin level
* **Repay borrowed tokens** to reduce debt
* **Monitor market volatility** and take early action when in the medium or high risk zones

***

{% hint style="success" %}
💡 You can view your current margin level in the Portal dashboard at any time. Staying above 1.5 is recommended for lower risk.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs-defi.loopring.io/products/portal/margin-and-liquidation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
