Trait trade_aggregation::Aggregator

source ·
pub trait Aggregator<Candle, T: TakerTrade> {
    // Required methods
    fn update(&mut self, trade: &T) -> Option<Candle>;
    fn unfinished_candle(&self) -> &Candle;
}
Expand description

Defines the needed methods for any online Aggregator

Required Methods§

source

fn update(&mut self, trade: &T) -> Option<Candle>

Updates the aggregation state with a new trade

§Arguments:

trade: the trade information to add to the aggregation process

§Returns:

Some output only when a new candle has been created, otherwise it returns None

source

fn unfinished_candle(&self) -> &Candle

Get a reference to an unfinished Candle. Accessing a Candle using this method does not guarantee that the AggregationRule is respected. It is generally advised to call update instead and use the resulting Candle if its Some.

Implementors§

source§

impl<C, R, T> Aggregator<C, T> for GenericAggregator<C, R, T>
where C: ModularCandle<T>, R: AggregationRule<C, T>, T: TakerTrade,