# AshPerp Oracle

<figure><img src="/files/cOMMXxlNDwuujL9Itdqc" alt=""><figcaption></figcaption></figure>

We currently use services provided by [Pyth Network](https://twitter.com/PythNetwork'), a reputable and widely-used oracle source across numerous blockchains, offering reliable data. Nevertheless, to ensure continuity in case of maintenance or downtime at Pyth, we also maintain an alternative system that involves fetching prices from centralized exchanges. This dual approach ensures consistent and accurate price fetching, bolstering our system's resilience and reliability.

* Each of the oracle nodes take the median price from **10** **CEX APIs** (Binance, Bitfinex, [Crypto.com](http://Crypto.com), Gemini, Huobi, Kraken, OKX, Crypto-compare, Gate, and MEXC) and send the result to the aggregator contract. For each median price it receives from our nodes, the aggregator contract double-checks with the corresponding Hatom Price Feed to filter for outliers.
* If there is a difference of more than a certain threshold (10%), it rejects the node answer and waits for the next answer. Once the prices reach proper condition, the aggregator takes the median price again and sends the final result to the trading contract to execute the order.

### Lookback

**Lookback** empowers AshPerp to retroactively examine recent price data instead of solely relying on the current price data.

1. **Guaranteed Orders:** This feature ensures that all limit, stop, stop-loss, and take-profit orders are executed at the price determined by the trader. The only exception is in cases of market gaps during open/close times, where it uses the first available post-gap market price.
2. **Zero Slippage Market Orders:** Market orders now utilize the exact price from the transaction's timestamp, eliminating the slippage that previously occurred due to oracle latencies relying solely on the current price.
3. **Guarding Against Volatility and Chain Disruptions:** This feature guarantees that orders are executed at the correct price, even during periods of chain congestion or potential chain downtime. It protects traders from missed orders and price volatility.


---

# 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://docs.ashswap.io/getting-started/understand-ashperp/ashperp-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.
