To add additional datafeeds into Cerebro using CCXTStore, you can use the adddata method of the Cerebro object. This method takes a data parameter, which can be an instance of the CCXTStore class configured with the desired exchange and timeframes.
For example:
import backtrader as bt
from backtrader_ccxt.ccxtstore import CCXTStore
# create an instance of the CCXTStore class
store = CCXTStore(exchange='binance', timeframe=bt.TimeFrame.Minutes, compression=1)
# create an instance of the Cerebro class
cerebro = bt.Cerebro()
# add the datafeed to Cerebro
cerebro.adddata(store)
# run the strategy
cerebro.run()
To add multiple timeframes, you can simply create additional instances of the CCXTStore class with different timeframes and add them to the Cerebro object using the adddata method.
For example:
import backtrader as bt
from backtrader_ccxt.ccxtstore import CCXTStore
# create an instance of the CCXTStore class for the 1-minute timeframe
store1min = CCXTStore(exchange='binance', timeframe=bt.TimeFrame.Minutes, compression=1)
# create an instance of the CCXTStore class for the 5-minute timeframe
store5min = CCXTStore(exchange='binance', timeframe=bt.TimeFrame.Minutes, compression=5)
# create an instance of the CCXTStore class for the 1-hour timeframe
store1hour = CCXTStore(exchange='binance', timeframe=bt.TimeFrame.Hours, compression=1)
# create an instance of the Cerebro class
cerebro = bt.Cerebro()
# add the datafeeds to Cerebro
cerebro.adddata(store1min)
cerebro.adddata(store5min)
cerebro.adddata(store1hour)
# run the strategy
cerebro.run()