Price feed
Composite index weighting
Perpetual swaps track an underlying composite index, which is a weighted average price of spot prices across a selection of exchange offerings. Exactly which exchanges to use is a parameter that can be be modified from an initial setting via governance.
While it is fairly trivial to add more exchanges with custom weightings (necessary as the exchange supports numerous assets), at the moment, the DerivaDEX composite index price is currently constructed in the following manner:
Exchange | Weighting |
Binance | 50% |
Gemini | 50% |
Update criterion
As is commonplace across the most performant centralized exchanges, the DerivaDEX price feed updates every second, if and only if the price has changed by more than 1 bps
(0.01%).
Price feed attributes
The price feed emits "Price checkpoint" events that are stored in the system's verifiable state, that contain the following information:
Index price
The index price is the weighted average composite price as per the details above.
EMA
The EMA (exponential moving average) tracks the spread between the DerivaDEX perpetual swap's price and the underlying index price it is tracking. It is derived in the following manner:
Compute the
fair_price
of the DerivaDEX order book, which is the midpoint of the best available bid and ask.fair_price = avg(best_bid, best_ask)
.Compute the
premium
, which is the difference between thefair_price
and the composite index price.premium = fair_price - index_price
.Compute the latest
ema
value of thispremium
using a 30-period EMA multiplier and the last computedema
.ema = (premium - previous_ema) * (2/31) + previous_ema
.
In the case where the DerivaDEX order book is consistently trading above the composite index price, this ema
will be positive, and if it is trading below the index price, it will be negative. This ema
field has special significance for computing and distributing funding rate-related payments.
Mark price
The mark price, critical for assessing liquidations and depicting unrealized PNLs for positions, is merely a transformation of the index_price
and ema
described above: mark_price = index_price + ema
.
Last updated