pub struct TradeAggregator {
interval_seconds: u64,
current_candle: Option<Candle>,
}Fields§
§interval_seconds: u64§current_candle: Option<Candle>Implementations§
Source§impl TradeAggregator
impl TradeAggregator
pub fn new(interval_seconds: u64) -> Self
pub fn update(&mut self, trade: &Trade)
Sourcepub fn check_flush(&mut self, new_trade_time: f64) -> Option<Candle>
pub fn check_flush(&mut self, new_trade_time: f64) -> Option<Candle>
Checks if the current candle is “done” based on the new time, returning it if so. This is a simplified logic: we return the previous candle if the new time belongs to a later interval.
Auto Trait Implementations§
impl Freeze for TradeAggregator
impl RefUnwindSafe for TradeAggregator
impl Send for TradeAggregator
impl Sync for TradeAggregator
impl Unpin for TradeAggregator
impl UnwindSafe for TradeAggregator
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