-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmark downloading is broken #1965
Comments
Had this issue too. Just changed back to yahoo in the meantime in |
Same issue here #1953 |
Quick solution: Use a manually downloaded local copy of SPY (yahoo lets you download manually the entire history). I modified the benchmarks.py to look for a local csv copy instead. I attach the modified benchmarks.py file it should replace the existing one (so make a a copy of the original first before you overwrite it). The benchmarks.py file is usually found in: %USERPROFILE%\Anaconda3\envs\py34\Lib\site-packages\zipline\data. If you didn't create a unique environment for it then don't specify py34 after envs. Also make sure that your local directory is reflected in this line in the code: |
Hi, Is there a way I can run the backtest without doing a benchmark until it is fixed? Without, that is, ripping up the code and removing any mention of benchmarks. |
You can try setting the benchmark to an asset that's already in your bundle. For example if running the example algos with AAPL, tell Zipline to use AAPL as your benchmark. from zipline.api import symbol, set_benchmark
def initialize(context):
set_benchmark(symbol("AAPL")) My experience has been that Zipline still downloads the SPY data (limited to a year) but at least refrains from using it in the backtest, and thus the backtest doesn't fail. |
I have the same problem as @tanaytrivedi. Tried @yiorgosn solution but it still doesn't work. Are there any extra steps needed in addition to replacing benchmark.py? thanks a lot.. |
Thanks! @yiorgosn |
Google has changed the url for a finance data. Instead of |
I have similar issue when I try to run example: buyapple.py
I try to access the URL in webbrowser, google give following message:
It seems google have some anti-crawler method to prevent automatically get data. Anyone have similar issue? |
@scotthuang1989 as I wrote above you need change the url to https://finance.google.com/finance/historical?q=SPY&output=csv&startdate=Dec+29%2C+1989&enddate=Jan+09%2C+2018 |
@alexkojin , I put this url into chrome. get a 404 error. BTW, you mean I need change pandas source code and reinstall to override the official release? |
@scotthuang1989 Sorry, the url is fixed now. |
@alexkojin , afer dig into a little. I took @yiorgosn solution. i change benchmarks.py to read data from another source. |
@scotthuang1989, the fix proposed by @alexkojin is rather simple. Edit |
Why are we doing this in the first place when the benchmark symbol should be the quandl wiki bundle? |
Thank you @yiorgosn .. For myself, the Mac OS X path was |
Is there a solution yet? I tried changing the google url, but I get a "max retires exceeded with url" error, when running the program. |
@niklas-amslgruber there's a fix on master that uses IEX. You should be able to run a backtest up to 5 years from the current date using the zipline master branch, which you can install using:
or fork it and then do the same steps above, replacing Hoping to do a release of zipline in the next week or two as well so people can just Also doing work here #2107 for a more permanent fix, but haven't had the chance to finish it. |
Pip install doesn't work for me ( I don't have the right to read from the remote repository). I can only install via Conda where the latest version on Github master is not available |
Hi @niklas-amslgruber you should be able to fork zipline and then run The latest master is also available via conda by running:
|
I always get this error message (installing with pip)
|
@niklas-amslgruber the reason for that is because Zipline we only build packages for Py27 and Py35 (you can see the badge in the README). For conda, can create a new conda env for Python 3.5 using
Then run
Or create a Python 3.5 virtualenv and then run |
This error still exists even though I followed your instructions and installed it on Python 3.5 with Anaconda.
|
Not only does this problem still exist, even after fixing the url to be finance.google.com, you still get an error that you're sending automated requests. We can overcome this, but the google finance api is just plain unstable anyway. Better off using quandl.......or custom bundle symbol. What I am failing to understand is why we're downloading a benchmark from any website when we have a bundle? set_benchmark doesn't seem to care at all, which is very strange. Should be able to use benchmarking symbol from our custom set. |
Changing the benchmark data source to morningstar worked for me. To do this, in
However, I agree with @Sentdex: fetching the benchmark data from the local bundle would be an improvement -- both in speed and stability. Edit: Morningstar data was new for |
@xrvo Hi, Matt. I made the 2 changes in benchmark.py but it's not working. The error message is as follows: ====================================== NotImplementedError: data_source='morningstar' is not implemented ================================= Thanks. |
@kelvinho8: It looks like the Morningstar data connector is a fairly recent addition to You should be able to resolve this error by upgrading your |
thanks @xrvo #1965 (comment) worked for me too with pandas-datareader v0.6.0. |
I tried to upgrade to pandas-datareader v0.6.0. but it still does not work File "/Applications/anaconda3/envs/introduction_programming/lib/python3.5/site-packages/pandas_datareader/compat/init.py", line 8, in AttributeError: module 'pandas.io' has no attribute 'common' |
Update: I then tried to change pandas.io into pandas_datareader as mentioned below. But still it does not work. |
@blackcabbage1023 it seems like this error would only happen if there's either a problem with your environment or you have a really old version of |
We recently released Zipline 1.2.0 on PyPI, as well as conda packages for Linux and Windows (macOS soon); please try installing the latest release You can see the release notes here Feel free to update to 1.2.0 with either:
or
|
When will you release the macOS version? @freddiev4 |
@niklay14 I currently don't have a time-line in mind as exams are coming up. I believe if you have conda you can also just pip install zipline as well |
I get this error message while installing zipline with pip: @freddiev4 Command "/Users/niklasamslgruber/anaconda3/envs/py35/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/1n/525648kx213bn0q2bhn3tjrh0000gn/T/pip-req-build-qb36zhft/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/1n/525648kx213bn0q2bhn3tjrh0000gn/T/pip-record-fcez5zho/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/1n/525648kx213bn0q2bhn3tjrh0000gn/T/pip-req-build-qb36zhft/ |
Fix benchmark downloading from Google with pandas-datareader. This issue was originally brought up here.
We now get benchmark data from Google instead of Yahoo, as seen here.
However, it appears that as of only a week or two ago, Google changed the URL from which they are serving their financial data, causing pandas datareader to break. This is also preventing us from rebuilding the
test_examples
data. (For more info see the original post above).The text was updated successfully, but these errors were encountered: