Struct trade_aggregation::AlignedTimeRule
source · pub struct AlignedTimeRule { /* private fields */ }
Expand description
The classic time based aggregation rule, creating a new candle every n seconds. The time trigger is aligned such that the trigger points are starting from a time equals zero. For example, if the first tick comes in a 1:32:00 on a 5 minute candle, that first candle will only contain 3 minutes of trades, representing a 1:30 start.
Implementations§
source§impl AlignedTimeRule
impl AlignedTimeRule
sourcepub fn new(period_s: i64, ts_res: TimestampResolution) -> Self
pub fn new(period_s: i64, ts_res: TimestampResolution) -> Self
Create a new instance of the aligned time rule, with a given candle period in seconds
§Arguments:
period_s: How many seconds a candle will contain ts_res: The resolution each Trade timestamp will have
sourcepub fn aligned_timestamp(&self, timestamp: i64) -> i64
pub fn aligned_timestamp(&self, timestamp: i64) -> i64
Calculates the “aligned” timestamp, which the rule will use when receiving for determining the trigger. This is done at the initialization of each period.
Trait Implementations§
source§impl<C, T> AggregationRule<C, T> for AlignedTimeRulewhere
C: ModularCandle<T>,
T: TakerTrade,
impl<C, T> AggregationRule<C, T> for AlignedTimeRulewhere
C: ModularCandle<T>,
T: TakerTrade,
source§impl Clone for AlignedTimeRule
impl Clone for AlignedTimeRule
source§fn clone(&self) -> AlignedTimeRule
fn clone(&self) -> AlignedTimeRule
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for AlignedTimeRule
impl RefUnwindSafe for AlignedTimeRule
impl Send for AlignedTimeRule
impl Sync for AlignedTimeRule
impl Unpin for AlignedTimeRule
impl UnwindSafe for AlignedTimeRule
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