pub fn aggregate_trades(
trades: &[Tick],
clock: impl Into<BarClock>,
) -> Result<Vec<Bar>, FeedError>Expand description
Rebuilds bars from chronological executions using the live sink’s aggregation rules.
Count intervals start at the first accepted trade in trades; retain that grouping anchor
when joining history to live data. Duplicate ids are ignored. Invalid or late trades and
overflowing volumes return an error. Periods without executions are omitted.
use egui_charts::data::aggregate_trades;
use egui_charts::model::Tick;
use chrono::Utc;
let trades = vec![Tick::new(Utc::now(), 100.0, 2.0, None)];
let bars = aggregate_trades(&trades, "10t".parse::<egui_charts::model::Timeframe>().unwrap()).unwrap();
assert_eq!(bars[0].volume, 2.0);