Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Perps Metrics Guide

This guide explains the main metrics on Rails and how they are calculated.

Definitions

Symbol
Meaning

PP

Price: The price in USDT, where:

  • Pindex=Index PriceP_{index} = \text{Index Price} = the external spot price from our Index Price sources.

  • Pmark=Mark PriceP_{mark} = \text{Mark Price} = the risk reference for perpetuals. It determines unrealized P&L, margin requirements, and liquidations.

  • Pimpact=Impact PriceP_{impact} = \text{Impact Price} = The impact price for a bid/ask is the average execution price for a fixed impact notional, not the top-of-book quote.

  • Prails medianP_{rails\ median} = the median of Rails’ best bid, best ask, and last trade.

  • Padjusted indexP_{adjusted\ index} = The index price plus the exponential moving average (EMA) of the adjustment.

  • Pentry=Entry PriceP_{entry} = \text{Entry Price}

  • Pavg=Average Entry PriceP_{avg} = \text{Average Entry Price}

  • Pexit=Exit PriceP_{exit} = \text{Exit Price}

P&LP\&L

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

  • P&LuP\&L_{u} = Unrealized P&L

  • P&LrP\&L_{r} = Realized P&L

  • P&Lu,crossP\&L_{u,cross} = Unrealized P&L on cross-margin positions

SS

Position Side: The side of your position, where:

  • Slong=1S_{long}=1

  • Sshort=−1S_{short}=-1

QQ

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

  • QQ = The quantity of any position

  • QclosedQ_{closed} = The closed quantity of any position

FeesFees

Trading Fees: Total entry and exit fees in USDT.

FF

Funding Payments: Can be positive or negative, and are transferred between traders. Funding uses the index price. Funding payments are not fees charged by Rails. Learn about the funding mechanism in perpetuals here.

DD

Deposits: Amount of USDT deposited to your account

WW

Withdrawals: Total USDT withdrawal volume

LL

Leverage: The per-market leverage used, between 1x - 5x; therefore Lmax=5L_{max} = 5

VV

Notional Position Value

MM

Margin: the portion of your funds set aside to support a trade. It acts as collateral for open positions and open orders, where:

  • Mp,cross=Cross Position MarginM_{p,cross} = \text{Cross Position Margin} = margin locked by your open cross margin positions

  • Mp,iso=Isolated Position MarginM_{p,iso} = \text{Isolated Position Margin} = margin already allocated to all isolated positions

  • Mtotal,openorders=Total Open Order MarginM_{total,open orders} = \text{Total Open Order Margin} = margin reserved for all open, unfilled orders

  • Mreq=Margin RequiredM_{req} = \text{Margin Required} = Margin Required to keep your positions open

  • Mexcess=Excess MarginM_{excess} = \text{Excess Margin} = Margin above what's required to keep an isolated position open.

Calculations

Price & Value

Index Price

The Index Price ( PindexP_{index} ) is the external spot-price anchor, from our Index Price Sources.

Rails uses the Index Price to calculate funding, and to keep the mark price aligned with the broader market.

Mark Price

The Mark Price is the reference price for a perpetual market. It determines unrealized P&L, margin requirements, liquidation prices, and liquidation triggers.

The mark price uses the median of three values:

Pmark=median⁡(Padjusted index,Prails median,Pindex)P_{mark} = \operatorname{median}(P_{adjusted\ index}, P_{rails\ median}, P_{index})

Where:

Padjusted index=Pindex+EMAP_{adjusted\ index} = P_{index}+EMA

Prails median=median(Rails best bid,Rails best ask,Rails last trade price)P_{rails\ median}=median ({Rails\ best\ bid}, {Rails\ best\ ask},{Rails\ last\ trade\ price})

This approach limits the impact of short-lived order-book moves. A sustained difference between Rails’ market and the index can influence the mark price gradually.

Market orders, take-profit and stop-loss triggers, and limit-price safety checks use the mark price as their reference.

Availability and updates

Rails publishes mark-price updates on each index-price tick, at most once every 250 milliseconds per market. Rails uses exact decimal arithmetic and rounds each published price to the 0.00000001 price increment, but displays only 6 decimals in the UI.

If a market is missing a required Rails input, the mark price falls back to the index price:

  • No Rails quotes: the mark price uses the index price.

  • Quotes but no trades: the mark price uses the index price while the adjustment EMA warms up.

  • Quotes and at least one trade: Rails uses the full mark-price formula.

Exponential Moving Average (EMA)

Rails’ market can trade slightly above or below the index price. This difference is the adjustment:

