Build hourly OHLCV from one-minute candles
Group by half-open UTC intervals. The 12:00 hour contains minute starts from 12:00 through 12:59. The row at 13:00 starts the next hour. Within the hour, take the earliest open, largest high, smallest low, final close and sum of minute volumes.
Verify the aggregation on three minutes
| Start UTC | Open | High | Low | Close | Volume |
|---|---|---|---|---|---|
| 12:00 | 100 | 103 | 99 | 102 | 2 |
| 12:01 | 102 | 104 | 101 | 103 | 3 |
| 12:02 | 103 | 105 | 99 | 100 | 1 |
These rows aggregate to O=100, H=105, L=99, C=100 and V=6 over three minutes. They describe an incomplete hour. For a complete hour on a continuous market, check for 60 distinct, aligned closed minutes before publishing that row. Decide how to represent documented empty minutes and unexpected gaps.
Make availability explicit
Timestamp the hourly candle at 12:00 if the downstream format uses interval starts. Set its availability to 13:00 plus any feed delay. A signal at 12:30 can use only already completed input data. Apply the same procedure to four-hour aggregation with a documented UTC anchor, such as 00:00, 04:00 and 08:00.
For irregular sessions, use the venue calendar and handle short final buckets explicitly. Validate the OHLC bounds and compare a sample against the provider’s native higher interval when its definition matches. Find missing candles in OHLCV.