Struct pyth_sdk_solana::state::PriceAccount
source · #[repr(C)]pub struct PriceAccount {Show 25 fields
pub magic: u32,
pub ver: u32,
pub atype: u32,
pub size: u32,
pub ptype: PriceType,
pub expo: i32,
pub num: u32,
pub num_qt: u32,
pub last_slot: u64,
pub valid_slot: u64,
pub ema_price: Rational,
pub ema_conf: Rational,
pub timestamp: i64,
pub min_pub: u8,
pub drv2: u8,
pub drv3: u16,
pub drv4: u32,
pub prod: Pubkey,
pub next: Pubkey,
pub prev_slot: u64,
pub prev_price: i64,
pub prev_conf: u64,
pub prev_timestamp: i64,
pub agg: PriceInfo,
pub comp: [PriceComp; 32],
}
Expand description
Price accounts represent a continuously-updating price feed for a product.
Fields§
§magic: u32
pyth magic number
ver: u32
program version
atype: u32
account type
size: u32
price account size
ptype: PriceType
price or calculation type
expo: i32
price exponent
num: u32
number of component prices
num_qt: u32
number of quoters that make up aggregate
last_slot: u64
slot of last valid (not unknown) aggregate price
valid_slot: u64
valid slot-time of agg. price
ema_price: Rational
exponentially moving average price
ema_conf: Rational
exponentially moving average confidence interval
timestamp: i64
unix timestamp of aggregate price
min_pub: u8
min publishers for valid price
drv2: u8
space for future derived values
drv3: u16
space for future derived values
drv4: u32
space for future derived values
prod: Pubkey
product account key
next: Pubkey
next Price account in linked list
prev_slot: u64
valid slot of previous update
prev_price: i64
aggregate price of previous update with TRADING status
prev_conf: u64
confidence interval of previous update with TRADING status
prev_timestamp: i64
unix timestamp of previous aggregate with TRADING status
agg: PriceInfo
aggregate price info
comp: [PriceComp; 32]
price components one per quoter
Implementations§
source§impl PriceAccount
impl PriceAccount
pub fn get_publish_time(&self) -> UnixTimestamp
sourcepub fn get_price_no_older_than(
&self,
clock: &Clock,
slot_threshold: u64
) -> Option<Price>
pub fn get_price_no_older_than( &self, clock: &Clock, slot_threshold: u64 ) -> Option<Price>
Get the last valid price as long as it was updated within slot_threshold
slots of the
current slot.
pub fn to_price_feed(&self, price_key: &Pubkey) -> PriceFeed
Trait Implementations§
source§impl Clone for PriceAccount
impl Clone for PriceAccount
source§fn clone(&self) -> PriceAccount
fn clone(&self) -> PriceAccount
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PriceAccount
impl Debug for PriceAccount
source§impl Default for PriceAccount
impl Default for PriceAccount
source§fn default() -> PriceAccount
fn default() -> PriceAccount
source§impl PartialEq<PriceAccount> for PriceAccount
impl PartialEq<PriceAccount> for PriceAccount
source§fn eq(&self, other: &PriceAccount) -> bool
fn eq(&self, other: &PriceAccount) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for PriceAccount
impl Eq for PriceAccount
impl Pod for PriceAccount
impl StructuralEq for PriceAccount
impl StructuralPartialEq for PriceAccount
Auto Trait Implementations§
impl RefUnwindSafe for PriceAccount
impl Send for PriceAccount
impl Sync for PriceAccount
impl Unpin for PriceAccount
impl UnwindSafe for PriceAccount
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.