Trading Metrics Guide

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

Definitions

Symbol
Meaning

PindexP_{\text{index}}

Index Price: The fair market value of the asset pulled from our Index Price sources.

Pentry\text{P}_{\text{entry}}

Entry Price: The index price at time of position open.

PavgP_{\text{avg}}

Average Price: The weighted average entry price of all trades that make up the (open) position, including any additional buys or sells made over time.

Pexit\text{P}_{\text{exit}}

Exit Price: The index price at time of position close (only for realized P&L).

P&L\text{P\&L}

Profit & Loss: How much in USD gained (profit) or lost (loss) compared to the entry price and position size.

QQ

Quantity: The position size in units of the asset (e.g. 0.01 BTC).

FF

Trading Fees: Total entry and exit fees in USD.

UU

Funding Payments: (positive or negative)

RR

Realized P&L: The P&L realized so far. For an open order this contains the P&L from partially closing a position.

Calculations

Profit & Loss Calculations

The realized and unrealized P&L calculations varies for long and short trades. Unrealized P&L represents the profit or loss if the position were closed at the current moment. When a position is closed, the realized P&L is calculated and added to the P&L in the Account Summary. The Unrealized P&L value in the account summary is the total of all positions' unrealized P&L.

Realized P&Llong=(PexitPentry)×QF+U\text{Realized P\&L}_{\text{long}} = (P_{\text{exit}} - P_{\text{entry}}) \times Q - F + U
Realized P&Lshort=(PentryPexit)×QF+U\text{Realized P\&L}_{\text{short}} = (P_{\text{entry}} - P_{\text{exit}}) \times Q - F + U
Unrealized P&Llong=(PindexPentry)×Q+R\text{Unrealized P\&L}_{\text{long}} = (P_{\text{index}} - P_{\text{entry}}) \times Q + R
Unrealized P&Lshort=(PentryPindex)×Q+R\text{Unrealized P\&L}_{\text{short}} = (P_{\text{entry}} - P_{\text{index}}) \times Q + R

Balance Calculations

This Available Balance is the amount you have available to place new trades. It remains static unless you open or close positions, realize profits or losses, or deposit or withdraw funds.

Available Balance=DepositstotalFeestotalMargin+P&Lrealized, total+Fundingtotal\text{Available Balance} = \text{Deposits}_{\text{total}} - \text{Fees}_{\text{total}} - \text{Margin} + \text{P\&L}_{\text{realized, total}} + \text{Funding}_{\text{total}}

The Account Balance is the current, total balance of your account including both available balance and balance in trades. This consistently changes if you have open positions, as the index price of the assets you’ve traded against fluctuates.

Account Balance=DepositstotalFeestotal+P&Lrealized, total+P&Lunrealized, total+Fundingtotal\text{Account Balance} = \text{Deposits}_{\text{total}} - \text{Fees}_{\text{total}} + \text{P\&L}_{\text{realized, total}} + \text{P\&L}_{\text{unrealized, total}} + \text{Funding}_{\text{total}}

Due to the complexity of funding, it's calculations have a dedicated article which can be found here.

Margin Calculations

Margin is calculated as the combined value of all open positions and active open orders, divided by the selected leverage (1x to 5x). This amount, which is held as collateral from your available balance, ensures you have enough funds to support both existing and potential future trades.

Margin=Total Positions+Total OrdersLeverage\text{Margin} = \frac{\text{Total Positions} + \text{Total Orders}}{\text{Leverage}}

Maintenance Margin is the minimum amount of collateral required to keep your open positions active and avoid liquidation, calculated as a percentage (the safety margin, see below) of the total balance of all open positions.

Maintenance Margin=Total Positions×Safety Margin\text{Maintenance Margin} = \text{Total Positions} \times \text{Safety Margin}

The Margin Rate is the proportion of the total balance of all open positions that must be held from your available balance as collateral when opening a position. It’s the reciprocal of account leverage.

Margin Rate=1Account Leverage\text{Margin Rate} = \frac{1}{\text{Account Leverage}}

The Safety Margin is the percentage of your total position value you must keep as margin to avoid liquidation. It's a standard 3% buffer which is added to account for market volatility and slippage.

Safety Margin=Transaction Fee+Liquidation Fee+Slippage Buffer=0.1%+1%+1.9%=3%\begin{align*} \text{Safety Margin} &= \text{Transaction Fee} + \text{Liquidation Fee} + \text{Slippage Buffer} \\ &= 0.1\% + 1\% + 1.9\% \\ &= 3\% \end{align*}

Leverage & Liquidation Calculations

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.

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

Account Leverage reflects the total size of your open positions relative to your available margin, 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.

Account Leverage=max(Total PositionsTotal Account Balance,1)\text{Account Leverage}=\max\left( \frac{\text{Total Positions}}{\text{Total Account Balance}}, 1 \right)

The Liquidation Price is the index price at which a position will be liquidated. It is the maximum absolute index price permitted to maintain a non-negative account balance, and is calculated slightly differently for Long and Short positions as shown below.

Liquidation Pricelong=Pavg×(1(1Account Leverage)+Safety Margin)\text{Liquidation Price}_{\text{long}} = P_{\text{avg}} \times \left( 1 - \left( \frac{1}{\text{Account Leverage}} \right) + \text{Safety Margin} \right)
Liquidation Priceshort=Pavg×(1+(1Account Leverage)Safety Margin)\text{Liquidation Price}_{\text{short}} = P_{\text{avg}} \times \left( 1 + \left( \frac{1}{\text{Account Leverage}} \right) - \text{Safety Margin} \right)

Visit this article for a more in-depth explanation of leverage and liquidation.

Last updated

Was this helpful?