pub struct TimeBarAggregator<C, H>where
C: Clock,
H: FnMut(Bar),{ /* private fields */ }
Expand description
Provides a means of building time bars aggregated from quote and trades.
At each aggregation time interval, a bar is created and sent to the handler.
Implementations§
Source§impl<C, H> TimeBarAggregator<C, H>where
C: Clock + 'static,
H: FnMut(Bar) + 'static,
impl<C, H> TimeBarAggregator<C, H>where
C: Clock + 'static,
H: FnMut(Bar) + 'static,
Sourcepub fn new(
instrument: &InstrumentAny,
bar_type: BarType,
handler: H,
await_partial: bool,
clock: C,
build_with_no_updates: bool,
timestamp_on_close: bool,
interval_type: &str,
) -> Self
pub fn new( instrument: &InstrumentAny, bar_type: BarType, handler: H, await_partial: bool, clock: C, build_with_no_updates: bool, timestamp_on_close: bool, interval_type: &str, ) -> Self
Creates a new TimeBarAggregator
instance.
§Panics
This function panics:
- If
instrument.id
is not equal to thebar_type.instrument_id
. - If
bar_type.aggregation_source
is not equal toAggregationSource::Internal
.
Sourcepub fn start(&mut self, callback: NewBarCallback<C, H>) -> Result<()>
pub fn start(&mut self, callback: NewBarCallback<C, H>) -> Result<()>
Starts the time bar aggregator.
Trait Implementations§
Source§impl<C, H> BarAggregator for TimeBarAggregator<C, H>where
C: Clock,
H: FnMut(Bar),
impl<C, H> BarAggregator for TimeBarAggregator<C, H>where
C: Clock,
H: FnMut(Bar),
Source§fn update(&mut self, price: Price, size: Quantity, ts_event: UnixNanos)
fn update(&mut self, price: Price, size: Quantity, ts_event: UnixNanos)
Updates theaggregator with the given price and size.
Source§fn handle_quote(&mut self, quote: QuoteTick)
fn handle_quote(&mut self, quote: QuoteTick)
Updates the aggregator with the given quote.
Source§fn handle_trade(&mut self, trade: TradeTick)
fn handle_trade(&mut self, trade: TradeTick)
Updates the aggregator with the given trade.
Auto Trait Implementations§
impl<C, H> Freeze for TimeBarAggregator<C, H>
impl<C, H> RefUnwindSafe for TimeBarAggregator<C, H>where
C: RefUnwindSafe,
H: RefUnwindSafe,
impl<C, H> Send for TimeBarAggregator<C, H>
impl<C, H> Sync for TimeBarAggregator<C, H>
impl<C, H> Unpin for TimeBarAggregator<C, H>
impl<C, H> UnwindSafe for TimeBarAggregator<C, H>where
C: UnwindSafe,
H: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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