Skip to content
GetProfitable
Search
Dictionary

Resampling (data)

Converting data from one frequency to another, such as building hourly bars from minute bars. Simple in principle and full of edge cases in practice.

Aggregating upward is straightforward: open of the first, high of the highs, low of the lows, close of the last, sum of the volume. The questions are what timezone boundaries to use, whether a bar is stamped at its start or end, and what to do with intervals containing no trades.

Timestamp convention causes real bugs. If your hourly bar is stamped 10:00 but contains data from 10:00 to 11:00, then a model reading the 10:00 bar to trade at 10:00 is using the next hour's information. Always define whether a stamp means opening or closing time and assert it in code.

Downsampling to a lower frequency also changes the statistics. Volatility does not scale with sqrt(time) exactly, correlations tend to rise at longer horizons, and a signal calibrated on daily bars rarely transfers cleanly to weekly ones without recalibration.

Related: ohlcv-bar, timestamp-alignment, bar-types, look-ahead-bias

Educational only, not advice. Spotted an error? Post in Site Feedback.