Re-sample of Oanda demo live data
john last edited by john
I am testing Backtrader with the Oanda demo live streaming data. I can receive the tick data & aggregate the data in minute time frame (I can see the data0 with OHLC in the log every minute).
I am trying to work on some indicators like RSI, and I can generate the RSI (14 period) using the 1-min data.
Now I try to generate the RSI using 5-min data by applying "compression = 5" for re-sampling, but the data0 is now produced every 5 minutes.
I want to have the data0 generated every minute while to calculate the RSI with 5-min data. How can I do that?
That's not resampling, that's replaying, because you replay your target until you get to the final target.
If you are using the live stream you have to:
- resample to 1 minute
- replay the resampled data to 5 minutes
Something like this
data = oandastore.getdata(...) data1 = cerebro.resampledata(data, timeframe=bt.TimeFrame.Minutes, compression=1) data2 = cerebro.replaydata(data1, timeframe=bt.TimeFrame.Minutes, compression=5)
This of course adds automatically 2 data feeds to the system: the resampled and the replayed. Take it into account when addressing the data.
Note: probably never tried before.