Different number of instruments available over time
Federico Bassetto last edited by
I have the following problems, I have 5 different objects in self.datas that start at a different point in times. For example the first three assets start being available on 2001-01-01 and the remaining two start on 2005-01-01. How can I backtest from 2001 to 2010 by allocating the portfolio between three assets first and between five assets later? Until now the backtester either raises an error if I try to backtest let's say between 2001 and 2004, or starts trading on 2005 if the dates I set are 2001 to 2010.
ab_trader last edited by
In order to run strategy from the very beginning of the oldest data feed call strategy logic in both
next()functions. But you need to put some checks if data feed exists in the
Check out Docs - Strategy