Skip to main content

trade_delta

Function trade_delta 

Source
pub fn trade_delta(
    footprint: &Footprint,
    bars: &[Bar],
    rolling: usize,
    reset: impl Fn(usize, &Bar) -> bool,
) -> Vec<TradeDeltaValue>
Expand description

Computes one value per supplied bar, with zero delta for bars without executions.

reset(i, bar) marks the start of a host-defined session or period; the first bar always starts at zero. Rolling totals cover the last rolling.max(1) displayed bars and continue across resets. Size filtering belongs to Footprint::set_size_filter, before aggregation. Bars must be chronological, one per slot of the footprint’s clock. A timestamp inside the slot is accepted, as in the feed history contract. Historical coverage is exactly the supplied executions; missing trades are never estimated.