pub struct BarBuilder { /* private fields */ }
Expand description
Provides a generic bar builder for aggregation.
Implementations§
Source§impl BarBuilder
impl BarBuilder
Sourcepub fn new(bar_type: BarType, price_precision: u8, size_precision: u8) -> Self
pub fn new(bar_type: BarType, price_precision: u8, size_precision: u8) -> Self
Creates a new BarBuilder
instance.
§Panics
This function panics if:
instrument.id
is not equal to thebar_type.instrument_id
.bar_type.aggregation_source
is not equal toAggregationSource::Internal
.
Sourcepub fn set_partial(&mut self, partial_bar: Bar)
pub fn set_partial(&mut self, partial_bar: Bar)
Set the initial values for a partially completed bar.
§Panics
Panics if internal values for high
or low
are unexpectedly missing.
Sourcepub fn update(&mut self, price: Price, size: Quantity, ts_event: UnixNanos)
pub fn update(&mut self, price: Price, size: Quantity, ts_event: UnixNanos)
Updates the builder state with the given price, size, and event timestamp.
§Panics
Panics if high
or low
values are unexpectedly None
when updating.
Sourcepub fn update_bar(&mut self, bar: Bar, volume: Quantity, ts_init: UnixNanos)
pub fn update_bar(&mut self, bar: Bar, volume: Quantity, ts_init: UnixNanos)
Updates the builder state with a completed bar, its volume, and the bar init timestamp.
§Panics
Panics if high
or low
values are unexpectedly None
when updating.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BarBuilder
impl RefUnwindSafe for BarBuilder
impl Send for BarBuilder
impl Sync for BarBuilder
impl Unpin for BarBuilder
impl UnwindSafe for BarBuilder
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