# Trading Metrics Guide

This article explains common metrics on the Rails platform, including their precise calculations.

<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Definitions</strong></td><td><a href="/pages/sWbZHQU8UthIBBab35kM#definitions">/pages/sWbZHQU8UthIBBab35kM#definitions</a></td></tr><tr><td align="center"><strong>P&#x26;L Calculations</strong></td><td><a href="/pages/sWbZHQU8UthIBBab35kM#profit-and-loss-calculations">/pages/sWbZHQU8UthIBBab35kM#profit-and-loss-calculations</a></td></tr><tr><td align="center"><strong>Equity &#x26; Balance Calculations</strong></td><td><a href="/pages/sWbZHQU8UthIBBab35kM#equity-and-balance-calculations">/pages/sWbZHQU8UthIBBab35kM#equity-and-balance-calculations</a></td></tr><tr><td align="center"><strong>Value Calculations</strong></td><td><a href="/pages/sWbZHQU8UthIBBab35kM#value-calculations">/pages/sWbZHQU8UthIBBab35kM#value-calculations</a></td></tr><tr><td align="center"><strong>Margin Calcualtions</strong></td><td><a href="/pages/sWbZHQU8UthIBBab35kM#margin-calculations">/pages/sWbZHQU8UthIBBab35kM#margin-calculations</a></td></tr><tr><td align="center"><strong>Leverage &#x26; Liquidation Calculations</strong></td><td><a href="/pages/sWbZHQU8UthIBBab35kM#leverage-and-liquidation-calculations">/pages/sWbZHQU8UthIBBab35kM#leverage-and-liquidation-calculations</a></td></tr></tbody></table>

## Definitions

<table><thead><tr><th width="100.6488037109375">Symbol</th><th>Meaning</th></tr></thead><tbody><tr><td><span class="math">P_{index}</span></td><td><strong>Index Price:</strong> The fair market value of the asset pulled from our <a href="/pages/QLMYpTm831YuVLgLZnGI">Index Price sources</a>. </td></tr><tr><td><span class="math">P_{entry}</span></td><td><strong>Entry Price:</strong> The price at which your order was filled to open a position. This is based on actual execution price and may differ from the index and order book price at the moment you placed the order due to factors like slippage or partial fills.</td></tr><tr><td><span class="math">P_{avg}</span></td><td><p><strong>Average Entry Price:</strong> The weighted average fill price for the position, calculated as:</p><ul><li><span class="math">P_{avg} = \frac{Position Value}{Position Qty}</span></li></ul></td></tr><tr><td><span class="math">P_{exit}</span></td><td><strong>Exit Price:</strong> The price at which your order was filled to close a position. This reflects the actual execution price and may differ from the index and order book price you saw when closing your position due to factors like slippage or partial fills.</td></tr><tr><td><span class="math">P\&#x26;L</span></td><td><p><strong>Profit &#x26; Loss:</strong> How much in USDT gained (profit) or lost (loss) compared to the entry price and position size, where:</p><ul><li><span class="math">P\&#x26;L_{u}</span> = Unrealized P&#x26;L</li><li><span class="math">P\&#x26;L_{r}</span> = Realized P&#x26;L</li></ul></td></tr><tr><td><span class="math">S</span></td><td><p><strong>Position Side</strong>: The side of your position, where:</p><ul><li><span class="math">S_{long}=1</span> </li><li><span class="math">S_{short}=-1</span></li></ul></td></tr><tr><td><span class="math">Q</span></td><td><strong>Position Quantity:</strong> The position size in units of the asset (e.g. 0.01 BTC).</td></tr><tr><td><span class="math">F</span></td><td><strong>Trading Fees:</strong> Total entry and exit fees in USDT. </td></tr><tr><td><span class="math">U</span></td><td><strong>Funding Payments:</strong> Positive or negative. Learn more <a href="/pages/Pax0Kc9HJbgr25Tj3p2b">here</a>.</td></tr><tr><td><span class="math">D</span></td><td><strong>Deposits</strong>: Amount of USDT deposited to your account</td></tr><tr><td><span class="math">W</span></td><td><strong>Withdrawals</strong>: Total USDT withdrawal volume</td></tr><tr><td><span class="math">L</span></td><td><strong>Leverage:</strong> The per-market leverage used, between 1x - 5x.</td></tr></tbody></table>

## Calculations

