# Index Calculation Rules

- Coin-M Perpetual Guides

**Index Calculation rules**

The HTX Futures platform performs a weighted average based on the latest transaction prices of multiple exchanges on the market, and calculates the index price. The index of the perpetual swaps and the index of the futures contract are from the same index system. Each contract has an index. For BTC-USD perpetual swaps, refer to the BTC index price.

[The above data and indicator contents may be adjusted in real time according to market conditions, and the adjustments will be made without further notice.]

Sample data sampling: Get the latest price of the exchange in the table via the API every 1 seconds (determined according to the interval of index updates).

Denomination currency: If the denomination currency of the exchange in the index sample is different from the denomination currency of the transaction pair, the denomination currency of the exchange is converted into the index denomination currency according to the exchange rate.

For example: EOS index samples are taken from the latest prices of EOS/BTC of three exchanges, the conversion process is:

- EOS/USD Price = EOS/BTC latest price * HTX futures BTC/USD index price;
- EOS/USDT Price = EOS/USDT latest price * HTX futures USDT / USD index price;
- Take four EOS/USDT price is weighted and averaged, and the EOS index price is calculated.

**Exponential exception handling**

- The price of a single exchange deviates significantly from other exchanges. Treatment plan：

If there are more than 2 valid exchanges within the indices, when the price of a certain exchange deviates more than ±3% from the median price of all exchanges (including the above), fot such exchange, its price will be calculated as ±3% of the median price of all exchanges (including the above).(For USDT, when the price of it of a certain exchange deviates more than ±0.3% from the average price, its price will be calculated as ±0.3% of the median price of all exchanges (including the above)):

For example: *Let's say the BTC price of X exchange is 518 USD, and the prices of other exchanges are 500, 501, 502, 503, 504 (USD).**The median price of all exchanges (including the above) is 502.5, so the price of X exchange deviates from others by (518-502.5)/502.5=3.08%, which is more than 3%.**Instead of 518 USD, system will take 502.5*(1+3%) =517.57 as X exchange's price.**Therefore, the final index will be (517.57+500+501+502+503+504)/6=*__504.59 USD__

If there are only 2 valid exchanges in the index (there are only 2 exchanges in the index, or due to market losses, some exchanges will be temporarily excluded). If the price deviation obtained by the two platforms is greater than 25%, it is considered that the price deviation from the index price calculated last time is normal, and the other one has an oolong index. At this time, the index price temporarily anchors the exchange with the normal price.

If the index price is based on the price of only one exchange at a time (all other exchanges have been abnormally removed). If the deviation between the obtained price and the index price obtained at the previous time is greater than 25%, it is considered that there is an oolong index, and the index price is taken from the previous time price.

- Exchange market data is lost. Treatment plan：

If a certain exchange fails to obtain market data at a certain point in time (the exchange is closed, the market is interrupted, or an attack is encountered), the price at that point in time will be calculated based on the latest valid price obtained. If the valid data obtained by an exchange in the past 100 data points (10min) is less than 10 points (10%), we will consider the price of this exchange to be uninstructive and weight the price of the exchange. Temporarily adjusted to 0. After the exchange recovers data, if at least 90 of the past 100 data points are valid (90%), then we will restore the weight of the exchange.

- Single exchange prices deviated significantly for a long time. Treatment plan：

When the price of an exchange deviates significantly from other exchanges for a long time, we believe that the price of that exchange may lose its guiding significance, and the sample and weight of the index will be adjusted. The specific adjustment plan is subject to the platform announcement.

**Exchange rate calculation rules**

The exchange rate for permanent swap contracts and futures contracts is the exchange rate sampled from "HTX", which is sample every minute.

Sample address：https://api.huobi.pro/general/exchange_rate/list