pub struct ValueImbalanceBarAggregator { /* private fields */ }Expand description
Aggregates bars based on buy/sell notional imbalance.
Implementations§
Source§impl ValueImbalanceBarAggregator
impl ValueImbalanceBarAggregator
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 ValueImbalanceBarAggregator 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 ValueImbalanceBarAggregator
impl BarAggregator for ValueImbalanceBarAggregator
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.
Note: side-aware logic lives in handle_trade. This method is used for
quote/bar updates where no aggressor side is available.
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).Source§fn handle_trade(&mut self, trade: TradeTick)
fn handle_trade(&mut self, trade: TradeTick)
Updates the aggregator with the given trade.
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_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 ValueImbalanceBarAggregator
impl !RefUnwindSafe for ValueImbalanceBarAggregator
impl !Send for ValueImbalanceBarAggregator
impl !Sync for ValueImbalanceBarAggregator
impl Unpin for ValueImbalanceBarAggregator
impl !UnwindSafe for ValueImbalanceBarAggregator
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