How are the prices of on-chain perpetual futures determined?
How are prices determined for on-chain perpetual futures?
On-chain perpetual futures on OKX DEX use the last price, index price, mark price, and price limits for different purposes. Understanding them helps you interpret market prices, manage your positions, and understand why an order may be rejected.
What do the different prices mean in on-chain perpetual futures?
Price | How it's determined | What it's used for |
|---|---|---|
Last price | The most recent trade in the contract's order book | Shows the latest executed trade |
Index price | OKX's weighted index of prices from multiple exchanges | Provides a reference for the mark price and price limits |
Mark price | The median of three reference prices, bounded by the contract's price limits | Calculates unrealized profit and loss (PnL), margin requirements, and liquidation risk |
Price limits | Calculated from the index price and applicable parameters | Set the highest permitted buy price and lowest permitted sell price |
How is the last price determined for on-chain perpetual futures?
The last price is the price of the most recent matched trade on the on-chain perpetual futures contract's order book. It reflects trading in that contract and changes when another trade takes place.The last price can differ from the index price because the contract has its own supply and demand. It also isn't a guaranteed execution price for your next order: your fill depends on your order conditions and available liquidity.
How is the index price determined for on-chain perpetual futures?
On-chain perpetual futures use the same index price system as the OKX centralized exchange (CEX). The system combines prices from multiple exchanges using assigned component weights to provide a broader market reference for the underlying asset.
For details about index components and weighting, refer to the OKX index components weightage adjustment FAQ.
The shared index is an input to the on-chain mark price. The mark price itself is calculated using the on-chain perpetual futures method below.
How is the mark price calculated for on-chain perpetual futures?
Under normal pricing conditions, the system calculates three reference prices, takes their median, and keeps the result within the contract's current price limits. The median is the middle value when the three prices are sorted from lowest to highest.
Reference | Calculation | What it reflects |
|---|---|---|
Price 1 | Index price + basis EMA | The smoothed difference between the contract mid-price and index price |
Price 2 | Median of best bid, best ask, and last price | The contract's order book and latest trade |
Price 3 | Index price × (1 + Latest funding rate × Time ratio) | The funding adjustment for the time remaining until the next settlement |
For Price 1, the contract mid-price is (Best bid + Best ask) ÷ 2, and the basis is Contract mid-price − Index price. The exponential moving average (EMA) gives more weight to recent data to smooth short-term changes.
For Price 3: Time ratio = Time until the next funding settlement ÷ Funding period
Both times must use the same unit. For example, if the funding period is 8 hours and the next settlement is 2 hours away, the time ratio is 2 ÷ 8 = 0.25. With an index price of 100 and a latest funding rate of 0.04%, Price 3 is 100 × (1 + 0.0004 × 0.25) = 100.01.
The final calculation is:
Reference median = median(Price 1, Price 2, Price 3)
Mark price = min(max(Reference median, Lowest price limit),Highest price limit)
If the reference median is above the highest price limit, the mark price is capped at that limit. If it's below the lowest price limit, the mark price is set to that lower limit.
Note: the funding rate and 8-hour period above are examples. The applicable funding period depends on the contract.
What does an on-chain perpetual futures mark price calculation look like?
Suppose the three reference prices and current limits are as follows. All prices are in the contract's quote currency.
Input | Example value |
|---|---|
Price 1 | 100.20 |
Price 2 | 100.50 |
Price 3 | 100.10 |
Lowest price limit | 98.00 |
Highest price limit | 102.00 |
The median of 100.10, 100.20, and 100.50 is 100.20. Since it falls within the price limits, the mark price is 100.20.Using multiple reference prices helps reduce the effect of a short-lived deviation in a single input. It doesn't remove the risk of liquidation.
How does the mark price affect my on-chain perpetual futures position?
The mark price is used to calculate your unrealized PnL and position value, which affect margin requirements and liquidation risk. Liquidation is assessed using the mark price and applicable margin requirements, rather than the last price alone.The mark price isn't a guaranteed execution price. If you close a position through the order book, your realized PnL depends on the actual fill price and applicable costs. A difference between the last price and mark price can therefore explain why your displayed unrealized PnL differs from the result of closing your position.
How do price limits affect my on-chain perpetual futures orders?
Price limits help prevent orders at prices that deviate too far from the reference market. They apply when you open or close a position.
Order side | Requirement |
|---|---|
Buy | Your order price must be at or below the highest price limit |
Sell | Your order price must be at or above the lowest price limit |
An order price outside the applicable limit doesn't meet the price limit requirements. The limits apply by buy or sell side, regardless of whether your order opens or closes a position. For example, buying to close a short position is subject to the highest price limit.
Meeting these requirements doesn't guarantee execution; your order still needs to satisfy other trading requirements and match available liquidity.
How are price limits calculated for on-chain perpetual futures?
The formulas follow the OKX price limit rules. During the initial 10 minutes after a contract is created:
Highest price limit = Index price × (1 + X)
Lowest price limit = Index price × (1 − X)
After the initial 10 minutes:
Highest price limit = min(max(Index price, Index price × (1 + Y) + Average basis),Index price × (1 + Z))
Lowest price limit = max(min(Index price, Index price × (1 − Y) + Average basis),Index price × (1 − Z))
Parameter | Meaning |
|---|---|
X | Limit percentage used during the initial 10 minutes |
Y | Limit percentage applied alongside the average basis |
Z | Outer limit on deviation from the index price |
Average basis | Average of the contract mid-price minus the index price at each sampling point over the past N minutes |
N | The averaging period in minutes |
Each basis sample uses the contract mid-price and index price from the same point in time. This average basis is calculated separately from the 10-second basis EMA used in Price 1 of the mark price formula.For example, after the initial 10 minutes, an index price of 100, an average basis of 1, Y of 2%, and Z of 5% produce a highest price limit of 103 and a lowest price limit of 99. All price amounts use the same quote currency.
Note: these values are illustrative. Parameters are set for the applicable on-chain contract, and the limits change with their inputs. CEX parameter values should not be assumed to apply to the on-chain market.
Crypto products involve significant risk. Prices can go up and down, and you may get back less than you put in. This article is for informational purposes only and is not financial, investment, or tax advice. Please do your own research and seek independent advice before making any investment decisions.