Skip to main content

Module pyth

Module pyth 

Source
Expand description

Pyth price-feed helpers (PriceUpdateV2 accounts — push or pull).

§Preferred flow (push feed accounts)

The Pyth Data Association maintains continuously-updated price feed accounts at fixed PDAs (heartbeat ~400 ms). Pass crate::consts::PYTH_BTC_USD_PRICE_FEED_ACCOUNT directly to AdminInstantSettlement — no Hermes fetch or post_update_atomic required.

§Settlement price chain

AdminInstantSettlement reads the close price from the Pyth push feed and writes it back to Treasury::last_close_*. The next period’s settlement reads that stored value as its open reference. No anchor transaction at open_ts is needed.

Structs§

Price

Functions§

assert_pyth_receiver_owner
Assert that info is owned by either the Pyth Receiver program (pull feeds) or the Pyth Push Oracle program (continuously-maintained push feed accounts).
load_fresh_price
Parse a PriceUpdateV2 account into our internal Price type.
outcome_from_open_close
Determine UP or DOWN from open vs close prices at a common exponent.