pub struct BarAggregator { /* private fields */ }Expand description
Accumulates ticks into fixed-duration bars using the replay engine’s bucket rules.
A tick is accepted only when the selected price basis is available, finite, positive, and not crossed, which matches the validity rule the replay feed applies before a quote reaches the engine. An interval with no accepted tick produces no bar, so a weekend gap simply has no bars rather than empty ones.
Input must be chronological. A tick belonging to an already-finished bucket is dropped and counted by BarAggregator::rejected_out_of_order rather than reopening that bucket.
Bars record tick_vol, the number of accepted ticks, and leave volume at zero. The replay engine projects tick counts, not traded size, so a bar carries the same volume fact whether it was built here or in memory.
Implementations§
Source§impl BarAggregator
impl BarAggregator
pub fn new( exchange: impl Into<String>, symbol: impl Into<String>, timeframe: Timeframe, spec: BucketSpec, basis: PriceBasis, point_size: f64, ) -> Self
Sourcepub fn rejected_out_of_order(&self) -> u64
pub fn rejected_out_of_order(&self) -> u64
Ticks dropped because they belonged to an earlier bucket than the one already open.
A chronological source reports zero. A non-zero count means the input was not ordered, which would otherwise reopen a finished bucket and emit bars out of order.
Trait Implementations§
Source§impl Clone for BarAggregator
impl Clone for BarAggregator
Auto Trait Implementations§
impl Freeze for BarAggregator
impl RefUnwindSafe for BarAggregator
impl Send for BarAggregator
impl Sync for BarAggregator
impl Unpin for BarAggregator
impl UnsafeUnpin for BarAggregator
impl UnwindSafe for BarAggregator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more