quantopian / zipline

Zipline, a Pythonic Algorithmic Trading Library
https://www.zipline.io
Apache License 2.0
17.67k stars 4.72k forks source link

Error downloading bundle from quandl #2356

Open teeling opened 6 years ago

teeling commented 6 years ago

Hi all, I'm having problems getting started with zipline. I run in to problems as soon as I try to:

zipline ingest -b quandl

* Operating System: MacOS 10.13.6 * Python Version: Python 3.5.4 * Python Bitness: 64 * How did you install Zipline: Through pip in a venv in PyCharm * Python packages: alembic==1.0.2 bcolz==0.12.1 Bottleneck==1.2.1 certifi==2018.10.15 chardet==3.0.4 Click==7.0 contextlib2==0.5.5 cyordereddict==1.0.0 Cython==0.29 decorator==4.3.0 empyrical==0.5.0 idna==2.7 intervaltree==2.1.0 Logbook==1.4.1 lru-dict==1.1.6 lxml==4.2.5 Mako==1.0.7 MarkupSafe==1.0 multipledispatch==0.6.0 networkx==1.11 numexpr==2.6.8 numpy==1.15.3 pandas==0.22.0 (have also tried 0.19.2) pandas-datareader==0.7.0 patsy==0.5.1 python-dateutil==2.7.5 python-editor==1.0.3 pytz==2018.7 requests==2.20.0 requests-file==1.4.3 scipy==1.1.0 setuptools-scm==3.1.0 six==1.11.0 sortedcontainers==2.0.5 SQLAlchemy==1.2.13 statsmodels==0.9.0 tables==3.4.4 toolz==0.9.0 trading-calendars==1.5.0 urllib3==1.24 wrapt==1.10.11 zipline==1.3.0 I've also installed the needed packages from Homebrew: "brew install freetype pkg-config gcc openssl""

I've managed to install zipline and from what I can tell all dependencies. I can run "zipline run --help" as expected. But for some reason I can't run an ingest.

Here is how I can reproduce this issue on my machine:

Reproduction Steps

  1. Fresh install of zipline in a venv in PyCharm.
  2. run "export QUANDL_API_KEY=INSERTMYAPIKEY"
  3. run "zipline ingest -b quandl"

Below is the error dump.

Any ideas?

Thanks! Micke

