pub struct TwapPrice {
pub feed_id: FeedId,
pub start_time: i64,
pub end_time: i64,
pub price: i64,
pub conf: u64,
pub exponent: i32,
pub down_slots_ratio: u32,
}Expand description
The time weighted average price & conf for a feed over the window [start_time, end_time]. This type is used to persist the calculated TWAP in TwapUpdate accounts on Solana.
Fields§
§feed_id: FeedId§start_time: i64§end_time: i64§price: i64§conf: u64§exponent: i32§down_slots_ratio: u32Ratio out of 1_000_000, where a value of 1_000_000 represents all slots were missed and 0 represents no slots were missed.
Trait Implementations§
Source§impl BorshDeserialize for TwapPricewhere
FeedId: BorshDeserialize,
i64: BorshDeserialize,
u64: BorshDeserialize,
i32: BorshDeserialize,
u32: BorshDeserialize,
impl BorshDeserialize for TwapPricewhere
FeedId: BorshDeserialize,
i64: BorshDeserialize,
u64: BorshDeserialize,
i32: BorshDeserialize,
u32: BorshDeserialize,
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for TwapPricewhere
FeedId: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
i32: BorshSerialize,
u32: BorshSerialize,
impl BorshSerialize for TwapPricewhere
FeedId: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
i32: BorshSerialize,
u32: BorshSerialize,
Source§impl BorshSchema for TwapPrice
impl BorshSchema for TwapPrice
Source§fn declaration() -> Declaration
fn declaration() -> Declaration
Get the name of the type without brackets.
Source§fn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>,
)
fn add_definitions_recursively( definitions: &mut HashMap<Declaration, Definition>, )
Recursively, using DFS, add type definitions required for this type. For primitive types
this is an empty map. Type definition explains how to serialize/deserialize a type.
Source§fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition>,
)
fn add_definition( declaration: String, definition: Definition, definitions: &mut HashMap<String, Definition>, )
Helper method to add a single type definition to the map.
fn schema_container() -> BorshSchemaContainer
impl Copy for TwapPrice
impl StructuralPartialEq for TwapPrice
Auto Trait Implementations§
impl Freeze for TwapPrice
impl RefUnwindSafe for TwapPrice
impl Send for TwapPrice
impl Sync for TwapPrice
impl Unpin for TwapPrice
impl UnwindSafe for TwapPrice
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more