> For the complete documentation index, see [llms.txt](https://docs.fluvion.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fluvion.io/perpetual-futures-mechanics/margin-leverage-and-pnl.md).

# Margin, Leverage & PnL

This page details the mathematical formulas used by the Fluvion risk engine to evaluate position sizes, margin health, collateral requirements, and profit/loss calculations.

***

## 1. Notional Position Value

The notional value represents the total dollar value of an open position in USDC terms:

```
Notional Value = Position Quantity × Mark Price
```

**Example**: If you hold a long position of **50 SOL** and the Mark Price is **$150.00 USDC**, your notional position size is:

```
Notional = 50 × 150.00 = $7,500.00 USDC
```

***

## 2. Account Margin Ratio (AMR)

Your **Account Margin Ratio** is the primary metric defining account safety. It compares your total collateral against the aggregate notional size of all open positions:

```
Account Margin Ratio = Total Collateral Value / Total Notional Position Value
```

* **No Open Positions**: Defaults to a safe maximum of **1000%**.
* **Healthy Range**: Above the Initial Margin Ratio requirement.
* **Liquidation Trigger**: If **AMR ≤ MMR**, the account is flagged for liquidation.

***

## 3. Initial Margin Ratio (IMR)

The **Initial Margin Ratio** is the minimum margin ratio required to open a new position or withdraw funds.

Each market defines a **Base IMR**, which determines maximum entry leverage:

```
Max Leverage = 1 / Base IMR
```

*(e.g., a Base IMR of 1% permits up to 100x leverage; 2% permits up to 50x leverage).*

### Non-Linear Margin Scaling (IMR Factor)

To protect market integrity and mitigate liquidation impact from large positions, margin requirements increase non-linearly as position size grows:

```
IMR_i = max(1 / Max Leverage, Base IMR_i, IMR Factor_i × |Position Notional_i|^0.8)
Initial Margin_i = |Position Notional_i| × IMR_i
```

The overall required Initial Margin Ratio for the account is the volume-weighted sum:

```
Account IMR = Sum( (|Position Notional_i| / Total Notional) × IMR_i )
```

***

## 4. Maintenance Margin Ratio (MMR)

The **Maintenance Margin Ratio** is the absolute lower boundary of margin health. If your Account Margin Ratio drops below the MMR, liquidation is triggered immediately:

```
MMR_i = max(Base MMR_i, (Base MMR_i / Base IMR_i) × IMR Factor_i × |Position Notional_i|^0.8)
Maintenance Margin_i = |Position Notional_i| × MMR_i
```

The overall required Maintenance Margin Ratio for the account is:

```
Account MMR = Sum( (|Position Notional_i| / Total Notional) × MMR_i )
```

> \[!NOTE] Because MMR is strictly lower than IMR (e.g. 0.6% vs 1.0% for SOL), a safety buffer exists. You will first be restricted from opening new positions (when AMR drops below IMR) well before facing liquidation (when AMR drops below MMR).

***

## 5. Typical Market Margin Parameters

| Perp Market   | Base IMR (Max Lev) | Base MMR |  IMR Factor  |
| ------------- | :----------------: | :------: | :----------: |
| **SOL-PERP**  |     1.0% (100x)    |   0.6%   | 0.0000010667 |
| **BTC-PERP**  |     1.0% (100x)    |   0.6%   | 0.0000000910 |
| **ETH-PERP**  |     1.0% (100x)    |   0.6%   | 0.0000001724 |
| **BONK-PERP** |     5.0% (20x)     |   2.5%   | 0.0000071400 |
| **SUI-PERP**  |     5.0% (20x)     |   2.5%   | 0.0000028100 |

> \[!TIP] For the complete table of margin parameters, leverage tiers, and IMR Factors across all **80+ supported crypto and RWA markets**, refer to the [Supported Markets & Specifications](/platform-and-economics/supported-markets.md) catalog.

***

## 6. Profit and Loss (PnL) Calculations

### Unrealized PnL (uPnL)

Unrealized PnL is computed dynamically against the real-time **Mark Price**:

* **For Long Positions**:

  ```
  uPnL = Position Quantity × (Mark Price - Entry Price)
  ```
* **For Short Positions**:

  ```
  uPnL = Position Quantity × (Entry Price - Mark Price)
  ```

### Return on Equity (ROI %)

```
ROI % = (uPnL / Position Initial Margin) × 100
```

### Realized PnL (rPnL)

When a position is closed or partially reduced, the profit or loss is realized into settled USDC:

```
Realized PnL = Closed Quantity × (Exit Price - Entry Price) × Side Multiplier - Trading Fees ± Funding Payments
```

*(where Side Multiplier = +1 for Long, and -1 for Short).*

***

## 7. Account Balances Overview

```
Total Equity = USDC Balance + Sum(uPnL)
Free Collateral = Total Equity - Sum(Initial Margin of Positions + Open Orders)
Withdrawable Balance = Total Balance - Sum(Initial Margin) - max(0, uPnL)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.fluvion.io/perpetual-futures-mechanics/margin-leverage-and-pnl.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
