pub struct InstrumentMeta {
pub symbol: String,
pub tick_size: f64,
pub price_precision: usize,
pub timezone: String,
}Expand description
Provider-neutral instrument metadata.
Fields§
§symbol: String§tick_size: f64§price_precision: usize§timezone: StringImplementations§
Source§impl InstrumentMeta
impl InstrumentMeta
Sourcepub fn validate(&self) -> Result<(), InstrumentMetaError>
pub fn validate(&self) -> Result<(), InstrumentMetaError>
Validates the operative contract required to use this metadata for rounding, risk and session calculations: a finite positive tick size, a sane price precision, and non-empty symbol/timezone identifiers.
Sourcepub fn round_to_tick(&self, price: f64) -> f64
pub fn round_to_tick(&self, price: f64) -> f64
Rounds price to the nearest multiple of InstrumentMeta::tick_size.
Returns price unchanged if tick_size is non-finite or non-positive, so this method is
safe to call on unvalidated metadata (see InstrumentMeta::validate to reject that case
explicitly at ingestion boundaries).
Trait Implementations§
Source§impl Clone for InstrumentMeta
impl Clone for InstrumentMeta
Source§fn clone(&self) -> InstrumentMeta
fn clone(&self) -> InstrumentMeta
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InstrumentMeta
impl Debug for InstrumentMeta
Source§impl Default for InstrumentMeta
impl Default for InstrumentMeta
Source§impl<'de> Deserialize<'de> for InstrumentMeta
impl<'de> Deserialize<'de> for InstrumentMeta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for InstrumentMeta
impl PartialEq for InstrumentMeta
Source§impl Serialize for InstrumentMeta
impl Serialize for InstrumentMeta
impl StructuralPartialEq for InstrumentMeta
Auto Trait Implementations§
impl Freeze for InstrumentMeta
impl RefUnwindSafe for InstrumentMeta
impl Send for InstrumentMeta
impl Sync for InstrumentMeta
impl Unpin for InstrumentMeta
impl UnsafeUnpin for InstrumentMeta
impl UnwindSafe for InstrumentMeta
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