pub enum BarTimestamp {
Date(Date),
DateTime(OffsetDateTime),
}Expand description
Timestamp of a historical bar.
Daily (and longer) bars carry only a calendar date (YYYYMMDD on the
wire); intraday bars carry a full UTC datetime (unix seconds on the wire).
BarTimestamp preserves that distinction instead of coercing daily bars to
midnight UTC.
§Examples
use ibapi::market_data::historical::BarTimestamp;
fn format_bar_time(ts: &BarTimestamp) -> String {
match ts {
BarTimestamp::Date(d) => format!("{d}"),
BarTimestamp::DateTime(dt) => {
format!("{:02}:{:02}", dt.hour(), dt.minute())
}
}
}Variants§
Date(Date)
Daily / weekly / monthly bars — only the trading day is meaningful.
DateTime(OffsetDateTime)
Intraday bars — full point-in-time timestamp.
Implementations§
Trait Implementations§
Source§impl Clone for BarTimestamp
impl Clone for BarTimestamp
Source§fn clone(&self) -> BarTimestamp
fn clone(&self) -> BarTimestamp
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 ComposeSchema for BarTimestamp
impl ComposeSchema for BarTimestamp
Source§impl Debug for BarTimestamp
impl Debug for BarTimestamp
Source§impl<'de> Deserialize<'de> for BarTimestamp
impl<'de> Deserialize<'de> for BarTimestamp
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 Display for BarTimestamp
impl Display for BarTimestamp
Source§impl From<Date> for BarTimestamp
impl From<Date> for BarTimestamp
Source§impl From<OffsetDateTime> for BarTimestamp
impl From<OffsetDateTime> for BarTimestamp
Source§fn from(dt: OffsetDateTime) -> Self
fn from(dt: OffsetDateTime) -> Self
Converts to this type from the input type.
Source§impl FromStr for BarTimestamp
impl FromStr for BarTimestamp
Source§impl Ord for BarTimestamp
impl Ord for BarTimestamp
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for BarTimestamp
impl PartialEq for BarTimestamp
Source§fn eq(&self, other: &BarTimestamp) -> bool
fn eq(&self, other: &BarTimestamp) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for BarTimestamp
impl PartialOrd for BarTimestamp
Source§impl Serialize for BarTimestamp
impl Serialize for BarTimestamp
Source§impl ToSchema for BarTimestamp
impl ToSchema for BarTimestamp
impl Copy for BarTimestamp
impl Eq for BarTimestamp
impl StructuralPartialEq for BarTimestamp
Auto Trait Implementations§
impl Freeze for BarTimestamp
impl RefUnwindSafe for BarTimestamp
impl Send for BarTimestamp
impl Sync for BarTimestamp
impl Unpin for BarTimestamp
impl UnsafeUnpin for BarTimestamp
impl UnwindSafe for BarTimestamp
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.