On-chain NAV (the canonical price)
ReadMarket → derive both NAVs:
mint_paired, redeem_paired, keeper_mint_single, keeper_redeem_single all use.
Oracle freshness and confidence
For more granular signal, fetch the oracle:- Surface a “price is stale” warning in your UI when
stale > 30. - Disable mint at confidence > some threshold (mirrors what the program would do anyway).
- Compute the worst-case quote a user would actually pay (NAV × (1 + state_mult × confidence_bps / 10000)).
Pyth Hermes (off-chain)
For lowest-latency display:Book base price (native Pool account)
Each side’s book is a single Pool account (seeds [b"pool", market, side]) in the CLP program. Its base_price_1e6 is where the keeper last pinned the book; bins ladder out from it.
Combining for a UX
A typical “live price” UI for a Continuum market:lNav as the primary price, riskState as a chip if non-normal, stale as a warning if > 30s. For book traders, also show the book base price and its deviation from NAV.
When to subscribe vs poll
- Subscribe (
onAccountChange) when you need < 1 second update. Costs are RPC connections; many wallets and bots can do this concurrently. - Poll (every 5–15s) for dashboards. Cheaper RPC bill, “good enough” latency.
- Hermes HTTP when you want the rawest spot price independent of what the keeper has pushed. Bypasses on-chain TWAP smoothing.
onAccountChange for the actively-displayed market detail page.
Decimals matter
Everything in account data is 6 decimals. Don’t mix raw lamports with UI numbers in the same expression:BN arithmetic doesn’t overflow easily; prefer it over toNumber() for anything you might multiply.
See also
Reading state
Full state-fetch patterns (markets, vaults, positions).
Risk states
What
Stress, ProxyMode, Recovery mean and how to surface them.
