How are the prices of on-chain spot determined?
How are prices determined for on-chain spot trading?
When you trade on-chain spot on OKX DEX, the last price shows the most recent trade, the index price provides a broader market reference, and price limits help prevent orders at extreme prices. This article explains how each works for spot trading without borrowing or leverage.
What do the different prices mean in on-chain spot trading?
Price | How it's determined | What it's used for |
|---|---|---|
Last price | The price of the most recent trade in the pair's order book | Shows the latest executed trade |
Index price | A weighted combination of prices from multiple exchanges, using OKX's index price system | Provides a market reference for price limits |
Price limits | Calculated from the index price and applicable price limit parameters | Set the highest permitted buy price and lowest permitted sell price |
How is the last price determined for on-chain spot trading?
The last price is the price at which the most recent buy and sell orders matched on that on-chain spot pair's order book. It changes when a new trade takes place.For example, if the latest trade executes at 100.20 in the pair's quote currency, the last price is 100.20. It isn't necessarily the price at which your next order will execute. Your execution price depends on your order conditions and the available orders in the market.
How is the index price determined for on-chain spot trading?
On-chain spot trading uses the same index price system as the OKX centralized exchange (CEX). The system combines prices from multiple exchanges using their assigned component weights.The index price provides a reference beyond a single order book. It can differ from the last price because the last price reflects a trade on the on-chain spot market, while the index reflects prices across its constituent markets.For more information about index components and weighting, refer to the OKX index components weightage adjustment FAQ.
How do price limits affect my on-chain spot orders?
Price limits help reduce the impact of orders placed at prices that deviate too far from the market reference. They apply to spot orders even though spot trading doesn't use leverage.
Order side | Requirement | Example |
|---|---|---|
Buy | Your order price must not exceed the highest price limit | If the limit is 102, a buy order at 103 exceeds it |
Sell | Your order price must not fall below the lowest price limit | If the limit is 98, a sell order at 97 falls below it |
The limits apply by order side. In this example, a buy order at 97 or a sell order at 103 doesn't violate these price limit rules. An order price outside the applicable limit doesn't meet the price limit requirements.
Note: meeting the price limit requirements doesn't guarantee execution. Your order must also meet other trading requirements and find a matching order.
How are price limits calculated for on-chain spot trading?
For spot pairs using index-based price limits, the calculation has two stages:
Stage | Calculation basis |
|---|---|
Initial 10 minutes after listing | Index price and the initial limit percentage, X |
After the initial 10 minutes | Index price, average basis, and the limit percentages Y and Z |
During the initial 10 minutes:
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 spot mid-price minus the index price at each sampling point over the past N minutes |
N | The averaging period in minutes |
The spot mid-price is the average of the best bid and best ask on the pair's order book. A positive basis means the mid-price is above the index; a negative basis means it's below the index. Each basis sample uses prices from the same point in time.
These formulas follow the OKX price limit rules. Parameters are set for the applicable on-chain spot pair; CEX parameter values should not be assumed to apply to the on-chain market. Use percentages as decimals in the formulas—for example, 2% = 0.02.
What does an on-chain spot price limit calculation look like?
Suppose the initial 10 minutes have passed and the following example values apply. All price amounts are in the pair's quote currency.
Input | Example value |
|---|---|
Index price | 100 |
Average basis | 1 |
Y | 2% |
Z | 5% |
The highest price limit is min[max(100, 103), 105] = 103. The lowest price limit is max[min(100, 99), 95] = 99.Your buy price must therefore be at or below 103, and your sell price must be at or above 99.
Note: these values illustrate the calculation only. They aren't the current parameters of any trading pair. Price limits change as their inputs change.
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.