order_value(stock,rebalance_budget) #error when ordering certain stocks which expire soon, need to look into this
KeyError: Security(14868, symbol='BETM', security_name='AMERICAN WAGERING INC', exchange='NASDAQ GLOBAL MARKET', start_date=Timestamp('1996-05-10 00:00:00+0000', tz='UTC'), end_date=Timestamp('2006-03-30 00:00:00+0000', tz='UTC'), first_traded=None)
run this in the debugger: order_value(sid(14868),1) or this data[sid(14868)].price both fail
i get the same error if try to do order_target_percent. The only time i don`t get the error is when i use order(stock,1)
I am running the test between 2002 and 2015, this occurs at the very beginning when the date is 2002-01-03
Any ideas ?
If I implement some logic to deal with the stocks which have end_dates isn`t that a bias toward the future?
How will this work in a live trading environment, will it crash the algorithm when stocks are being taken of the market ?
Many thanks,