pub trait BarAggregator: Any + Debug {
Show 16 methods
// Required methods
fn bar_type(&self) -> BarType;
fn is_running(&self) -> bool;
fn set_is_running(&mut self, value: bool);
fn update(&mut self, price: Price, size: Quantity, ts_init: UnixNanos);
fn update_bar(&mut self, bar: Bar, volume: Quantity, ts_init: UnixNanos);
// Provided methods
fn handle_quote(&mut self, quote: QuoteTick) { ... }
fn handle_trade(&mut self, trade: TradeTick) { ... }
fn handle_bar(&mut self, bar: Bar) { ... }
fn stop(&mut self) { ... }
fn set_historical_mode(
&mut self,
_historical_mode: bool,
_handler: Box<dyn FnMut(Bar)>,
) { ... }
fn set_historical_events(&mut self, _events: Vec<TimeEvent>) { ... }
fn set_clock(&mut self, _clock: Rc<RefCell<dyn Clock>>) { ... }
fn build_bar(&mut self, _event: &TimeEvent) { ... }
fn start_timer(
&mut self,
_aggregator_rc: Option<Rc<RefCell<Box<dyn BarAggregator>>>>,
) { ... }
fn set_aggregator_weak(
&mut self,
_weak: Weak<RefCell<Box<dyn BarAggregator>>>,
) { ... }
fn set_adjustment(
&mut self,
_adjustment: Decimal,
_mode: ContinuousFutureAdjustmentType,
) { ... }
}Expand description
Trait for aggregating incoming price and trade events into time-, tick-, volume-, or value-based bars.
Implementors receive updates and produce completed bars via handlers.
Required Methods§
Sourcefn is_running(&self) -> bool
fn is_running(&self) -> bool
If the aggregator is running and will receive data from the message bus.
Sourcefn 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).
Sourcefn update(&mut self, price: Price, size: Quantity, ts_init: UnixNanos)
fn update(&mut self, price: Price, size: Quantity, ts_init: UnixNanos)
Updates the aggregator with the given price and size.
fn update_bar(&mut self, bar: Bar, volume: Quantity, ts_init: UnixNanos)
Provided Methods§
Sourcefn handle_quote(&mut self, quote: QuoteTick)
fn handle_quote(&mut self, quote: QuoteTick)
Updates the aggregator with the given quote.
Sourcefn handle_trade(&mut self, trade: TradeTick)
fn handle_trade(&mut self, trade: TradeTick)
Updates the aggregator with the given trade.
Sourcefn handle_bar(&mut self, bar: Bar)
fn handle_bar(&mut self, bar: Bar)
Updates the aggregator with the given bar.
Sourcefn 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 and the handler used for completed bars.
Sourcefn 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)
Sourcefn 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)
Sourcefn 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)
Sourcefn 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.
Sourcefn 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.
Sourcefn set_adjustment(
&mut self,
_adjustment: Decimal,
_mode: ContinuousFutureAdjustmentType,
)
fn set_adjustment( &mut self, _adjustment: Decimal, _mode: ContinuousFutureAdjustmentType, )
Configures the continuous-future price adjustment for the underlying builder.
Implementations§
Source§impl dyn BarAggregator
impl dyn BarAggregator
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".