Aggregate raw ticks into OHLC bars
You have timestamped trade prints in time order and want to resample them into fixed-width OHLC bars: for each interval, record the first price (open), the maximum (high), the minimum (low), and the last price (close).
ticks = [(0,10), (1,12), (2,9), (5,11), (6,14)], interval = 5
-> [(0, 10, 12, 9, 9), # bucket [0,5): prices 10,12,9
(5, 11, 14, 11, 14)] # bucket [5,10): prices 11,14
Return one (bucket_start, open, high, low, close) tuple per non-empty interval.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.