Skip to content
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

Cant get currency from yahoo finance with matplotlib #6913

Closed
mushketer888 opened this issue Aug 6, 2016 · 7 comments
Closed

Cant get currency from yahoo finance with matplotlib #6913

mushketer888 opened this issue Aug 6, 2016 · 7 comments

Comments

@mushketer888
Copy link

Matplotlib cant get currency data from Yahoo Finance...
Symbol for EUR/USD is EURUSD=X.
But using this ticket it gives 404 Error.
Matplotlib version: 1.5.1

example:
quotes = quotes_historical_yahoo_ochl('EURUSD=X', date1, date2)
urllib2.HTTPError: HTTP Error 404: Not Found

@tacaswell
Copy link
Member

Does this fail for all symbols or just this one? My two guesses are either yahoo changed the url under us or the = is going to require some extra escaping.

In either case, help sorting this out would be greatly appreciated.

@tacaswell tacaswell added this to the unassigned milestone Aug 7, 2016
@bcongdon
Copy link
Contributor

I did a bit of sniffing around in finance.py:

  • Doing a percent escape on the = still yielded a 404.
  • 'Normal' symbols, such as AAPL still scrape fine.
  • Symbols with non-alphanumeric characters like ^GSPC still scrape fine.

(This suggests that nothing is wrong with the matplotlib interface with Yahoo Finance)

By my best guess, it looks like internally, Yahoo is using a different symbol for these exchange rate symbols. So, EURUSD=X becomes EUR=X

Calling quotes_historical_yahoo_ochl('EUR=X', date1, date2) works as expected.

@tacaswell
Copy link
Member

@bcongdon Thanks!

Closing as this does not look like a bug in mpl. @mushketer888 If you disagree and think that this is a bug in mpl please ping to have this re-opened.

@HQ01
Copy link

HQ01 commented Jun 17, 2017

Hi @tacaswell,

Seems that matplotlib fails to fetch data from yahoo Finance.

Code : just the example code in finance.py

fh = fetch_historical_yahoo('^GSPC', (2000, 1, 1), (2001, 12, 31))

Error :

HTTPError: HTTP Error 404: Not Found

Matplotlib version : 2.0.0

Maybe Yahoo changed the url format?

@hajderr
Copy link

hajderr commented Jun 17, 2017

Can confirm with following virtualenv

 ./bin/pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
certifi (2017.4.17)
chardet (3.0.3)
cycler (0.10.0)
idna (2.5)
matplotlib (2.0.2)
numpy (1.13.0)
pandas (0.20.2)
pip (9.0.1)
pyparsing (2.2.0)
python-dateutil (2.6.0)
pytz (2017.2)
requests (2.17.3)
requests-cache (0.4.13)
setuptools (36.0.1)
six (1.10.0)
urllib3 (1.21.1)
wheel (0.29.0)

@tacaswell
Copy link
Member

It is likly that yahoo did change it's url.

This bug should be re-reported against https://github.com/matplotlib/mpl_finance

@bcongdon
Copy link
Contributor

bcongdon commented Jun 17, 2017

Looks like the Yahoo Finance's 'real-chart' subdomain is gone. (http://real-chart.finance.yahoo.com/)

Try using the method in mpl_finance, it looks like they're using the updated endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants