Standard code: from tutorials
data = get_pricing(
stocks_in_sp500,
start_date='2003-08-01',
end_date = today,
frequency='daily'
)
algo = TradingAlgorithm(initialize=initialize,
handle_data=handle_data)
results = algo.run(data['price'])
The problem: Survivors Bias (if stocks_in_sp500 = sp500 as of today), due to the fact that the group of securities (stocks_in_sp500) is set for the entirety of the algo.run()
My questions: How can i update stocks_in_sp500 while my algo is running?