> For the complete documentation index, see [llms.txt](https://docs.afx.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.afx.xyz/trading-rules/oracle-price.md).

# Oracle Price

The Index Price (also called the Oracle Price) represents the fair spot market price of an asset. It is derived from multiple major centralized exchanges and serves as the foundation for the funding rate calculation and as a reference for the Mark Price.

## Data Sources

Each trading pair has a configured set of exchange price sources with assigned weights. For most assets, the default sources and weights are:

| Exchange | Weight |
| -------- | ------ |
| Binance  | 70%    |
| Bybit    | 20%    |
| OKX      | 10%    |

The Oracle Price is published every 3 seconds by the validator node.

```
Oracle Price = Σ (Price_i × Weight_i)
```

For the full list of data sources per trading pair, see [Supported Assets](/trading-rules/supported-assets.md).

## Protection Mechanisms

Several safeguards ensure the Oracle Price remains accurate and resistant to manipulation:

{% stepper %}
{% step %}

#### Timeout Detection

If an exchange's price feed has not been updated for more than **15 minutes** (configurable per pair via `MaxDelay`), that exchange is excluded from the Oracle Price calculation. Once the feed recovers, it is automatically re-included.
{% endstep %}

{% step %}

#### Outlier Filtering

If an exchange's reported price deviates from the median by more than the configured threshold (e.g., ±5% for most assets; ±1% for BTC and ETH), the price is automatically capped to the deviation threshold. Once the price returns to a normal range, it is re-included at its actual value.

**Example:** If the median spot price is 100 and OKX reports 120 (a 20% deviation exceeding the 5% cap), OKX's price is capped to 105 for the calculation.
{% endstep %}

{% step %}

#### Smoothing Mechanism

To prevent sudden price jumps, the Oracle Price limits the maximum per-update change. For example, with a 0.5% cap per update, if the previous Oracle Price was 99.8, the next Oracle Price is bounded to \[99.3, 100.3].
{% endstep %}

{% step %}

#### Dynamic Weighting

Exchange weights are dynamically adjusted based on two factors:

* **Liquidity Weight W(L):** Reflects the exchange's trading depth and volume. Measured using the square root of the exchange's 1-minute trading volume, preventing any single exchange from having disproportionate influence.
* **Latency Weight W(T):** Reflects how quickly the exchange's price data is received. Calculated using an exponential decay function: `W(T) = e^(-k × Latency)` where k = 0.5. Lower latency results in higher weight.

The final weight for each exchange is proportional to `W(L) × W(T)`, normalized so all weights sum to 100%.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.afx.xyz/trading-rules/oracle-price.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
