# Pricing & Oracle

The **Avitus Oracle System** plays a critical role in ensuring accurate and reliable price feeds for all perpetual trading operations within the protocol. It provides real-time spot prices, which are integral for computing funding rates, calculating mark prices, and executing functions such as margining, liquidations, and triggering Take Profit (TP) and Stop Loss (SL) orders.

***

**Oracle Price Computation**

1. **Source Data Aggregation**:\
   The Avitus Oracle collects price data from a diverse range of leading exchanges, ensuring comprehensive market coverage. The following sources are currently utilized, with their respective weights for computing the oracle price:

   * **Binance**: Weight 3
   * **OKX**: Weight 2
   * **Bybit**: Weight 2
   * **Kraken**: Weight 1
   * **KuCoin**: Weight 1
   * **Gate.io**: Weight 1
   * **MEXC**: Weight 1
   * **Avitus Spot Market**: Weight 1

   The **weighted median** of these prices is calculated to derive a robust and resilient spot price for each asset.
2. **Primary Liquidity Considerations**:\
   For assets with primary spot liquidity on Avitus’s own spot markets, external exchange data is gradually incorporated only when sufficient liquidity thresholds are met. This ensures that the oracle price remains reflective of the most reliable market activity.
3. **Validator Price Submission**:\
   Each validator independently computes the spot price for an asset using the weighted median approach described above. Validators submit their oracle prices every **1 seconds**, ensuring high-frequency updates in line with market movements.

***

**Final Oracle Price for the Clearinghouse**

To achieve decentralization and further resilience, the final oracle price used by the Clearinghouse is determined as follows:

* The **weighted median** of all validator-submitted oracle prices is computed.
* Each validator’s submission is weighted by their stake in the network, ensuring that validators with higher stakes have proportionally greater influence on the final price.

***

**Use Cases of Oracle Prices**

1. **Funding Rate Calculation**:\
   Oracle prices are used to compute funding rates, ensuring that perpetual contract prices remain closely aligned with spot prices.
2. **Mark Price Determination**:\
   Mark prices which is primarily used by the **Clearinghouse**. Mark prices is critical for margining, liquidation thresholds, and TP/SL execution, are derived using oracle prices to provide a fair and consistent value across the system.
3. **Risk Management**:\
   The Oracle enhances protocol stability by mitigating risks associated with price manipulation or data inaccuracies from individual sources.


---

# Agent Instructions: 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://avitus.gitbook.io/avitus-docs/pricing-and-oracle.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.
