#[repr(C)]pub struct GenericPriceAccount<const N: usize, T>{Show 26 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; N],
pub extended: T,
}Fields§
§magic: u32pyth magic number
ver: u32program version
atype: u32account type
size: u32price account size
ptype: PriceTypeprice or calculation type
expo: i32price exponent
num: u32number of component prices
num_qt: u32number of quoters that make up aggregate
last_slot: u64slot of last valid (not unknown) aggregate price
valid_slot: u64valid slot-time of agg. price
ema_price: Rationalexponentially moving average price
ema_conf: Rationalexponentially moving average confidence interval
timestamp: i64unix timestamp of aggregate price
min_pub: u8min publishers for valid price
drv2: u8space for future derived values
drv3: u16space for future derived values
drv4: u32space for future derived values
prod: Pubkeyproduct account key
next: Pubkeynext Price account in linked list
prev_slot: u64valid slot of previous update
prev_price: i64aggregate price of previous update with TRADING status
prev_conf: u64confidence interval of previous update with TRADING status
prev_timestamp: i64unix timestamp of previous aggregate with TRADING status
agg: PriceInfoaggregate price info
comp: [PriceComp; N]price components one per quoter
extended: Tadditional extended account data
Implementations§
Source§impl<const N: usize, T> GenericPriceAccount<N, T>
impl<const N: usize, T> GenericPriceAccount<N, T>
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
Source§impl<const N: usize, T> GenericPriceAccount<N, T>
impl<const N: usize, T> GenericPriceAccount<N, T>
pub fn account_info_to_feed( price_account_info: &AccountInfo<'_>, ) -> Result<PriceFeed, PythError>
pub fn account_to_feed( price_key: &Pubkey, price_account: &mut impl Account, ) -> Result<PriceFeed, PythError>
Trait Implementations§
Source§impl<const N: usize, T> Clone for GenericPriceAccount<N, T>
impl<const N: usize, T> Clone for GenericPriceAccount<N, T>
Source§fn clone(&self) -> GenericPriceAccount<N, T>
fn clone(&self) -> GenericPriceAccount<N, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const N: usize, T> Debug for GenericPriceAccount<N, T>
impl<const N: usize, T> Debug for GenericPriceAccount<N, T>
Source§impl<const N: usize, T> Default for GenericPriceAccount<N, T>
impl<const N: usize, T> Default for GenericPriceAccount<N, T>
Source§impl<const N: usize, T> Deref for GenericPriceAccount<N, T>
impl<const N: usize, T> Deref for GenericPriceAccount<N, T>
Source§impl<const N: usize, T> PartialEq for GenericPriceAccount<N, T>
impl<const N: usize, T> PartialEq for GenericPriceAccount<N, T>
impl<const N: usize, T> Copy for GenericPriceAccount<N, T>
impl<const N: usize, T> Eq for GenericPriceAccount<N, T>
impl<const N: usize, T: Default + Copy + 'static> Pod for GenericPriceAccount<N, T>
impl<const N: usize, T> StructuralPartialEq for GenericPriceAccount<N, T>
Auto Trait Implementations§
impl<const N: usize, T> Freeze for GenericPriceAccount<N, T>where
T: Freeze,
impl<const N: usize, T> RefUnwindSafe for GenericPriceAccount<N, T>where
T: RefUnwindSafe,
impl<const N: usize, T> Send for GenericPriceAccount<N, T>where
T: Send,
impl<const N: usize, T> Sync for GenericPriceAccount<N, T>where
T: Sync,
impl<const N: usize, T> Unpin for GenericPriceAccount<N, T>where
T: Unpin,
impl<const N: usize, T> UnwindSafe for GenericPriceAccount<N, T>where
T: UnwindSafe,
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,
Source§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.