The windowing issue
Market data providers often return candles in ranges that are:- aligned to UTC boundaries, or
- bucketed by day/week segments
- off-by-one candles
- missing the exact call candle
- drift across daily/weekly boundaries
Request strategy
OpenKol requests candles using a UTC-aligned anchor and a predictable range:- Round the anchor timestamp to UTC midnight
- For weekly ranges, step in 7-day blocks
- Request candles with explicit timezone handling (UTC)
Trimming to the analysis window
After fetching candles:- Compare each candle timestamp to the call time
- Keep only candles that fall inside the selected analysis window
- Ensure the returned window matches the resolution (5m, 15m, 1h, 4h, 12h, 1d)
Outcome
This approach:- keeps charts anchored to the call timestamp
- prevents drift across daily/weekly ranges
- reduces subtle off-by-one bugs that change ROI or drawdown