Struct pyth_sdk::PriceFeed

source ·
#[repr(C)]
pub struct PriceFeed { pub id: PriceIdentifier, /* private fields */ }
Expand description

Represents a current aggregation price from pyth publisher feeds.

Fields§

§id: PriceIdentifier

Unique identifier for this price.

Implementations§

Constructs a new Price Feed

Get the “unchecked” price and confidence interval as fixed-point numbers of the form a * 10^e along with its publish time.

Returns a Price struct containing the current price, confidence interval, and the exponent for both numbers, and publish time. This method returns the latest price which may be from arbitrarily far in the past, and the caller should probably check the timestamp before using it.

Please consider using get_price_no_older_than when possible.

Get the “unchecked” exponentially-weighted moving average (EMA) price and a confidence interval on the result along with its publish time.

Returns the latest EMA price value which may be from arbitrarily far in the past, and the caller should probably check the timestamp before using it.

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.

Please consider using get_ema_price_no_older_than when possible.

Get the price as long as it was updated within age seconds of the current_time.

This function is a sanity-checked version of get_price_unchecked which is useful in applications that require a sufficiently-recent price. Returns None if the price wasn’t updated sufficiently recently.

Returns a struct containing the latest available price, confidence interval and the exponent for both numbers, or None if no price update occurred within age seconds of the current_time.

Get the exponentially-weighted moving average (EMA) price as long as it was updated within age seconds of the current_time.

This function is a sanity-checked version of get_ema_price_unchecked which is useful in applications that require a sufficiently-recent price. Returns None if the price wasn’t updated sufficiently recently.

Returns a struct containing the EMA price, confidence interval and the exponent for both numbers, or None if no price update occurred within age seconds of the current_time.

Trait Implementations§

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more
Deserialize this instance from a slice of bytes.
Serialize this instance into a vector of bytes.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
The name of the generated JSON Schema. Read more
Generates a JSON Schema for this type. Read more
Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.