Hi all.
This is example zipline algo running on daily bias in live mode.
def initialize(context):
algo.schedule_function(rebalance, algo.date_rules.every_day(), algo.time_rules.market_open())
def rebalance(context, data):
context.testvar += 1
def before_trading_start(context, data):
context.testvar = 0
The problem is that the value of context.testvar is saved to jobfile incorrectly.
After the first run, it should be 1, then 2, and so on. But no matter how many times the algorithm is run when viewing joblib file, is always equal to zero. I have tried declaring context variables in initialize. This doesn't help either. Shouldn't all context variables be preloaded from joblib file? Or am I doing something wrong?
import joblib
joblib.load('./zipline/test3.DU123456.context.joblib')
{'testvar': 0}
Thanks in advance for help.