Skip to main content
DerivaDEX prices each perpetual with two related values: the index price (a composite spot price from external feeds) and the mark price (the fair price used for margin, liquidation, funding, and mark-relative trading checks).

Price types and what they are used for

PriceDefinitionUsed for
Index priceComposite spot price from the configured external feedsExternal reference input to the mark price
Mark priceIndex price plus a smoothed premium, clamped to ±50 basis points (±0.5%) of indexMargin, liquidation, funding, and price-band checks; fills still execute at book price
Last trade pricePrice of the most recent fill on the DerivaDEX order bookTrade reporting and chart displays
Bankruptcy pricePrice at which a strategy’s collateral is fully consumed by position lossesLiquidation spread and auto-deleveraging (ADL) pricing
The mark price (not the last trade price) determines risk checks.

Index sources by market

By default, each listed perpetual uses three external spot feeds.
MarketUnderlyingExternal spot sources
ETHPETHCoinbase ETH-USD, Binance ETHUSDC, Gemini ETHUSD
BTCPBTCCoinbase BTC-USD, Binance BTCUSDC, Gemini BTCUSD

Index price calculation

At each oracle update, typically once per second, DerivaDEX aggregates the latest source prices into one index price.
median_source_price = median(latest_source_prices)
clamped_source_i = clamp(source_i, 0.995 × median_source_price, 1.005 × median_source_price)
clamped_composite = average(clamped_source_1 ... clamped_source_n)
index_price_next = index_price_prev + alpha × (clamped_composite - index_price_prev)
alpha = 2 / (30 + 1)
ParameterValueNotes
Aggregation methodMedian anchor, then arithmetic meanOutliers are clamped before averaging
Per-source outlier clamp±0.5% around the medianApplied separately to each source price
EMA period30 updatesalpha = 2 / (30 + 1)
Default oracle polling interval1 secondSource feeds are polled once per second in the default configuration
First published index priceCurrent clamped compositeNo time smoothing applies until there is a prior published value

Mark-price inputs

The mark price starts from the current index price and adds a smoothed premium derived from the DerivaDEX book.
InputDefinitionFallback behavior
Index priceCurrent composite spot price from the external feedsRequired base input
Fair priceBest available book reference from DerivaDEX quotesMidpoint if both sides exist; bid if only bid exists; ask if only ask exists; index price if the book is empty
Premium EMAExponential moving average of fair_price - index_priceCarries forward the prior premium state between updates

Mark-price calculation

The mark price uses the fair-price premium, then clamps the result back to the index.
fair_price = (best_bid + best_ask) / 2        if both sides exist
fair_price = best_bid                           if only bid exists
fair_price = best_ask                           if only ask exists
fair_price = index_price                        if the book is empty

premium = fair_price - index_price
premium_ema_next = premium_ema_prev + alpha × (premium - premium_ema_prev)
mark_price = index_price + clamp(premium_ema_next, -0.005 × index_price, +0.005 × index_price)
ParameterValueNotes
Premium inputfair_price - index_priceTracks the DerivaDEX book relative to the external index
EMA period30 updatesUses the same smoothing constant as the index update
Mark-price clamp±50 bps (±0.5%) of index pricePrevents the mark from drifting arbitrarily far from the external reference
Realtime feedMARK_PRICECarries mark-price and funding-rate updates

Mark-dependent trading checks

DerivaDEX uses the current mark price in both sequencing and matching.
CheckWhat happens
Explicitly priced order validationSequencing rejects an explicitly priced order when its taker price breaches the product’s max_taker_price_deviation from the current mark price
Market-order handlingMarket orders skip the sequencer deviation check because they have no explicit price
Matching price bandWhen no explicit taker limit exists, matching derives a mark-price-relative limit from the product’s max_taker_price_deviation
Residual beyond the bandAny unmatched remainder is canceled rather than filled outside the effective band
Missing mark priceRequests can fail with MarketPriceNotAvailable instead of trading without a current risk price

Worked pricing cases

These examples show which book price becomes the fair-price input before the premium EMA and mark-price clamp apply.
Book stateFair-price input
Best bid 2,000, best ask 2,002Midpoint 2,001
Best bid 2,000, no askBid 2,000
No bid, best ask 2,002Ask 2,002
No bid and no askCurrent index price
Feed venues and polling intervals are governance-controlled and may change.
Last modified on April 24, 2026