我是一个新手,正在使用zipline
并尝试评估量化投资策略的回测结果。我使用以下方法进行回测:
zipline run -f my_strat.py -s '2009-01-01' -e '2020-06-01' -b my_custom_bundle -o results.csv
然后我创建一个新笔记本并尝试使用以下命令读取相同的结果:
import pandas as pd
df = pd.read_pickle('results.csv')
我得到一个很长的堆栈跟踪以
(...)
/usr/lib/python3.6/pickle.py in load(self)
1048 raise EOFError
1049 assert isinstance(key, bytes_types)
-> 1050 dispatch[key[0]](self)
1051 except _Stop as stopinst:
1052 return stopinst.value
/usr/lib/python3.6/pickle.py in load_stack_global(self)
1345 if type(name) is not str or type(module) is not str:
1346 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1347 self.append(self.find_class(module, name))
1348 dispatch[STACK_GLOBAL[0]] = load_stack_global
1349
~/.local/lib/python3.6/site-packages/pandas/compat/pickle_compat.py in find_class(self, module, name)
115 key = (module, name)
116 module, name = _class_locations_map.get(key, key)
--> 117 return super(Unpickler, self).find_class(module, name)
118
119 else:
/usr/lib/python3.6/pickle.py in find_class(self, module, name)
1386 elif module in _compat_pickle.IMPORT_MAPPING:
1387 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1388 __import__(module, level=0)
1389 if self.proto >= 4:
1390 return _getattribute(sys.modules[module], name)[0]
ModuleNotFoundError: No module named 'zipline.assets.exchange_info'
我的zipline
包版本是1.4.0
. 使用以前的版本zipline
,我能够读取这些数据并对其进行处理,但目前,我什至无法读取它!我在这里想念什么?
更新:它可以在 ipython 控制台中使用,但在 jupyter 笔记本中仍然无法使用。