seahorse.py 666 B

1234567891011121314151617181920212223242526272829303132
  1. # seahorse
  2. # Built with Seahorse v0.2.7
  3. from seahorse.prelude import *
  4. from seahorse.pyth import *
  5. declare_id('9USP8f9ooxUxWTyqrQSDfyiXE1FP7Wfsg34NfAbdK1ur')
  6. @instruction
  7. def get_pyth_price(
  8. pyth_price_account: PriceAccount,
  9. signer: Signer,
  10. ):
  11. price_feed = pyth_price_account.validate_price_feed("SOL/USD")
  12. price_feed.get_price().num()
  13. price = price_feed.get_price()
  14. x: f64 = price.num()
  15. p: i64 = price.price
  16. c: u64 = price.conf
  17. e: i32 = price.expo
  18. print("Pyth price: ", x)
  19. print("Pyth price without decimals: ", p)
  20. print("Pyth confidence interval: ", c)
  21. print("Pyth account decimal exponent: ", e)