# Margin, leverage, and liquidations

#### Collateral

When you deposit USDC into MoveX, it moves into the Hub contract. The Hub tracks two buckets per user:

* **`available`** — free collateral you can use for new orders or withdraw.
* **`locked`** — collateral committed to open positions (across all markets).

When you place an order with leverage, the system locks `notional / leverage` from your available balance. As your position is filled and confirmed on-chain, that locked collateral moves from the Hub into the Market contract that holds the position.

#### Leverage

MoveX currently supports **1×, 2×, and 3× leverage**. (This may expand as risk parameters allow.)

Leverage works the way you'd expect. A $300 position at 3× requires $100 of collateral. A $300 position at 1× requires $300 of collateral. Higher leverage means a smaller move in the mark price wipes out your collateral — and triggers a liquidation.

#### Mark price

The mark price is the protocol's reference for "what is this position worth right now?" It's computed continuously from the oracle:

```
mark_price = | underlying_now − reference_price_of_epoch |
```

PnL on your position is computed against the **MID price** of the OrderBook:

```
unrealized_pnl = direction_sign × (mid_price − entry_price) × size
```

Where `direction_sign` is `+1` for longs and `−1` for shorts.

#### Liquidation

A position is **liquidatable** when its `account_value` falls below the maintenance margin threshold. Roughly:

```
account_value = collateral + unrealized_pnl
maintenance_margin = notional × maintenance_margin_ratio
position_liquidatable_if  account_value < maintenance_margin
```

The maintenance margin ratio is per-market (typically 5%). When a position crosses this threshold, the liquidation engine force-closes it.

The closing fill can match against the order book if there's available liquidity, or be absorbed by the **Insurance Fund** if the book is empty. The Insurance Fund is a per-market pool of USDC funded by a portion of trading fees; it acts as the counterparty of last resort.

If the Insurance Fund is depleted and there's still bad debt (position lost more than its collateral), MoveX may apply **socialized loss** - a small haircut spread across all profitable positions in the market. This is a tail risk that we work hard to avoid through conservative leverage limits.


---

# 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.movex.market/architecture/margin-leverage-and-liquidations.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.
