I'd like to know how to load 2 kind of data such as 'stocks' and 'index' in order to work with Multi-backtesting_ml.
def load_data(period): stocks = qndata.stocks.load_ndx_data(tail=period) index = qndata.index.load_data(tail=period) return stocks, index weights = qnbt.backtest_ml( load_data = load_data, train = train_model, predict = predict_weights, train_period = 15 *365, # the data length for training in calendar days retrain_interval = 1 *365, # how often we have to retrain models (calendar days) retrain_interval_after_submit = 1, # how often retrain models after submission during evaluation (calendar days) predict_each_day = False, # Is it necessary to call prediction for every day during backtesting? # Set it to True if you suspect that get_features is looking forward. competition_type = "stocks_nasdaq100", # competition type lookback_period = 365, # how many calendar days are needed by the predict function to generate the output start_date = "2006-01-01", # backtest start date analyze = True, build_plots = True # do you need the chart? )
What should I do ?