#[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

source

pub fn get_publish_time(&self) -> UnixTimestamp

source

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.

source

pub fn to_price_feed(&self, price_key: &Pubkey) -> PriceFeed

Trait Implementations§

source§

impl Clone for PriceAccount

source§

fn clone(&self) -> PriceAccount

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PriceAccount

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for PriceAccount

source§

fn default() -> PriceAccount

Returns the “default value” for a type. Read more
source§

impl PartialEq<PriceAccount> for PriceAccount

source§

fn eq(&self, other: &PriceAccount) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Zeroable for PriceAccount

source§

fn zeroed() -> Self

source§

impl Copy for PriceAccount

source§

impl Eq for PriceAccount

source§

impl Pod for PriceAccount

source§

impl StructuralEq for PriceAccount

source§

impl StructuralPartialEq for PriceAccount

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,

§

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

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> AnyBitPattern for Twhere T: Pod,

source§

impl<T> NoUninit for Twhere T: Pod,