I need to aggregate data for a higher time frame. I have data for 1 min time frame as follows

Time   Min Max
15:00  9   31
15:01  7   19
15:02  7   19
15:03  8   17
15:04  8   22
15:05  4   25

and need producing data for 5 min frame. My approach is to take 5 previous records inclusively starting from 15:05 and calculate min/max withing that bucket, is that how they do it?

My Result for 5 min frame:

Time   Min Max
15:05  4    25

Can anyone confirm if this is the correct way of aggregating data?


1 Answer 1


The actual term for this is downsampling. If you are trying to take 1-minute bar data and create 5-min bar data there are a few rules you should follow.

  1. The bar name is where it starts, not where it ends. The bar in your example should be called the 15:00 bar, not the 15:05 bar.
  2. It should not include the 15:05 1-minute bar. The bar should start at 15:00 and end at 15:04 (the 15:04 1-minute bar ends at 15:04:59).

The min and max in your example are 4 and 25. Your 15:00 bar should have a min and max of 7 and 31, respectively. Your 15:05 bar would currently have a min and max of 4 and 25, respectively, however, you need to add in the remaining 4 minutes to create that bar (bars 15:06 - 15:09).

  • $\begingroup$ that's all about conventions $\endgroup$ Oct 12, 2019 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.