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

# Margin

Notional currently supports cross margin and portfolio margin, evaluating a user's eligible collateral and unrealized PnL together instead of isolating margin by position.

This lets one account use multiple collateral assets to support positions across supported markets. Notional computes borrow capacity from that collateral, then applies position, debt, and open-interest constraints on top.

## Initial and Maintenance Margin

For each perp position:

$$
\text{IMR} = \sum_j \frac{|\text{size}_j| \cdot \text{mark price}_j}{\text{selected leverage}_j}
$$

$$
\text{MMR} = \sum_j \frac{|\text{size}_j| \cdot \text{mark price}_j}{2 \cdot \text{max leverage}_j}
$$

Initial margin is used when opening or increasing positions. Maintenance margin is used for liquidation health.

## Total and Available Margin

Total margin is calculated as:

$$
\text{total margin} =
\sum_i \text{asset}_i \cdot \text{price}_i \cdot \text{max LTV}_i + \text{unrealized PnL}
$$

Available margin is the remaining initial-margin capacity after all open positions and position-increasing open orders:

$$
\text{available margin} = \max(0,\ \text{total margin} - \text{total IMR})
$$

where:

$$
\text{total IMR} = \sum_j \text{position IMR}_j + \sum_k \text{order IMR}_k
$$

## Cross-Margin Ratio

Health is measured as:

$$
\text{cross margin ratio} = \frac{\text{MMR}}{\text{total margin}}
$$

Lower is healthier. A ratio near 1.0 means the account is close to its maintenance margin limit. A cross-margin account can be liquidated when total margin falls below maintenance margin, even if some individual positions are profitable.

## Borrow Capacity

Remaining borrow capacity is the maximum borrowed USDC an account can support against its eligible collateral after existing USDC borrow debt.

$$
\begin{aligned}
\text{remaining borrow capacity}
&= \max\left(0,\ \sum_i \text{asset borrow capacity}_i - \text{existing USDC borrow debt}\right) \\
\text{asset borrow capacity}_i
&= \min(\text{balance}_i \cdot \text{spot mark price}_i \cdot \text{max LTV}_i,\ \text{borrow cap}_i)
\end{aligned}
$$

For each eligible collateral asset $i$:

* Max LTV is the percentage of that asset's spot-mark value that counts toward borrow capacity. Current LTVs are listed on the [Protocol Caps](/protocol/protocol-caps) page.
* Borrow cap is the maximum USDC borrow capacity allowed from that asset. Current caps are listed on the [Protocol Caps](/protocol/protocol-caps) page.

Borrowed USDC is the account's initial-margin shortfall after available USDC is applied. Available USDC is a positive USDC balance that is not already offset by existing USDC borrow debt. Borrowed USDC includes initial margin for open perp positions and position-increasing open orders, and excludes unrealized PnL:

$$
\text{borrowed USDC} =
\max(0,\ \text{total IMR} - \text{available USDC})
$$

A new trade, order, or withdrawal is allowed only if the projected borrowed USDC remains less than or equal to the remaining borrow capacity.
