#[repr(C)]
pub struct PriceFeed { pub id: Identifier, pub status: PriceStatus, pub publish_time: i64, pub expo: i32, pub max_num_publishers: u32, pub num_publishers: u32, pub product_id: Identifier, /* private fields */ }
Expand description

Represents a current aggregation price from pyth publisher feeds.

Fields

id: Identifier

Unique identifier for this price.

status: PriceStatus

Status of price (Trading is valid).

publish_time: i64

Current price aggregation publish time

expo: i32

Price exponent.

max_num_publishers: u32

Maximum number of allowed publishers that can contribute to a price.

num_publishers: u32

Number of publishers that made up current aggregate.

product_id: Identifier

Product account key.

Implementations

Constructs a new Price Feed

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.

Get the “unchecked” 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. This method returns the price value without checking availability of the price. This value might not be valid or updated when the price is not available. Please use get_current_price where possible.

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.

Get the “unchecked” exponential moving average price (ema_price) and a confidence interval on the result.

Returns the price value without checking availability of the price. This value might not be valid or updated when the price is not available. Please use get_ema_price where possible.

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.

Get the “unchecked” previous price with Trading status, along with the timestamp at which it was generated.

WARNING: We make no guarantees about the unchecked price and confidence returned by this function: it could differ significantly from the current price. We strongly encourage you to use get_current_price instead.

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 !=.

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.

Should always be Self

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.