# Ladder Balancing Mechanism

### **What is Forced Balancing?**

The **margin rate** reflects the risk level of a user’s position. It is calculated as:

$$
\text{Margin Rate} = \frac{\text{Equity}}{\text{Position Value}}
$$

When the margin rate approaches the **minimum maintenance margin rate**, the system may intervene to **protect users and market stability** by triggering a **forced balancing**.

> ⚠️ All margin rate calculations are based on the **marked price** to avoid forced liquidation caused by illiquidity or price manipulation.

### **Ladder-Based Position Reduction**

To prevent the **market impact** and **losses** associated with fully liquidating large positions, the system employs a **laddered reduction mechanism**.

* Each **ladder tier** corresponds to a higher **maintenance margin rate**.
* If the margin rate is **insufficient** for the user’s current tier, the system will **partially reduce** the position to bring it to the next lower tier.

### **Forced Balancing Process**

Once the margin rate drops below the required threshold, the system initiates the following steps to avoid full liquidation:

1. **Cancel all open orders** for the contract.
2. **Match internal long and short positions** to reduce risk.
3. If the **margin rate is still insufficient**, the system performs **forced position reduction**:
   * The position is reduced to match the **maximum allowed size** of the next lower gear.
   * The goal is to restore a **margin rate > 0%**.

$$
\text{Positions to reduce} = P\_{\text{current}} - P\_{\text{next gear max}}
$$

4. If the user is in **the lowest gear** and the margin rate remains insufficient, the **entire position is forcibly closed**.

### **Restrictions During Forced Balancing**

During the forced reduction process:

* The user **cannot place or modify orders** related to the contract.
* In **restricted position mode**, the system will:
  * **Place a limit order** to reduce the number of contracts required.
  * Use a **price slightly better** than the current market price.
  * **Freeze the affected position direction** during the process.

### **Example (BTC Contract)**

Assume:

* User is in **Gear 3** or above: P<sub>current</sub> = 15,000
* Gear 1 max allowed position: P<sub>gear 1 max</sub> = 2,000
* Required reduction:

$$
15,000 - 2,000 = 13,000 \text{ contracts}
$$

If the system determines the user's margin rate is **less than**:

$$
\text{Maintenance Margin Rate}\_{\text{Gear 3}} + \text{Closing Fee Rate}
$$

It **will not** immediately liquidate the entire position. Instead, it initiates a **partial forced reduction** by reducing the position by two gears.

If the user is in **restricted mode**, these 13,000 contracts will be placed as limit orders at a slightly favorable price, and the position remains **frozen** until the reduction is complete.


---

# 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.coinlocally.com/perpetual-contracts/overview/ladder-balancing-mechanism.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.
