Skip to main content
The mark price is the reference price Rails uses for a perpetual market. Margin requirements, unrealized PnL, and liquidations are all based on the mark price rather than the index price — see Position Metrics and Risk Management for how it feeds those calculations. Funding is the one calculation that stays on the index price directly — see Funding.

Key Definitions

How It’s Calculated

The mark price is the median of three values:
Two of the three values are anchored to the external index. That means Rails’ own order book can pull the mark price toward itself, but it can never run away with it: the mark can only deviate from the index by as much as the smoothed, time-averaged premium, never by the size of a momentary spike.

The Premium EMA

Rails’ market naturally trades slightly above or below the index — that gap is the premium:
Rather than using the instantaneous gap, adjustedIndex uses an exponential moving average (EMA) of the premium with a 2.5-minute time constant. Recent samples count the most and older samples fade out smoothly, and samples are weighted by how long they were in effect. A one-second spike in the book barely moves the average; a persistent premium shifts it over minutes. The EMA is computed from a pair of decaying sums, updated on every tick, t seconds after the previous one:

Update Frequency

The mark price updates on every index price tick, at most once every 250 milliseconds per market. All arithmetic is exact decimal (no floating point drift), and the published price is rounded to the price increment of 0.0000001.

When Inputs Are Unavailable

A market can temporarily be missing some of its own input. Whenever that happens, the mark price falls back to the index price instead of going stale: Fallback updates follow the same 250 millisecond cadence as normal updates.

Usage in API

The mark price is published as a MARK entry from the Get Market Data endpoint, with value holding the price. See Position Metrics for the PnL formula and Risk Management for how the mark price drives liquidation.