Adjustment Sample=Best Bid+Best Ask2−Pindex\text{Adjustment Sample} = \frac{\text{Best Bid} + \text{Best Ask}}{2} - P_{index}

The adjusted index uses an EMA of this adjustment. The EMA has a 2.5-minute time constant. Recent samples carry more weight, while older samples fade smoothly. This smoothing limits the effect of brief order-book changes. A one-second spike barely affects the EMA. A persistent adjustment shifts it over several minutes.

Rails updates the EMA on every tick. Let t be the seconds since the prior update:

numerator=round⁡(prevNumerator×e−t/150+adjustment sample×t, 12)\text{numerator} = \operatorname{round}(\text{prevNumerator} \times e^{-t / 150} + \text{adjustment sample} \times t,\ 12)

denominator=round⁡(prevDenominator×e−t/150+t, 12)\text{denominator} = \operatorname{round}(\text{prevDenominator} \times e^{-t / 150} + t,\ 12)

EMA=numeratordenominator\text{EMA} = \frac{\text{numerator}}{\text{denominator}}

Each sample is weighted by how long it remained in effect. Rails rounds the numerator and denominator to 12 decimal places after each update.

Entry & Exit Price

The Entry Price is the price at which your order was filled to open a position. The Exit Price is the price at which your order was filled to close your position.

Average Price

The Average Price shown in your account is the adjusted weighted average entry price of your open position, calculated as:

Pavg=Position ValueQP_{avg} = \frac{\text{Position Value}}{Q}

When you add to a position, every new trade that increases its size is added to the weighted average. This gives you one entry price that reflects the full open position.

When you partially close a position:

  1. The system realizes profit or loss on the part you closed.

  2. It subtracts any trading fees and, if applicable, funding charges.

  3. It then recalculates the average entry price for the remaining position.

This keeps your unrealized P&L aligned with the position still open.

Because realized PnL and fees are included, your displayed average price can change slightly after a partial close. This does not mean your trade executed at a different price. It means the platform adjusted the remaining position to account for PnL already realized.

Notional Value

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

Notional Value=Pmark×Q\text{Notional Value} = P_{mark} \times Q

Position Value

Position Value is the total notional value, or exposure, of your trade based on the entry price used to open the position:

Position Value=Pentry×Q\text{Position Value} = P_{entry} \times Q

Impact Price

Impact bid or ask price is the average execution price for trading a fixed impact notional against the order book.

  • Impact Ask is the average price to buy that notional from asks.

  • Impact Bid is the average price to sell it into bids.

  • Impact Mid is their midpoint.

Unlike the best bid/ask, impact prices reflect liquidity at meaningful size. They diverge from top-of-book quotes when available depth is limited. Impact Price is used in funding calculations for Perps.

Impact Notional

Impact Notional=100 USDT×Lmax\text{Impact Notional} = 100 \text{ USDT} \times L_{max}

Withdrawal Fee

Rails deducts a withdrawal fee to cover network costs when you withdraw amounts from the platform, calculated as:

Feewd=min⁡(0.001×Withdrawal Amount, 1)Fee_{wd} = \min(0.001 \times \text{Withdrawal Amount},\ 1)

The fee is 0.1% of the amount you withdraw, up to a maximum of $1 per withdrawal. The covers the network costs - like gas fees - we pay to process your withdrawal. It isn’t a Rails platform fee.

Liquidation Fee

If a position is liquidated, Rails charges a liquidation fee of 1% of the liquidated value, calculated as:

Feeliq=0.01×Liquidated ValueFee_{liq} = 0.01 \times \text{Liquidated Value}

Balance and P&L

Available Balance

Available Balance shows the funds available to open new positions. Your withdrawable balance may be lower. Margin calculations can be found here.

Available Balance=Cross Margin Equity−Cross Position Margin−Total Open Order Margin\text{Available Balance} = \text{Cross Margin Equity} - \text{Cross Position Margin} - \text{Total Open Order Margin}

Total Balance

Total Balance is the settled cash value of your account. It reflects completed events, but does not include unrealized P&L from open positions:

Total Balance=Dtotal−Wtotal+P&Lr,total−Feestotal+Ftotal\text{Total Balance} = D_{total} - W_{total} + P\&L_{r,total} -Fees_{total} +F_{total}

Withdrawable Balance

Withdrawable Balance represents the portion of your account balance that can be withdrawn. Margin for open positions and orders reduces this amount. Unrealized losses, based on mark price, also reduce it. To increase your withdrawable balance, you should partially or fully close an open position with positive unrealized P&L to realize profits.

