Price types and what they are used for
| Price | Definition | Used for |
|---|---|---|
| Index price | Composite spot price from the configured external feeds | External reference input to the mark price |
| Mark price | Index price plus a smoothed premium, clamped to ±50 basis points (±0.5%) of index | Margin, liquidation, funding, and price-band checks; fills still execute at book price |
| Last trade price | Price of the most recent fill on the DerivaDEX order book | Trade reporting and chart displays |
| Bankruptcy price | Price at which a strategy’s collateral is fully consumed by position losses | Liquidation spread and auto-deleveraging (ADL) pricing |
Index sources by market
By default, each listed perpetual uses three external spot feeds.| Market | Underlying | External spot sources |
|---|---|---|
ETHP | ETH | Coinbase ETH-USD, Binance ETHUSDC, Gemini ETHUSD |
BTCP | BTC | Coinbase 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.| Parameter | Value | Notes |
|---|---|---|
| Aggregation method | Median anchor, then arithmetic mean | Outliers are clamped before averaging |
| Per-source outlier clamp | ±0.5% around the median | Applied separately to each source price |
| EMA period | 30 updates | alpha = 2 / (30 + 1) |
| Default oracle polling interval | 1 second | Source feeds are polled once per second in the default configuration |
| First published index price | Current clamped composite | No 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.| Input | Definition | Fallback behavior |
|---|---|---|
| Index price | Current composite spot price from the external feeds | Required base input |
| Fair price | Best available book reference from DerivaDEX quotes | Midpoint if both sides exist; bid if only bid exists; ask if only ask exists; index price if the book is empty |
| Premium EMA | Exponential moving average of fair_price - index_price | Carries 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.| Parameter | Value | Notes |
|---|---|---|
| Premium input | fair_price - index_price | Tracks the DerivaDEX book relative to the external index |
| EMA period | 30 updates | Uses the same smoothing constant as the index update |
| Mark-price clamp | ±50 bps (±0.5%) of index price | Prevents the mark from drifting arbitrarily far from the external reference |
| Realtime feed | MARK_PRICE | Carries mark-price and funding-rate updates |
Mark-dependent trading checks
DerivaDEX uses the current mark price in both sequencing and matching.| Check | What happens |
|---|---|
| Explicitly priced order validation | Sequencing rejects an explicitly priced order when its taker price breaches the product’s max_taker_price_deviation from the current mark price |
| Market-order handling | Market orders skip the sequencer deviation check because they have no explicit price |
| Matching price band | When no explicit taker limit exists, matching derives a mark-price-relative limit from the product’s max_taker_price_deviation |
| Residual beyond the band | Any unmatched remainder is canceled rather than filled outside the effective band |
| Missing mark price | Requests 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 state | Fair-price input |
|---|---|
Best bid 2,000, best ask 2,002 | Midpoint 2,001 |
Best bid 2,000, no ask | Bid 2,000 |
No bid, best ask 2,002 | Ask 2,002 |
| No bid and no ask | Current index price |