pub struct TwapPrice {
pub feed_id: [u8; 32],
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: [u8; 32]
FeedId
but avoid the type alias because of compatibility issues with Anchor’s idl-build
feature.
start_time: i64
§end_time: i64
§price: i64
§conf: u64
§exponent: i32
§down_slots_ratio: u32
Ratio 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
[u8; 32]: BorshDeserialize,
i64: BorshDeserialize,
u64: BorshDeserialize,
i32: BorshDeserialize,
u32: BorshDeserialize,
impl BorshDeserialize for TwapPricewhere
[u8; 32]: 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
[u8; 32]: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
i32: BorshSerialize,
u32: BorshSerialize,
impl BorshSerialize for TwapPricewhere
[u8; 32]: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
i32: BorshSerialize,
u32: BorshSerialize,
Source§impl BorshSchema for TwapPricewhere
[u8; 32]: BorshSchema,
i64: BorshSchema,
u64: BorshSchema,
i32: BorshSchema,
u32: BorshSchema,
impl BorshSchema for TwapPricewhere
[u8; 32]: BorshSchema,
i64: BorshSchema,
u64: BorshSchema,
i32: BorshSchema,
u32: BorshSchema,
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