Closed fanchangyong closed 7 years ago
Thanks @fanchangyong . We're working to publish a release which should fix this.
I'm having the same issue.
# python
Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import zipline
>>> zipline.__version__
u'1.0.1+3.g8f0b3f4'
>>>
# zipline ingest
Downloading Bundle: quantopian-quandl [####################################] 100%
Writing data to /Users/js/.zipline/data/quantopian-quandl/2016-09-06T22;59;00.020386.
# zipline run -f /usr/local/lib/python2.7/site-packages/zipline/examples/buyapple.py --start 2000-1-1 --end 2015-1-1 -o buyapple_out.pickle
Traceback (most recent call last):
File "/Users/js/bin/zipline", line 9, in <module>
load_entry_point('zipline==1.0.1+3.g8f0b3f4', 'console_scripts', 'zipline')()
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zipline/__main__.py", line 97, in _
return f(*args, **kwargs)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zipline/__main__.py", line 240, in run
environ=os.environ,
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zipline/utils/run_algo.py", line 140, in _run
bundle_data.adjustment_reader,
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zipline/pipeline/loaders/equity_pricing_loader.py", line 42, in __init__
self._calendar = self.raw_price_loader._calendar
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zipline/utils/memoize.py", line 53, in __get__
self._cache[instance] = val = self._get(instance)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zipline/data/us_equity_pricing.py", line 476, in _calendar
return DatetimeIndex(self._table.attrs['calendar'], tz='UTC')
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bcolz/attrs.py", line 95, in __getitem__
return self.attrs[name]
KeyError: 'calendar'
Same issue here as well:
Python version:
$ python
Python 2.7.12 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:42:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
Zipline version:
u'1.0.1+2.g85327d8'
Traceback:
$ python -m zipline run -f anaconda2/lib/python2.7/site-packages/zipline/examples/buyapple.py --start 2000-1-1 --end 2014-1-1 -o buyapple_out.pickle
[2016-09-07 13:12:07.236224] INFO: Loader: Cache at /home/nazariy/.zipline/data/^GSPC_benchmark.csv does not have data from 1990-01-02 00:00:00+00:00 to 2016-09-02 00:00:00+00:00.
Downloading benchmark data for '^GSPC'.
Traceback (most recent call last):
File "/home/nazariy/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/home/nazariy/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/__main__.py", line 371, in <module>
main()
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/__main__.py", line 97, in _
return f(*args, **kwargs)
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/__main__.py", line 240, in run
environ=os.environ,
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/utils/run_algo.py", line 140, in _run
bundle_data.adjustment_reader,
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/pipeline/loaders/equity_pricing_loader.py", line 42, in __init__
self._calendar = self.raw_price_loader._calendar
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/utils/memoize.py", line 53, in __get__
self._cache[instance] = val = self._get(instance)
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/data/us_equity_pricing.py", line 476, in _calendar
return DatetimeIndex(self._table.attrs['calendar'], tz='UTC')
File "/home/nazariy/anaconda2/lib/python2.7/site-packages/bcolz/attrs.py", line 95, in __getitem__
return self.attrs[name]
KeyError: 'calendar'
For an update. Actively working on releasing 1.0.2. There is currently a tag and download available here https://github.com/quantopian/zipline/releases/tag/1.0.2 Currently working on getting the release to pypi.
On Wed, Sep 7, 2016 at 9:16 AM Nazariy notifications@github.com wrote:
Same issue here as well:
Python version:
$ python Python 2.7.12 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:42:40) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org
Zipline version:
u'1.0.1+2.g85327d8'
Traceback:
$ python -m zipline run -f anaconda2/lib/python2.7/site-packages/zipline/examples/buyapple.py --start 2000-1-1 --end 2014-1-1 -o buyapple_out.pickle [2016-09-07 13:12:07.236224] INFO: Loader: Cache at /home/nazariy/.zipline/data/^GSPC_benchmark.csv does not have data from 1990-01-02 00:00:00+00:00 to 2016-09-02 00:00:00+00:00. Downloading benchmark data for '^GSPC'. Traceback (most recent call last): File "/home/nazariy/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/home/nazariy/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/main.py", line 371, in
main() File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 716, in call return self.main(_args, _kwargs) File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, _ctx.params) File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/core.py", line 534, in invoke return callback(args, **kwargs) File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/main.py", line 97, in return f(_args, _kwargs) File "/home/nazariy/anaconda2/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), _args, _kwargs) File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/main.py", line 240, in run environ=os.environ, File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/utils/run_algo.py", line 140, in _run bundle_data.adjustment_reader, File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/pipeline/loaders/equity_pricing_loader.py", line 42, in init self._calendar = self.raw_price_loader._calendar File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/utils/memoize.py", line 53, in get self._cache[instance] = val = self._get(instance) File "/home/nazariy/anaconda2/lib/python2.7/site-packages/zipline/data/us_equity_pricing.py", line 476, in _calendar return DatetimeIndex(self._table.attrs['calendar'], tz='UTC') File "/home/nazariy/anaconda2/lib/python2.7/site-packages/bcolz/attrs.py", line 95, in getitem return self.attrs[name] KeyError: 'calendar' — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/quantopian/zipline/issues/1461#issuecomment-245276705, or mute the thread https://github.com/notifications/unsubscribe-auth/AALVkHe8LznmuLAOk2k9If6qx-AQyaUNks5qnrk9gaJpZM4Jzddu .
FYI, I uninstalled zipline from conda, cloned the repo, and used setup.py to install with the latest commit. Since conda had already installed all the dependencies, using setup.py was very straightforward. And it works now. :)
# python
Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import zipline
>>> zipline.__version__
u'1.0.2'
>>>
# zipline run -f zipline/zipline/examples/buyapple.py --start 2012-1-1 --end 2016-1-1 -o buyapple_out.pickle
[2016-09-07 19:49:28.922342] INFO: Performance: after split: sid: Equity(2684 [AAPL]), amount: 42630.0, cost_basis: 75.65, last_sale_price: 645.57
[2016-09-07 19:49:28.922490] INFO: Performance: returning cash: 0.0
[2016-09-07 19:49:32.273060] INFO: Performance: Simulated 1006 trading days out of 1006.
[2016-09-07 19:49:32.273221] INFO: Performance: first open: 2012-01-03 14:31:00+00:00
[2016-09-07 19:49:32.273308] INFO: Performance: last close: 2015-12-31 21:00:00+00:00
<displaying graphics here>
1.0.2 should now be available on PyPI, https://pypi.python.org/pypi/zipline/1.0.2 Anaconda should have 1.0.2 by the end of day.
Release 1.0.2
is now available via conda
. https://anaconda.org/quantopian/zipline
Hello, I am a new user to zipline. I installed it by pip, and I found it's version is
1.0.1
by following code:then, I copy the code from the
Quickstart
page, and run with the corresponding command:zipline run -f dual_moving_average.py --start 2011-1-1 --end 2012-1-1 -o dma.pickle
then, it raised an error:
I have read the code, it seems that the code I've installed with pip is not compatible with the latest data bundle format. The incompatible code is added with the following commit: https://github.com/quantopian/zipline/commit/5a0f8409172adea5d3bf5e32913f0c9a72845389#diff-bd2429cc65fd41a1669bbdf31c6af6a6L477
The reason this exception occur is that the latest data bundle has replaced the
calendar
attribute with other new attributes, so the old code is not compatible with the data format.So, how often do you update the pip installation? And, how could I run the latest code cloned from github locally?
Thank you!