As the title explains, there's a numpy warning in the algorithm log. Strangely, it seems that it's being thrown outside of the main function (my_rebalance
).
Start backtest from 01/15/2007 onwards.
from zipline.api import continuous_future, schedule_function
from zipline.api import time_rules, date_rules, record
def initialize(context):
schedule_function(my_rebalance, date_rules.every_day(), time_rules.market_open(minutes=30))
def my_rebalance(context, data):
log.info("entering rebalance")
s = 'SY'
f = continuous_future(s, offset=0, roll='volume', adjustment='mul')
data.history(f,
['open','high','low'],
100,
'1d')[:-1]
log.info("exiting re-balance")
Log:
2007-01-15 12:00 my_rebalance:8 INFO entering rebalance
2007-01-15 12:00 my_rebalance:19 INFO exiting re-balance
2007-01-15 12:00 WARN numpy/lib/nanfunctions.py:326: RuntimeWarning: All-NaN slice encountered
2007-01-15 12:00 WARN numpy/lib/nanfunctions.py:227: RuntimeWarning: All-NaN axis encountered
2007-01-16 12:00 my_rebalance:8 INFO entering rebalance
2007-01-16 12:00 my_rebalance:19 INFO exiting re-balance
2007-01-17 12:00 my_rebalance:8 INFO entering rebalance
2007-01-17 12:00 my_rebalance:19 INFO exiting re-balance