Skip to main content

cumulative_net_deposits_per_snapshot

Function cumulative_net_deposits_per_snapshot 

Source
pub(crate) fn cumulative_net_deposits_per_snapshot(
    events: &[DepositEvent],
    snapshot_timestamps_ms: &[i64],
) -> Vec<Decimal>
Expand description

Walk an ordered deposit/withdraw event stream against a snapshot-timestamp stream, returning the cumulative net_deposits at each snapshot. Events with event_ts_ms <= snapshot_ts count toward that snapshot; events with equal timestamps are applied in the order they appear in events.

Pure function, no I/O — kept outside the handler so it’s unit-testable.