> ## Documentation Index
> Fetch the complete documentation index at: https://docs.into.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Leverage & Margin Trading

> Margin calculations and liquidation mechanics

Leverage multiplies exposure through margin trading on the [CLOB](/architecture/clob). You post collateral to control a position larger than your margin would normally allow.

## How It Works

|                      | **Value**    |
| -------------------: | ------------ |
|           **Margin** | \$100        |
|         **Leverage** | 5×           |
|    **Position Size** | \$500        |
| **Shares at \$0.15** | 3,333 shares |

If price = \$0.30: +\$500 profit (500% ROE)

If price ≈ \$0.13: Liquidation triggered

## Key Parameters

* **Initial Margin (IM):** 20% (required to open position)
* **Maintenance Margin (MM):** 10% (required to keep position open)
* **Max Leverage:** 10x

## Position Sizing

$ \text{Position Size} = \text{Margin} \times \text{Leverage}$

$\text{Shares} = \text{Position Size} / \text{Entry Price}$

**Example:**

$$
\$100 \ \text{margin} \times 5 = \$500 \ \text{position}
$$

$$
\$500 / \$0.15 = 3,333 \ \text{shares}
$$

## Liquidation Price

$$
\frac{(\text{Entry Price} \times \text{Shares}) - \text{Margin}}{\text{Shares} \times (1 - MM)}
$$

**Example:**

|                 | **Value**                                                                                                    |
| --------------: | ------------------------------------------------------------------------------------------------------------ |
| **Entry Price** | \$0.15                                                                                                       |
|      **Margin** | \$100                                                                                                        |
|      **Shares** | 3,333                                                                                                        |
|  **Liq. Price** | ≈\$0.13                                                                                                      |
| **Explanation** | If the market price ≈\$0.13, your equity equals 10% of the position value (\$44.39), and liquidation begins. |

## Partial Liquidation

Liquidation happens in stages:

<Steps>
  <Step
    title="
First trigger: liquidate 25% of position"
    titleSize="h3"
  />

  <Step
    title="
Apply 10% penalty to insurance fund"
    titleSize="h3"
  />

  <Step
    title="
Check if still underwater"
    titleSize="h3"
  />

  <Step title="If yes: liquidate another 25%" titleSize="h3" />

  <Step title="Full liquidation only if necessary" titleSize="h3" />
</Steps>

This prevents complete wipeout on brief volatility.

## Profit & Loss

$$
\text{PnL} = (\text{Exit Price} - \text{Entry Price}) \times \text{Shares}
$$

**Example:**

|            | Value                                  |
| ---------- | -------------------------------------- |
| **Exit**   | \$0.30                                 |
| **Entry**  | \$0.15                                 |
| **Shares** | 3,333                                  |
| **PnL**    | (\$0.30 - \$0.15) × 3,333 = **+\$500** |
| **ROE**    | \$500 / \$100 = **500%**               |

Leverage amplifies both gains and losses proportionally.

**Example:**

|            | Value                                 |
| ---------- | ------------------------------------- |
| **Exit**   | \$0.13                                |
| **Entry**  | \$0.15                                |
| **Shares** | 3,333                                 |
| **PnL**    | (\$0.13 - \$0.15) × 3,333 = **-\$67** |
| **ROE**    | -\$67 / \$100 = **-67%**              |
