# PriceOracle

**PriceOracle** ensures fair pricing by storing historical prices and computing time-weighted average prices (TWAP).

**Key Fields**:

* `id`: Unique identifier for the oracle.
* `price_cumulative`: An accumulated total of historical prices used to compute averages.
* `last_update_time`: When the oracle last recorded a price sample.
* `price_samples`: A vector of recorded prices for computing TWAP.
* `sample_period`: The time interval between samples, e.g., hourly.

**Role**:

* Provides stable, manipulation-resistant price references.
* Helps detect abnormal price fluctuations or limit price impact, protecting traders.
* Integrates with TradingPools to adjust prices or verify trades against TWAP values.


---

# 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.artinals.com/artinals-protocol/trade-module/data-structures/priceoracle.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.
