Given a large dataset of tick-level trades, how would you design a program to aggregate this into 5-minute OHLCV bars?