pub struct VolumeBarAggregator { /* private fields */ }Expand description
Provides a means of building volume bars aggregated from quote and trades.
Implementations§
Source§impl VolumeBarAggregator
impl VolumeBarAggregator
Sourcepub fn new<H: FnMut(Bar) + 'static>(
bar_type: BarType,
price_precision: u8,
size_precision: u8,
handler: H,
) -> Self
pub fn new<H: FnMut(Bar) + 'static>( bar_type: BarType, price_precision: u8, size_precision: u8, handler: H, ) -> Self
Creates a new VolumeBarAggregator instance.
§Panics
This function panics if:
instrument.idis not equal to thebar_type.instrument_id.bar_type.aggregation_sourceis not equal toAggregationSource::Internal.
Trait Implementations§
Source§impl BarAggregator for VolumeBarAggregator
impl BarAggregator for VolumeBarAggregator
Source§fn update(&mut self, price: Price, size: Quantity, ts_init: UnixNanos)
fn update(&mut self, price: Price, size: Quantity, ts_init: UnixNanos)
Apply the given update to the aggregator.
Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
If the aggregator is running and will receive data from the message bus.
Source§fn set_is_running(&mut self, value: bool)
fn set_is_running(&mut self, value: bool)
Sets the running state of the aggregator (receiving updates when
true).fn update_bar(&mut self, bar: Bar, volume: Quantity, ts_init: UnixNanos)
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.
Source§fn handle_bar(&mut self, bar: Bar)
fn handle_bar(&mut self, bar: Bar)
Updates the aggregator with the given bar.
Source§fn set_historical_mode(
&mut self,
_historical_mode: bool,
_handler: Box<dyn FnMut(Bar)>,
)
fn set_historical_mode( &mut self, _historical_mode: bool, _handler: Box<dyn FnMut(Bar)>, )
Sets historical mode (default implementation does nothing, TimeBarAggregator overrides)
Source§fn set_historical_events(&mut self, _events: Vec<TimeEvent>)
fn set_historical_events(&mut self, _events: Vec<TimeEvent>)
Sets historical events (default implementation does nothing, TimeBarAggregator overrides)
Source§fn set_clock(&mut self, _clock: Rc<RefCell<dyn Clock>>)
fn set_clock(&mut self, _clock: Rc<RefCell<dyn Clock>>)
Sets clock for time bar aggregators (default implementation does nothing, TimeBarAggregator overrides)
Source§fn build_bar(&mut self, _event: TimeEvent)
fn build_bar(&mut self, _event: TimeEvent)
Builds a bar from a time event (default implementation does nothing, TimeBarAggregator overrides)
Source§fn start_timer(
&mut self,
_aggregator_rc: Option<Rc<RefCell<Box<dyn BarAggregator>>>>,
)
fn start_timer( &mut self, _aggregator_rc: Option<Rc<RefCell<Box<dyn BarAggregator>>>>, )
Starts the timer for time bar aggregators.
Default implementation does nothing, TimeBarAggregator overrides.
Takes an optional Rc to create weak reference internally.
Source§fn set_aggregator_weak(&mut self, _weak: Weak<RefCell<Box<dyn BarAggregator>>>)
fn set_aggregator_weak(&mut self, _weak: Weak<RefCell<Box<dyn BarAggregator>>>)
Sets the weak reference to the aggregator wrapper (for historical mode).
Default implementation does nothing, TimeBarAggregator overrides.
Auto Trait Implementations§
impl Freeze for VolumeBarAggregator
impl !RefUnwindSafe for VolumeBarAggregator
impl !Send for VolumeBarAggregator
impl !Sync for VolumeBarAggregator
impl Unpin for VolumeBarAggregator
impl !UnwindSafe for VolumeBarAggregator
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