# 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: 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.ducatprotocol.com/how-ducat-works/oracles/price-quotes.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.
