> For the complete documentation index, see [llms.txt](https://docs.ducatprotocol.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ducatprotocol.com/how-ducat-works/oracles/price-quotes.md).

# Price Quotes

Upon request, the price oracle provides a price quote, which is a signed attestation of the BTC/USD exchange rate at a specified timestamp. If no timestamp is specified, the latest available price is used.

Each request must include a threshold price, which is the price level at which a threshold key may be revealed. The oracle uses this threshold price, along with other data, to compute a threshold key. This key is hashed using the HASH160 algorithm, and the resulting hash is returned alongside the price quote.

Price quotes are requested using the following URL format:

<mark style="color:orange;">`GET https://price-oracle-url/quote?th=<THRESHOLD_PRICE>&ts=<QUOTE_STAMP>`</mark>

If a quote is requested with a specific timestamp, the oracle must check whether the BTC/USD price has crossed the threshold price between that timestamp and the current time.

If the threshold has been crossed, then the <mark style="color:orange;">`is_expired`</mark> boolean must be set to <mark style="color:orange;">`true`</mark>, and price oracle must provide the threshold key with the quote, along with the price and timestamp at which the threshold was first observed to have been crossed.

If the threshold has *not* been crossed, then the <mark style="color:orange;">`is_expired`</mark> boolean must be set to <mark style="color:orange;">`false`</mark>, and the relevant fields (<mark style="color:orange;">`thold_key`</mark>, <mark style="color:orange;">`expiry_price`</mark>, <mark style="color:orange;">`expiry_stamp`</mark>) must be set to <mark style="color:orange;">`null`</mark>.

The price oracle must securely store an <mark style="color:orange;">`HMAC_SECRET`</mark> key (used to generate threshold keys), and <mark style="color:orange;">`SIGN_SECRET`</mark> key.


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.ducatprotocol.com/how-ducat-works/oracles/price-quotes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
