25

Requesting data from Yahoo Finance seems to have changed or is now blocked. The request below for commodity data no longer works as of May 2017. Does anyone know if there is a new way to make this request?

http://chartapi.finance.yahoo.com/instrument/1.0/GCQ17.CMX/chartdata;type=quote;range=10d/csv/
homebase
  • 665
  • 1
  • 6
  • 14
  • 3
    The unsupported Yahoo finance API is shut down, see https://forums.yahoo.net/t5/Yahoo-Finance-help/Is-Yahoo-Finance-API-broken/td-p/250503 – He Shiming May 19 '17 at 02:18
  • 1
    Here is the answer for any one how wants it. On June 8, 2017 Yahoo will be sold to Verizon. So Yahoo is now removing services which can not generate ad revenue. Access to the Yahoo Finance API by third party software has been eliminated. – homebase May 19 '17 at 04:54
  • 2
    Alpha Vantage is a new free stock data API. I'm using it and it has worked really well. I've just written a blog post about it: http://www.the-data-wrangler.com/acquiring-stock-market-data-from-alpha-vantage/ – Ashley Davis Oct 13 '17 at 23:53

3 Answers3

25

First, the old Yahoo finance iChart download is gone for good. In one of the forum posts, a Yahoo employee has confirmed that the free EOD data has been terminated, and will not be reintroduced. Check out this thread and look for reply from Nixon. Yahoo is recently acquired by Verizon, and it must be the new direction.

However, if you check the Yahoo financial page, the CSV download link works, though differently now. It is through a new API that uses an authentication token "crumb" that is linked to a cookie when you access the page.

So there is a work-around to get the same CSV download as before through this new API. I have put together some quick Python3 code. Please check out GitHub for source code yahoo_quote_download.

c0redumb
  • 371
  • 4
  • 5
  • 1
    Is there a way to get the data returned in JSON? – homebase Jun 03 '17 at 12:46
  • 1
    I don't know a way to do that. The old API did not return JSON either. There is another way that used to work through YQL which did return JSON if you ask for it, but the historicaldata table has been dropped by YQL server at about the same time that the old API stopped working (so it does not work now). Since you have the CSV, it is not hard to write a Python code to convert that to JSON. – c0redumb Jun 04 '17 at 23:26
  • homebase, see https://stackoverflow.com/questions/47064776/has-yahoo-suddenly-today-terminated-its-finance-download-api/47148296#47148296 – mti2935 Nov 07 '17 at 01:01
5

As Ashley Davis mentioned in the comments section of the question above, the new way to go is through Alpha Vantage, at least when one is looking for free historical data. Their web service is very well documented and straight forward.

For those of you who are looking to import the data into Excel, I have written an api that I make available for free. Here is the Excel spreadsheet

Addendum as of Aug 2018: Current version of Deriscope supports retrieval of both historical data and live feeds from YF.

Community
  • 1
  • 1
Yannis
  • 123
  • 1
  • 5
1

For Australian investors, here is an alternative to yahoo finance api:

www.biglion.com.au

Chan Austin
  • 1,724
  • 3
  • 10
  • 16
  • This is helpful, does it have restriction about how many requests a user can send per day? – He Wang Nov 09 '18 at 00:23
  • This service is banned by asx. – Chan Austin Dec 03 '18 at 03:03
  • Sad to hear. Do you know any other API about ASX? Thanks EDIT: found this one: https://www.alphavantage.co/support/#api-key – He Wang Dec 03 '18 at 05:09
  • That one may not survive too long, I bet. In the long run, you can set up a data server for yourself in aws, https://datatellstory.blogspot.com/2018/11/way-to-get-existing-data-and-organize.html – Chan Austin Dec 03 '18 at 23:20
  • Cheers, luckily I am not building some sort of software to make money, I just want to build some simple web apps to build up JavaScript skills. Anyway, thanks for the tip! Much appreciated. – He Wang Dec 04 '18 at 00:04