Integrate
Clarity
Read Tachi prices from Stacks contracts through price-oracle.
Integrate
Read Tachi data from Solidity, Clarity or the API.
1 min read 3 sections Testnet
Read a price
The oracle contract is ST2N2SKW9XD6F6XC42C4NGMP3ZWWVMB27FRX002X8.price-oracle. Every getter is read-only and returns a response, so unwrap it.
value.clar
;; Value of `shares` SCOM in US dollars, 8 decimals.
(define-read-only (value-of (shares uint))
(let ((p (unwrap! (contract-call?
'ST2N2SKW9XD6F6XC42C4NGMP3ZWWVMB27FRX002X8.price-oracle
get-price-if-fresh-by-pair "SCOM/USD" u900)
(err u1))))
(ok (* shares (get price p)))))Read-only functions
| Function | What it does |
|---|---|
feed-id-of (pair) | Feed id of a pair name. |
get-latest-price (feed-id) | Newest stored price. |
get-price-if-fresh (feed-id) (max-age) | Errors when older than max-age seconds. |
get-market-status (feed-id) | Open, closed or halted. |
get-latest-price-by-pair (pair) | Newest price by name. |
get-price-if-fresh-by-pair (pair) (max-age) | Fresh price by name. |
get-ticker-prices (symbol) | KES and USD prices of one ticker. |
get-ticker-prices-if-fresh (symbol) (max-age) | Both prices, age checked. |
verify-report-if-fresh | Verifies a signed report without storing it. |
get-listed-feeds | Every listed feed id. |
get-feed / get-round / get-latest-round | Feed details and history. |
is-paused (feed-id) | True while the feed is paused. |
get-decimals / get-signers | Always 8 · the registered signer keys. |
Reference consumer
Deployed example
ST2N2SKW9XD6F6XC42C4NGMP3ZWWVMB27FRX002X8.example-consumer shows a full read with freshness and status checks.Something wrong or missing on this page? Tell us.