(venv) Mickes-MBP:zipLineTest teeling$ export QUANDL_API_KEY=INSERTMYAPIKEY (venv) Mickes-MBP:zipLineTest teeling$ zipline ingest -b quandl [2018-11-01 21:48:43.251173] INFO: zipline.data.bundles.quandl: Downloading WIKI metadata. [2018-11-01 21:48:43.348854] ERROR: zipline.data.bundles.quandl: Exception raised reading Quandl data. Retrying. Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1254, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1107, in request self._send_request(method, url, body, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1152, in _send_request self.endheaders(body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1103, in endheaders self._send_output(message_body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1261, in connect server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 385, in wrap_socket _context=self) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 760, in init self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 996, in do_handshake self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 641, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/data/bundles/quandl.py", line 89, in fetch_data_table format_metadata_url(api_key) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 709, in parser_f return _read(filepath_or_buffer, kwds) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 433, in _read filepath_or_buffer, encoding, compression) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/common.py", line 190, in get_filepath_or_buffer req = _urlopen(filepath_or_buffer) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 163, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 466, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 484, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 444, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1297, in https_open context=self._context, check_hostname=self._check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1256, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)> [2018-11-01 21:48:43.355073] INFO: zipline.data.bundles.quandl: Downloading WIKI metadata. [2018-11-01 21:48:43.381369] ERROR: zipline.data.bundles.quandl: Exception raised reading Quandl data. Retrying. Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1254, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1107, in request self._send_request(method, url, body, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1152, in _send_request self.endheaders(body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1103, in endheaders self._send_output(message_body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1261, in connect server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 385, in wrap_socket _context=self) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 760, in init self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 996, in do_handshake self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 641, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/data/bundles/quandl.py", line 89, in fetch_data_table format_metadata_url(api_key) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 709, in parser_f return _read(filepath_or_buffer, kwds) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 433, in _read filepath_or_buffer, encoding, compression) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/common.py", line 190, in get_filepath_or_buffer req = _urlopen(filepath_or_buffer) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 163, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 466, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 484, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 444, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1297, in https_open context=self._context, check_hostname=self._check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1256, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)> [2018-11-01 21:48:43.386729] INFO: zipline.data.bundles.quandl: Downloading WIKI metadata. [2018-11-01 21:48:43.412870] ERROR: zipline.data.bundles.quandl: Exception raised reading Quandl data. Retrying. Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1254, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1107, in request self._send_request(method, url, body, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1152, in _send_request self.endheaders(body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1103, in endheaders self._send_output(message_body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1261, in connect server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 385, in wrap_socket _context=self) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 760, in init self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 996, in do_handshake self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 641, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/data/bundles/quandl.py", line 89, in fetch_data_table format_metadata_url(api_key) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 709, in parser_f return _read(filepath_or_buffer, kwds) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 433, in _read filepath_or_buffer, encoding, compression) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/common.py", line 190, in get_filepath_or_buffer req = _urlopen(filepath_or_buffer) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 163, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 466, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 484, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 444, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1297, in https_open context=self._context, check_hostname=self._check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1256, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)> [2018-11-01 21:48:43.415204] INFO: zipline.data.bundles.quandl: Downloading WIKI metadata. [2018-11-01 21:48:43.444147] ERROR: zipline.data.bundles.quandl: Exception raised reading Quandl data. Retrying. Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1254, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1107, in request self._send_request(method, url, body, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1152, in _send_request self.endheaders(body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1103, in endheaders self._send_output(message_body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1261, in connect server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 385, in wrap_socket _context=self) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 760, in init self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 996, in do_handshake self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 641, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/data/bundles/quandl.py", line 89, in fetch_data_table format_metadata_url(api_key) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 709, in parser_f return _read(filepath_or_buffer, kwds) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 433, in _read filepath_or_buffer, encoding, compression) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/common.py", line 190, in get_filepath_or_buffer req = _urlopen(filepath_or_buffer) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 163, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 466, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 484, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 444, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1297, in https_open context=self._context, check_hostname=self._check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1256, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)> [2018-11-01 21:48:43.446814] INFO: zipline.data.bundles.quandl: Downloading WIKI metadata. [2018-11-01 21:48:43.476286] ERROR: zipline.data.bundles.quandl: Exception raised reading Quandl data. Retrying. Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1254, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1107, in request self._send_request(method, url, body, headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1152, in _send_request self.endheaders(body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1103, in endheaders self._send_output(message_body) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1261, in connect server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 385, in wrap_socket _context=self) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 760, in init self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 996, in do_handshake self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 641, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/data/bundles/quandl.py", line 89, in fetch_data_table format_metadata_url(api_key) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 709, in parser_f return _read(filepath_or_buffer, kwds) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/parsers.py", line 433, in _read filepath_or_buffer, encoding, compression) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/pandas/io/common.py", line 190, in get_filepath_or_buffer req = _urlopen(filepath_or_buffer) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 163, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 466, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 484, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 444, in _call_chain result = func(args) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1297, in https_open context=self._context, check_hostname=self._check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1256, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)> Traceback (most recent call last): File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/bin/zipline", line 11, in load_entry_point('zipline==1.3.0', 'console_scripts', 'zipline')() File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/click/core.py", line 764, in call return self.main(args, kwargs) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/main.py", line 348, in ingest show_progress, File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/data/bundles/core.py", line 451, in ingest pth.data_path([name, timestr], environ=environ), File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/data/bundles/quandl.py", line 209, in quandl_bundle environ.get('QUANDL_DOWNLOAD_ATTEMPTS', 5) File "/Users/teeling/Documents/PythonDev/zipLineTest/venv/lib/python3.5/site-packages/zipline/data/bundles/quandl.py", line 113, in fetch_data_table "Failed to download Quandl data after %d attempts." % (retries) ValueError: Failed to download Quandl data after 5 attempts.

freddiev4 commented 5 years ago

@teeling sorry for the late reply here. Typically Quandl's servers are down / having issues when that happens, which you can check the status of in real-time here. Have you tried re-downloading since you've posted this issue?