pub struct PeriodMidpointTracker { /* private fields */ }Expand description
Tracks period open/high/low/close on a configurable Timeframe and yields the prior
(confirmed) period’s midpoint once a new period starts.
Implementations§
Source§impl PeriodMidpointTracker
impl PeriodMidpointTracker
pub fn new(period_tf: Timeframe) -> Result<Self, TimeframeError>
pub fn with_utc_offset( period_tf: Timeframe, utc_offset_seconds: i32, ) -> Result<Self, TimeframeError>
pub fn reset(&mut self)
Sourcepub fn on_bar(&mut self, bar: &Bar) -> Option<PriceLevel>
pub fn on_bar(&mut self, bar: &Bar) -> Option<PriceLevel>
Returns Some(midpoint) only on the bar that closes a period (the same “confirmed value
becomes available one bar later” convention as crate::timeframe::BarResampler).
Auto Trait Implementations§
impl Freeze for PeriodMidpointTracker
impl RefUnwindSafe for PeriodMidpointTracker
impl Send for PeriodMidpointTracker
impl Sync for PeriodMidpointTracker
impl Unpin for PeriodMidpointTracker
impl UnsafeUnpin for PeriodMidpointTracker
impl UnwindSafe for PeriodMidpointTracker
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