Dear Zipline Maintainers,
Before I tell you about my issue, let me describe my environment:
Operating System: (Windows Version or $ uname --all)
Python Version: $ python --version
Python Bitness: $ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
How did you install Zipline: (pip, conda, or other (please explain))
Python packages: $ pip freeze or $ conda list
Now that you know a little about me, let me tell you about the issue I am
having:
Downloading WIKI metadata: [####################################]
Traceback (most recent call last):
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/bin/zipline", line 11, in
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/click/core.py", line 722, in __call__ return self.main(args, *kwargs)
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/click/core.py", line 535, in invoke
return callback(args, *kwargs)
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/zipline/__main__.py", line 312, in ingest
show_progress,
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/zipline/data/bundles/core.py", line 451, in ingest
pth.data_path([name, timestr], environ=environ),
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/zipline/data/bundles/quandl.py", line 295, in quandl_bundle
show_progress=show_progress,
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/zipline/data/bundles/quandl.py", line 129, in fetch_symbol_metadata_frame
data['auto_close_date'] = data['end_date'] + pd.Timedelta(days=1)
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/pandas/core/ops.py", line 609, in wrapper
na_op)
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/pandas/core/ops.py", line 569, in maybe_convert_for_time_op
return cls(left, right, name, na_op)
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/pandas/core/ops.py", line 282, in __init__
lvalues = self._convert_to_array(left, name=name)
File "/Users/my/Documents/Python/Virtualenvs/venv-py34-zipline-1.1.0/lib/python3.4/site-packages/pandas/core/ops.py", line 398, in _convert_to_array
if (inferred_type in ('datetime64', 'datetime', 'date', 'time') or
TypeError: data type "datetime" not understood
`
Here is how you can reproduce this issue on your machine:
$ QUANDL_API_KEY="<MY_QUANDL_API_KEY>" zipline ingest -b quandlUsed the alternative default bundle quantopian-quandl
Sincerely,
Sekuri
x-ref https://github.com/quantopian/zipline/issues/1295
Hey @sekuri looks like this has been an issue. Ideally, the next steps are to make zipline/data/bundles/quandl.py use the latest Quandl API so that data is able to be requested properly.
I added this to the bottom of fetch_symbol_metadata_frame in quandl.py. Seems to work.
index = pd.DatetimeIndex(data['end_date'])
data['auto_close_date'] = index + pd.tslib.Timedelta(days=1)
Basically, you can add time offsets to a DatetimeIndex, but columns don't support that. At least, with pandas 0.18. I think it's supported in later versions though.
Elliott
We're using the latest Quandl API in our most recent release (1.2.0). Going to close this but feel free to re-open if you're still having issues or open a new issue 馃檪
Most helpful comment
I added this to the bottom of
fetch_symbol_metadata_framein quandl.py. Seems to work.Basically, you can add time offsets to a DatetimeIndex, but columns don't support that. At least, with pandas 0.18. I think it's supported in later versions though.
Elliott