Struct pyth_client::Price
source · [−]#[repr(C)]pub struct Price {Show 22 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: Ema,
pub ema_confidence: Ema,
pub drv1: i64,
pub drv2: i64,
pub prod: AccKey,
pub next: AccKey,
pub prev_slot: u64,
pub prev_price: i64,
pub prev_conf: u64,
pub drv3: i64,
pub agg: PriceInfo,
pub comp: [PriceComp; 32],
}
This crate has been deprecated. Please use pyth-sdk-solana instead.
Expand description
Price accounts represent a continuously-updating price feed for a product.
Fields
magic: u32
This crate has been deprecated. Please use pyth-sdk-solana instead.
pyth magic number
ver: u32
This crate has been deprecated. Please use pyth-sdk-solana instead.
program version
atype: u32
This crate has been deprecated. Please use pyth-sdk-solana instead.
account type
size: u32
This crate has been deprecated. Please use pyth-sdk-solana instead.
price account size
ptype: PriceType
This crate has been deprecated. Please use pyth-sdk-solana instead.
price or calculation type
expo: i32
This crate has been deprecated. Please use pyth-sdk-solana instead.
price exponent
num: u32
This crate has been deprecated. Please use pyth-sdk-solana instead.
number of component prices
num_qt: u32
This crate has been deprecated. Please use pyth-sdk-solana instead.
number of quoters that make up aggregate
last_slot: u64
This crate has been deprecated. Please use pyth-sdk-solana instead.
slot of last valid (not unknown) aggregate price
valid_slot: u64
This crate has been deprecated. Please use pyth-sdk-solana instead.
valid slot-time of agg. price
ema_price: Ema
This crate has been deprecated. Please use pyth-sdk-solana instead.
exponential moving average price
ema_confidence: Ema
This crate has been deprecated. Please use pyth-sdk-solana instead.
exponential moving average confidence interval
drv1: i64
This crate has been deprecated. Please use pyth-sdk-solana instead.
space for future derived values
drv2: i64
This crate has been deprecated. Please use pyth-sdk-solana instead.
space for future derived values
prod: AccKey
This crate has been deprecated. Please use pyth-sdk-solana instead.
product account key
next: AccKey
This crate has been deprecated. Please use pyth-sdk-solana instead.
next Price account in linked list
prev_slot: u64
This crate has been deprecated. Please use pyth-sdk-solana instead.
valid slot of previous update
prev_price: i64
This crate has been deprecated. Please use pyth-sdk-solana instead.
aggregate price of previous update
prev_conf: u64
This crate has been deprecated. Please use pyth-sdk-solana instead.
confidence interval of previous update
drv3: i64
This crate has been deprecated. Please use pyth-sdk-solana instead.
space for future derived values
agg: PriceInfo
This crate has been deprecated. Please use pyth-sdk-solana instead.
aggregate price info
comp: [PriceComp; 32]
This crate has been deprecated. Please use pyth-sdk-solana instead.
price components one per quoter
Implementations
sourceimpl Price
impl Price
sourcepub fn get_current_price_status(&self) -> PriceStatus
👎 Deprecated: This crate has been deprecated. Please use pyth-sdk-solana instead.
pub fn get_current_price_status(&self) -> PriceStatus
This crate has been deprecated. Please use pyth-sdk-solana instead.
Get the current status of the aggregate price. If this lib is used on-chain it will mark price status as unknown if price has not been updated for a while.
sourcepub fn get_current_price(&self) -> Option<PriceConf>
👎 Deprecated: This crate has been deprecated. Please use pyth-sdk-solana instead.
pub fn get_current_price(&self) -> Option<PriceConf>
This crate has been deprecated. Please use pyth-sdk-solana instead.
Get the current price and confidence interval as fixed-point numbers of the form a * 10^e.
Returns a struct containing the current price, confidence interval, and the exponent for both
numbers. Returns None
if price information is currently unavailable for any reason.
sourcepub fn get_ema_price(&self) -> Option<PriceConf>
👎 Deprecated: This crate has been deprecated. Please use pyth-sdk-solana instead.
pub fn get_ema_price(&self) -> Option<PriceConf>
This crate has been deprecated. Please use pyth-sdk-solana instead.
Get the exponential moving average price (ema_price) and a confidence interval on the result.
Returns None
if the ema_price is currently unavailable.
At the moment, the confidence interval returned by this method is computed in a somewhat questionable way, so we do not recommend using it for high-value applications.
sourcepub fn get_price_in_quote(
&self,
quote: &Price,
result_expo: i32
) -> Option<PriceConf>
👎 Deprecated: This crate has been deprecated. Please use pyth-sdk-solana instead.
pub fn get_price_in_quote(
&self,
quote: &Price,
result_expo: i32
) -> Option<PriceConf>
This crate has been deprecated. Please use pyth-sdk-solana instead.
Get the current price of this account in a different quote currency. If this account
represents the price of the product X/Z, and quote
represents the price of the product Y/Z,
this method returns the price of X/Y. Use this method to get the price of e.g., mSOL/SOL from
the mSOL/USD and SOL/USD accounts.
result_expo
determines the exponent of the result, i.e., the number of digits below the decimal
point. This method returns None
if either the price or confidence are too large to be
represented with the requested exponent.
sourcepub fn price_basket(
amounts: &[(Price, i64, i32)],
result_expo: i32
) -> Option<PriceConf>
👎 Deprecated: This crate has been deprecated. Please use pyth-sdk-solana instead.
pub fn price_basket(
amounts: &[(Price, i64, i32)],
result_expo: i32
) -> Option<PriceConf>
This crate has been deprecated. Please use pyth-sdk-solana instead.
Get the price of a basket of currencies. Each entry in amounts
is of the form
(price, qty, qty_expo)
, and the result is the sum of price * qty * 10^qty_expo
.
The result is returned with exponent result_expo
.
An example use case for this function is to get the value of an LP token.
Trait Implementations
impl Copy for Price
impl Eq for Price
impl Pod for Price
impl StructuralEq for Price
impl StructuralPartialEq for Price
Auto Trait Implementations
impl RefUnwindSafe for Price
impl Send for Price
impl Sync for Price
impl Unpin for Price
impl UnwindSafe for Price
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedBitPattern for T where
T: AnyBitPattern,
impl<T> CheckedBitPattern for T where
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
. Read more
sourcefn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret bits
as &Self
.
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more