Skip to main content

resample

Function resample 

Source
pub fn resample(
    candles: &[Candle],
    interval: Interval,
    utc_offset_secs: i64,
) -> Vec<Candle>
Expand description

Resample candles from their base timeframe to interval.

utc_offset_secs shifts each candle’s timestamp into the exchange’s local time before computing calendar bucket boundaries (weekly Monday start, month boundary, etc.). Pass 0 for UTC-aligned bucketing (default for US markets). Use Region::utc_offset_secs to obtain the correct value for non-US exchanges.

§Notes

  • Calendar-aligned intervals (OneWeek, OneMonth, ThreeMonths) respect utc_offset_secs. Weekly bars start on the local Monday.
  • Sub-daily intervals use fixed-second buckets relative to local midnight.