History is feeding on the universe rather than what's in data, maybe the warning could simply be suppressed.
Happens with certain stocks only in combination with others,
newer stocks when backtests include before they were listed.
More code to reproduce the error below, use 2013-09-11 to 2013-09-13 for example
(or same dates using SHOP, SHAK, BABA etc or any recent IPO instead of DBAP)
def initialize(context):
set_symbol_lookup_date('2015-06-01')
context.stocks_tech = symbols('TSLA')
context.stocks_bank = symbols('JPM', 'BAC')
context.stocks_hedg = symbols('DBAP') # comment this and the problem disappears
# yet this line by itself won't produce the error.
def handle_data(context, data):
history(3, '1d', 'high') # RuntimeWarning: All-NaN slice
history(3, '1d', 'low') # RuntimeWarning: All-NaN axis
history(3, '1d', 'price')
2013-05-01null:nullWARNnumpy/lib/nanfunctions.py:319: RuntimeWarning: All-NaN slice encountered
2013-05-01null:nullWARNnumpy/lib/nanfunctions.py:220: RuntimeWarning: All-NaN axis encountered
(High and low are used for stochastics indicator in this instance)