Withdrawable Balance=Total Balance+∑min⁡(0,P&Lu)−∑(Pentry×∣Q∣L)−Open Order Margin\text{Withdrawable Balance} =\text{Total Balance} + \sum \min(0, P\&L_{u}) - \sum \left(P_{entry} \times \frac{\lvert Q \rvert}{L}\right) - \text{Open Order Margin}

Cross-Margin Balance

Cross-Margin Balance is the base balance available for your cross-margin pool. It equals your settled total balance minus collateral locked in isolated margin positions.

Cross-Margin Balance=Total Balance−Isolated Position Margin\text{Cross-Margin Balance} = \text{Total Balance} - \text{Isolated Position Margin}

Unrealized P&L

Unrealized P&L reflects the profit or loss if a position were closed at the current mark price. The account summary displays the total unrealized P&L for all positions.

P&Lu=(Pmark−Pavg)×S×QP\&L_{u} = (P_{mark} - P_{avg}) \times S \times Q

Realized P&L

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&Lr=(Pexit−Pavg)×S×QclosedP\&L_{r} = (P_{exit} - P_{avg}) \times S \times Q_{closed}

Equity & Margin

Learn about how these fields impact your account in the risk management overview.

Account Equity

Account Equity is the current live balance of your account. It changes as mark-price movements affect unrealized P&L.

Account Equity=Total Balance+P&Lu,total\text{Account Equity} = \text{Total Balance} +P\&L_{u,total}

Cross-Margin Equity

Cross-Margin Equity is the total value of your shared collateral pool. It changes with the unrealized P&L of your open cross-margin positions.

Cross-Margin Equity=Cross-Margin Balance+P&Lu,cross\text{Cross-Margin Equity} = \text{Cross-Margin Balance} + P\&L_{u,cross}

Unrealized P&L is aggregated across all open cross-margin positions. As the market moves, your cross-margin equity updates continuously.

Isolated Position Equity

In Isolated Margin Mode, each position has its own dedicated margin pool and is excluded from the cross-margin pool. Isolated Position Equity is calculated as:

Isolated Position Equity=Isolated Position Margin +P&Lu,position\text{Isolated Position Equity}=\text{Isolated Position Margin }+P\&L_{u,position}

Maintenance Margin Rate (or MMR)

Maintenance Margin Rate (or MMR) is a fixed 5% buffer added to all positions for market volatility and slippage.

MMR=0.05\text{MMR} = 0.05

Maintenance Margin

Each open position requires a minimum amount of equity to remain open, referred to as Maintenance Margin. The maintenance margin uses the current mark price:

Maintenance Marginposition=Pmark×∣Q∣×MMR\text{Maintenance Margin}_\text{position} = P_{mark} \times \lvert Q \rvert \times \text{MMR}

Total Cross Maintenance Margin

In cross-margin, the Total Cross Maintenance Margin is the sum of maintenance margins across all open cross-margin positions.

Total Cross Maintenance Margin=∑Maintenance Marginposition, cross\text{Total Cross Maintenance Margin} = \sum \text{Maintenance Margin}_{\text{position, cross}}

Available Margin

Available Margin is the amount of funds available to support your open positions after required margin is accounted for. It shows the remaining buffer before liquidation risk increases, and depends on your margin mode:

In cross-margin mode, the following is calculated across all cross-margin positions:

Available Margin=Cross Margin Equity − Total Cross Maintenance Margin\text{Available Margin} = \text{Cross Margin Equity − Total Cross Maintenance Margin}

In isolated margin mode, the following is calculated for each specific position only:

Available Margin = Isolated Position Equity - Maintenance Margin\text{Available Margin = Isolated Position Equity - Maintenance Margin}

Position Margin & Open Order Margin

Position Margin is the margin calculated per open position based on the current mark price. Your selected leverage also affects it. Open Order Margin uses the same reference price and affects your available collateral.

Position Margin=Pmark×∣Q∣L\text{Position Margin} = P_{mark} \times \frac{\lvert Q \rvert}{L}

Required Margin

Required Margin is the minimum margin requirement for an isolated position. This floor ensures the position retains enough collateral to remain open at the current leverage.

Mreq=Pmark×∣Q∣LM_{req} = P_{mark} × \frac{|Q|}{L}

Excess Margin

Excess Margin is the extra collateral above the required margin that you can remove from an isolated position without immediately breaking the minimum margin needed to keep the position open.

Mexcess=max⁡(0,Mp,iso+min⁡(0,P&Lu)−Mreq)M_{excess} = \max(0, M_{p,iso} + \min(0, P\&L_{u}) - M_{req})

Last updated

Was this helpful?