My algorithm ran into a KeyError during a backtest and I cannot find the solution.
Here is the log (at May 31, 2011 backtest time):
KeyError: Equity(32043, symbol='QVCB', asset_name='LIBERTY INTERACTIVE CORPORATION QVC GROUP', exchange='NASDAQ GLOBAL SELECT MARKET', start_date=Timestamp('2006-05-10 00:00:00+0000', tz='UTC'), end_date=Timestamp('2015-07-20 00:00:00+0000', tz='UTC'), first_traded=None)
There was a runtime error on line 70.
Here are the lines 69-70:
for stock in weights.index: order_target_percent(stock, weights[stock])
The variable weights is a Series object, weights[sid(32043)] is a positive float.
The universe is set up with a call to get_fundamentals()
Could it be due to a lack of trading activity for that stock on the May 31, 2011 ? Or is it related to the for loop ?
Thanks in advance for your help :-)