> 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.