### Profit & Loss Calculations

**Unrealized P\&L** reflects the profit or loss if a position were closed at current market prices, with values changing in real-time. The account summary displays the total unrealized P\&L for all positions.

$$
P\&L\_{u} = (P\_{index} - P\_{avg}) \times S \times Q
$$

{% hint style="warning" %}
Note: Unrealized P\&L is calculated using the [index price](/trading/index-price-sources.md), not the order book price.
{% endhint %}

**Realized P\&L** reflects the profit or loss realized through closed positions. Once a position is closed, the realized P\&L is computed and added to the Account Summary.

$$
P\&L\_{r} = (P\_{exit} - P\_{entry}) \times S \times Q - F + U
$$

### Equity & Balance Calculations

**Account Equity** is the current, total balance of your account. This consistently changes if you have open positions, as the index price of the assets you’ve traded against fluctuates impacting your unrealized P\&L.

$$
\text{Account Equity} = \text{Total Balance} +P\&L\_{u,total}
$$

where $$\text{Total Balance} = D\_{total} - W\_{total} + P\&L\_{r,total} -F\_{total} +U\_{total}$$

**Available Balance** is the amount you have available to place new trades, and fluctuates as the market moves. Margin calculations can be found [here](#margin-calculations).

$$
\text{Available Balance} = \text{Account Equity} - \text{Position Margin} -\text{Open Order Margin}
$$

**Withdrawable Balance** represents the portion of your account balance that can be withdrawn. Note that the margin locked for open positions and orders, as well as unrealized losses from open positions, reduces what you can withdraw. To increase your withdrawable balance, you should partially or fully close an open position with positive unrealized P\&L to realize profits.

$$
\text{Withdrawable Balance} = \text{Total Balance} + \sum (min(0,(P\_{index}-P\_{entry})\times Q \times S)) - \sum (P\_{entry} \times \frac{Q}{L}) - \text{Open Order Margin}
$$

where $$\text{Total Balance} = D\_{total} - W\_{total} + P\&L\_{r,total} -F\_{total} +U\_{total}$$

### Value Calculations

**Notional Value** is the the current market value of your position based on the index price:

$$
\text{Notional Value} = P\_{index} \times Q
$$

**Position Value** is the the total notional value or exposure of your trade, determined by the entry price used when you opened the position:

$$
\text{Position Value} = P\_{entry} \times Q
$$

### Margin Calculations

**Maintenance Margin Ratio (or MMR)** is the percentage of your total position value you must keep as margin to avoid [liquidation](https://help.rails.xyz/rails/trading/leverage-and-liquidation). It's a fixed 5% buffer which is added to all positions for market volatility and [slippage](https://help.rails.xyz/rails/trading/leverage-and-liquidation#what-is-slippage-and-why-does-it-happen).

<p align="center"> <span class="math">MMR = 0.05</span></p>

**Maintenance Margin** is the minimum amount of collateral required to keep a position open. If your available funds fall below this requirement, your position will be liquidated.

$$
\text{Maintenance Margin} = P\_{index} \times |Q| \times MMR
$$

Additionally, the Total Maintenance Margin is the sum of maintenance margins across all open positions.

**Available Margin** is the total of funds currently available to support your open positions after accounting for required margin. It represents the buffer your position still has before liquidation risk increases.

$$
\text{Margin Available  = Account Equity - }\sum(\text{Maintenance Margin})
$$

**Position Margin** is the margin calculated per open position based on the current index price, and influenced by your selected leverage (1x - 5x).

$$
\text{Position Margin} = P\_{index} \times  \frac{Q}{{L}}
$$

**Open Order Margin** is calculated in the same way for each open order, as these also will impact your available collateral.&#x20;

$$
\text{Open Order Margin} = P\_{index} \times  \frac{Q}{{L}}
$$

The **Cross-Margin Ratio** measures overall account health — what percentage of account equity is consumed by minimum margin requirements across all open positions.

$$
\text{Cross-Margin Ratio} = \frac{\text{Total Maintenance Margin}}{\text{Account Equity}}
$$

<table><thead><tr><th width="183.03515625">Cross-Margin Ratio</th><th>Status</th></tr></thead><tbody><tr><td>&#x3C; 100%</td><td>Healthy</td></tr><tr><td>≥ 100%</td><td>Liquidation triggered - all positions closed</td></tr></tbody></table>

### Leverage & Liquidation Calculations

{% hint style="info" %}
Visit [this article](/trading/perpetuals/leverage-and-risk-management.md) for a more in-depth explanation of leverage and liquidation.
{% endhint %}

**Effective Leverage** is the actual leverage applied to an open position. It may differ from the leverage you initially selected due to changes in your available balance caused by index price movements, fees, or margin adjustments between order placement and trade execution.

$$
\text{Effective Leverage} = \frac{\text{Total Position Value}}{\text{Total Available Balance}}
$$

**Cross Leverage** reflects the total size of your open positions relative to your margin available, showing how much risk you are taking across all trades combined. It aggregates the effective leverage from all open positions into a single number, showing your total risk exposure.&#x20;

$$
\text{Cross Leverage} = \frac{\text{Total Positions}}{\text{Account Balance}}
$$

**Liquidation Price** is the index price at which liquidation will occur.&#x20;

$$
\text{Liquidation Price} = P\_{index} - \frac{{S} \times \text{Available Margin}}{\left|\text{Q}\right| \times \left(1 - \text{MMR} \times S\right)}
$$

<details>

<summary>Index Price vs Order Book Price</summary>

Understanding the difference between the index price and the order book price is crucial for traders. Each is employed in different trading calculations, and this distinction is a common source of confusion, particularly when [slippage](/trading/perpetuals/leverage-and-risk-management.md#what-is-slippage-and-why-does-it-happen) happens. By comprehending these differences, traders can better estimate their trading performance.

**Index Price**

The [Index Price](/trading/index-price-sources.md) is a benchmark price calculated from a basket of major exchanges. Instead of reflecting just Rails’ order book, it represents a fair, averaged market value of the asset across multiple venues.

**Order Book Price**

The Order Book Price is the real-time price at which trades are executed on our platform. It is calculated using the current best bid (buy orders) and best ask (sell orders) from the order book.

* When you place a market order, it is filled against the best available prices in the order book.
* This ensures instant execution, but depending on liquidity and your order size, the final fill price may be higher or lower than the last traded price you saw as a result of [slippage](/trading/perpetuals/leverage-and-risk-management.md#what-is-slippage-and-why-does-it-happen).

The following table details when and why one price is used over the other:

<table><thead><tr><th width="171.33563232421875">Event</th><th>Price Used</th></tr></thead><tbody><tr><td>Liquidation </td><td>Liquidation occurs when the your liquidation price crosses the <strong>index price</strong>. This prevents traders from being unfairly liquidated due to thin liquidity or a price spike in the order book.</td></tr><tr><td>Funding Payment Calculation </td><td><strong>Both</strong>: the funding mechanism aims to balance deviations between the order book price and the index price, so both are considered.</td></tr><tr><td>Trigger Orders</td><td>Stop loss orders and take profit orders are triggered using the <strong>index price</strong>. This avoids premature order execution due to thin liquidity or a price spike in the order book.</td></tr><tr><td>Order Execution</td><td>Once the trigger condition is met, the order itself is executed against the <strong>order book price</strong> (just like any other market or limit order).</td></tr><tr><td>Unrealized P&#x26;L</td><td>Unrealized P&#x26;L is calculated using the <strong>index price</strong>, not the order book price, to provide a fair and stable view of your postion's value.</td></tr></tbody></table>

</details>

<details>

<summary>Why does the average price change?</summary>

**Average Price:** The Average Price shown in your account is the *adjusted weighted average entry price* of all trades that make up your currently open position.

**How it works**

* When adding to a position, each new buy or sell that increases your position size is included in the weighted average. This ensures your entry price reflects the combined cost of all open trades.
* When partially closing a position:
  1. The system books any realized profit or loss (PnL) on the portion you closed.
  2. It also deducts applicable trading fees (and, if relevant, funding charges).
  3. The average entry price of the remaining open position is then recalculated so that the unrealized PnL you see stays consistent with your actual exposure.

**Why your Average Price may change**

Because realized PnL and fees are factored into the recalculation, your displayed average price may shift slightly after a partial close — even if your execution prices haven’t changed. This adjustment is accounting-based: it does not mean you actually bought higher or lower, but rather that the platform is aligning your remaining position’s entry with the PnL already realized.

</details>


---

# 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://help.rails.xyz/general/navigating-the-platform/trading-metrics-guide.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.
