@backtrader said in Question on resampledata with 1min data to 60 mins:
The easiest to would be to substract 15 minutes to all your timestamps with a filter and then resample.
Playing around more with different resample mintues,
15 mins setup
cerebro.resampledata(data, timeframe=bt.TimeFrame.Minutes, compression=15)
result:
2019-02-26 09:30:00, 10794.00,10843.45,10789.55,10805.00,1605225
2019-02-26 09:45:00, 10805.30,10807.30,10775.05,10782.00,912975
2019-02-26 10:00:00, 10782.00,10786.25,10761.00,10764.80,825375
.
.
.
2019-02-26 15:00:00, 10878.05,10879.90,10817.00,10834.90,822975
2019-02-26 15:15:00, 10833.20,10844.00,10823.00,10829.00,563325
2019-02-26 15:30:00, 10828.05,10835.90,10821.85,10822.00,849300
30 mins setup
cerebro.resampledata(data, timeframe=bt.TimeFrame.Minutes, compression=30)
result:
2019-02-26 09:30:00, 10794.00,10843.45,10789.55,10805.00,1605225
2019-02-26 10:00:00, 10805.30,10807.30,10761.00,10764.80,1738350
2019-02-26 10:30:00, 10764.45,10777.35,10725.20,10775.20,2370375
.
.
.
2019-02-26 14:30:00, 10849.90,10866.00,10837.05,10864.75,931950
2019-02-26 15:00:00, 10865.80,10892.80,10817.00,10834.90,1656675
2019-02-26 15:30:00, 10833.20,10844.00,10821.85,10822.00,1412625
60 mins setup
cerebro.resampledata(data, timeframe=bt.TimeFrame.Minutes, compression=60)
result:
2019-02-26 10:00:00, 10794.00,10843.45,10761.00,10764.80,3343575
2019-02-26 11:00:00, 10764.45,10806.35,10725.20,10794.85,3613125
2019-02-26 12:00:00, 10793.00,10847.05,10792.75,10827.85,2194800
2019-02-26 13:00:00, 10828.00,10874.00,10815.75,10853.10,1884750
2019-02-26 14:00:00, 10851.15,10862.00,10827.00,10849.90,1200000
2019-02-26 15:00:00, 10849.90,10892.80,10817.00,10834.90,2588625
2019-02-26 15:30:00, 10833.20,10844.00,10821.85,10822.00,1412625
As per my findings, It's working fine for 5, 10, 15 mins!
It's not working for 30 mins and 60 mins.
When I says not working, first bar in 60 mins should be 10:15, instead of 10, and for 30 mins, first bar to be 9:45.
I'll dig into the code as well.