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

# Margin

> How cross-margin and leverage work on Decibel

Decibel uses cross-margin by default, meaning all your collateral backs all your positions. This page explains how margin, equity, and leverage work together.

## Key Concepts

### Account Equity

Your account equity is your total value:

```
Account Equity = Total Collateral + Unrealized PnL
```

Unrealized PnL includes both mark-to-market gains/losses and accrued funding. This is the number that determines if you can open new positions or face liquidation.

### Initial Margin (IM)

Initial margin is the collateral required to open a position. It's based on the leverage you select:

```
IM Fraction = 1 / User-Selected Leverage
```

For example, if you select 10x leverage, your IM Fraction is 10%. To open a $10,000 position, you need $1,000 in initial margin.

### Maintenance Margin (MM)

Maintenance margin is the minimum collateral to keep a position open:

```
MM Fraction = 1 / (Max Market Leverage × 2)
```

If the market's max leverage is 40x, the MM Fraction is 1.25%. Your position gets liquidated if your equity falls below your total MM requirement.

## Cross-Margin Behavior

With cross-margin, all your collateral is shared across all positions:

* Profits from one position cover losses in another
* Liquidation only happens when total equity falls below total MM requirement
* Capital is more efficient since you don't isolate margin per-position

### Example

You have \$10,000 USDC deposited and two positions:

* Long BTC-PERP: $50,000 notional, currently +$2,000 PnL
* Long ETH-PERP: $30,000 notional, currently -$1,500 PnL

Your account equity is $10,000 + $2,000 - $1,500 = $10,500. The ETH loss doesn't trigger liquidation because the BTC profit offsets it.

## Isolated Margin

Isolated margin allocates collateral to individual positions, limiting your risk to that specific position. If an isolated position gets liquidated, your other positions and remaining collateral are unaffected.

<Info>
  Isolated margin mode is currently under discussion. Check back for updates on
  availability.
</Info>

## Tradeable and Withdrawable Balance

Decibel distinguishes between what you can trade with and what you can withdraw. A PnL haircut (set per market) prevents over-withdrawal on volatile unrealized gains.

### Tradeable Balance

Your tradeable balance determines how much you can use to open new positions:

```
Tradeable Balance = Account Equity - max(IM Requirement, PnL Haircut Requirement)
```

The `max()` picks whichever is larger: your initial margin requirement or the PnL haircut. More volatile markets have higher haircut requirements, so large unrealized gains on volatile positions reduce your tradeable balance more than stable ones.

### Withdrawable Balance

Your withdrawable balance is more conservative. It's based on collateral value only, excluding unrealized gains:

```
Withdrawable Balance = Account Collateral Value - IM Requirement - Unrealized Loss
```

This means unrealized profits don't increase your withdrawable amount. You can only withdraw collateral that isn't backing open positions or covering unrealized losses.

## Leverage Selection

When opening a position, you select your leverage by choosing how much initial margin to allocate. Higher leverage means:

* Smaller initial margin requirement
* Larger position relative to collateral
* Closer to liquidation price
* Greater profit/loss per price move

| Leverage | IM Fraction | Position Size per \$1,000 |
| -------- | ----------- | ------------------------- |
| 5x       | 20%         | \$5,000                   |
| 10x      | 10%         | \$10,000                  |
| 20x      | 5%          | \$20,000                  |
| 40x      | 2.5%        | \$40,000                  |

## Key Formulas

```
Account Equity = Total Collateral + Unrealized PnL

Unrealized PnL = Mark-to-Market PnL + Unrealized Funding Cost

Mark-to-Market PnL = (Current Mark Price - Entry Mark Price) × Position Size

IM Requirement = Σ(Position Notional × IM Fraction)

MM Requirement = Σ(Position Notional × MM Fraction)

Tradeable Balance = Account Equity - max(IM Requirement, PnL Haircut Requirement)

Withdrawable Balance = Account Collateral Value - IM Requirement - Unrealized Loss
```

## Related

<CardGroup cols={2}>
  <Card title="Liquidations" href="/for-traders/liquidations">
    What happens when equity falls below maintenance margin
  </Card>

  <Card title="Funding Rates" href="/for-traders/funding-rates">
    How funding affects your unrealized PnL
  </Card>
</CardGroup>
