> For the complete documentation index, see [llms.txt](https://docs.coinlocally.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coinlocally.com/perpetual-contracts/overview/index-price.md).

# Index Price

### **Definition**

The **index price** represents the **fair market price** of a trading pair. It is calculated using a **weighted average** of the latest transaction prices and bid/ask medians from multiple major exchanges.

This ensures the index accurately reflects the spot market value of the asset, minimizing manipulation and price spikes from any single exchange.

### **Data Sources & Weights**

For **USDT-margined contracts**, the index price is derived from the following exchanges with **equal weighting**:

| Contract | OKX Weight | Huobi Weight | Binance Weight |
| -------- | ---------- | ------------ | -------------- |
| BTC/USDT | 33.3%      | 33.3%        | 33.3%          |
| ETH/USDT | 33.3%      | 33.3%        | 33.3%          |

> ⚠️ *The above weights and data sources may be adjusted dynamically according to market conditions, without prior notice.*

### **Index Price Calculation**

Let:

* P<sub>i</sub>​: Price from exchange i
* w<sub>i</sub>​: Weight assigned to exchange i

Then, the **Index Price P**<sub>**index**</sub> is calculated as:

$$
P\_{\text{index}} = \sum\_{i=1}^{n} w\_i \times P\_i
$$

Where:

* n: Number of exchanges (e.g., 3)
* ∑w<sub>i</sub> = 1

### **Sampling Frequency**

* Price data from each exchange is fetched **every 1 second** via API.
* Updates depend on the interval of index calculation.

### **Index Exception Handling**

#### 1. **Removing Invalid Prices**

If a price from an exchange:

* Has **not updated within 40,000 ms (40 seconds)**, and
* Its previous value **deviates significantly from the latest values**

Then, the system treats this price as **invalid**:

$$
w\_i = 0 \quad \text{(reset weight to 0 for that exchange)}
$$

#### 2. **Abnormal Price Correction**

If the price from any exchange deviates by more than **±3%** from the **median** of all prices, it is considered **abnormal**.

Let:

* P<sub>m</sub>​: Median price of all sources
* P<sub>i</sub>: Price from a source exchange

$$
\delta = \left| \frac{P\_i - P\_m}{P\_m} \right|
$$

If:

$$
\delta > 3%
$$

Then:

$$
P\_i = P\_m \times (1 \pm 3%)
$$

This applies to both BTC/USDT, ETH/USDT, or other contracts where the **median deviation** exceeds ±3%.
