Update:
Okay, I have solved it. I found this article detailing a bit about the matter: https://www.backtrader.com/blog/posts/2016-04-19-sync-different-markets/sync-different-markets/
However, I did not really like the possible solutions so I solved it like that:
...
datamaster = "VIXY"
universe = ["SPY"]
# add a strategy
cerebro.addstrategy(MultiFeedStrategy)
# synchronize data by dropping all indices that are not present in the datamaster
data_feed_dfs = []
# load datamaster
datamaster_df = pd.read_csv("../../data/{}.csv".format(datamaster), index_col="datetime", parse_dates=True)
datamaster_df = datamaster_df[["open", "high", "low", "close", "volume"]].copy()
data_feed_dfs.append(datamaster_df)
for symbol in universe:
# load data
dataframe = pd.read_csv("../../data/{}.csv".format(symbol), index_col="datetime", parse_dates=True)
dataframe = dataframe[["open", "high", "low", "close", "volume"]].copy()
dataframe = dataframe.loc[dataframe.index.isin(datamaster_df.index)].copy()
data_feed_dfs.append(dataframe)
for data_feed_df in data_feed_dfs:
try:
# convert the dataframe to data feed
data = bt.feeds.PandasData(dataname=data_feed_df, fromdate=fromdate, todate=todate, plot=True)
# add the data feed to cerebro
cerebro.adddata(data, name=symbol)
except Exception as e:
print(e)
# set our desired cash start
cerebro.broker.setcash(100000)
...
Basically I am only selecting timestamps that are also present in the datamaster (i.e. first data feed added to the strategy)
Hope this helps others that run into similar problems. :)
However, I would still appreciate if someone could clarify my questions in the first post.
Best,
nimrare