pub enum Timeframe {
Seconds(u32),
Minutes(u32),
Hours(u32),
Days(u32),
Weeks(u32),
}Expand description
A timeframe for bar aggregation.
Variants§
Seconds(u32)
Aggregation by N seconds.
Minutes(u32)
Aggregation by N minutes.
Hours(u32)
Aggregation by N hours.
Days(u32)
Aggregation by N days.
Weeks(u32)
Aggregation by N weeks (7-day periods).
Implementations§
Source§impl Timeframe
impl Timeframe
Sourcepub fn to_nanos(&self) -> Result<i64, FinError>
pub fn to_nanos(&self) -> Result<i64, FinError>
Returns the timeframe duration in nanoseconds.
§Errors
Returns FinError::InvalidTimeframe if the duration is zero.
Sourcepub fn bucket_start(&self, ts: NanoTimestamp) -> Result<NanoTimestamp, FinError>
pub fn bucket_start(&self, ts: NanoTimestamp) -> Result<NanoTimestamp, FinError>
Returns the bucket start timestamp for a given tick timestamp.
§Errors
Returns FinError::InvalidTimeframe if the timeframe duration is zero.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Timeframe
impl<'de> Deserialize<'de> for Timeframe
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
impl Copy for Timeframe
Auto Trait Implementations§
impl Freeze for Timeframe
impl RefUnwindSafe for Timeframe
impl Send for Timeframe
impl Sync for Timeframe
impl Unpin for Timeframe
impl UnsafeUnpin for Timeframe
impl UnwindSafe for Timeframe
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