Skip to main content

Oracle Price

The oracle price is the external spot reference for a market and is used to accurately value positions, determine funding rates and act as a component in the calculation of the mark price (below).

Calculation

Validators are responsible for sourcing external price references from external venues and publishing them onchain. Prices are collected every 3s, passed through a price filter which removes stale and spurious updates, and the final price is calculated as a weighted median. The external venues and weights for each are below:

Mark Price

The mark price is the reference used for margining, liquidation triggers, and PnL. It has two core invariants: it must represent an unbiased and fair price of the perpetual contract, and be resistant to market manipulation.

Calculation

Mark price is calculated as the median of the following components:

1. Premium-Adjusted Oracle Price

raw_premiumt=impact_midt−oraclet\text{raw\_premium}_t = \text{impact\_mid}_t - \text{oracle}_t clamped_premiumt=clamp(raw_premiumt,  −0.005⋅oraclet,  +0.005⋅oraclet)\text{clamped\_premium}_t = \text{clamp}\big(\text{raw\_premium}_t,\; -0.005\cdot\text{oracle}_t,\; +0.005\cdot\text{oracle}_t\big) premiumt=α10s⋅clamped_premiumt+(1−α10s)⋅premiumt−1\text{premium}_t = \alpha_{10s} \cdot \text{clamped\_premium}_t + (1-\alpha_{10s})\cdot \text{premium}_{t-1} where α10s\alpha_{10s} corresponds to a 10-second half-life (or decay window) EMA.

2. Impact Price

notional=500/Initial Margin Fraction\text{notional} = \text{500}/\text{Initial Margin Fraction} impact_midt=impact_bidt(notional)+impact_askt(notional)2\text{impact\_mid}_t = \frac{\text{impact\_bid}_t(\text{notional}) + \text{impact\_ask}_t(\text{notional})}{2} Undefined if either side lacks sufficient depth for this notional.

Final Calculation

price1=oraclet+premiumt\text{price}_1 = \text{oracle}_t + \text{premium}_t raw_markt={median⁡(impact_midt, price1, oraclet)if impact_mid definedprice1otherwise\text{raw\_mark}_t = \begin{cases} \operatorname{median}\big(\text{impact\_mid}_t,\ \text{price}_1,\ \text{oracle}_t\big) & \text{if impact\_mid defined} \\[4pt] \text{price}_1 & \text{otherwise} \end{cases} markt=clamp⁡(raw_markt,  0.98⋅oraclet,  1.02⋅oraclet)\text{mark}_t = \operatorname{clamp}\big(\text{raw\_mark}_t,\; 0.98\cdot\text{oracle}_t,\; 1.02\cdot\text{oracle}_t\big)