Is YQL / datatables.org down as of May 17-18, 2017?

那年仲夏 提交于 2019-12-12 08:49:29

问题


During the past 1-2 days, the http query that I used to download historical stock prices from Yahoo Finance has not been working. The link I have been using is the first one below but I have also tried out the other three (since I saw other people using them):

http://real-chart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
https://real-chart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
http://ichart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
https://ichart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv

One interesting thing that I noticed is that the link that the Yahoo website itself provides (to download the data manually) changed. The link used to be the first in the list above (after all, that's where I got it from) but now it is as follows:

https://query1.finance.yahoo.com/v7/finance/download/TRQ?period1=1466805600&period2=1467496800&interval=1d&events=history&crumb=DuX0UxVwtN0

Note that all these links should in theory retrieve the same data: stock prices for TRQ (just an example, I have tried e.g. AAPL as well) from 2016/06/25 to 2016/07/03.

This new links works in the browser or within my program, but it is hardly scalable since it requires a session cookie; if you just leave out the last query parameter, you get an error saying you are not authorized. This question asks about how to create said session cookie in an automated way; however, I want to ask about avoiding this problem entirely by trying to directly access the YQL database.

I tried using the following link to directly use the YQL API (converting the spaces to %20 etc., that's not the problem):

https://query.yahooapis.com/v1/public/yql?q=
  select * from yahoo.finance.historicaldata where symbol = "TRQ" 
  and startDate = "2016-06-25" 
  and endDate = "2016-07-03"
 &format=json
 &diagnostics=true
 &env=store://datatables.org/alltableswithkeys
 &callback=

This link returns a "connection refused" error. As this question suggests, this might be because the datatables.org site is down (the question in the link refers to a downtime incident about a year ago). Does anybody have more information on this?

Thanks.


回答1:


Yahoo has officially confirmed that the Yahoo Finance API has been discontinued in the following thread in the Yahoo Help Community (see posts by username Nixon):

https://forums.yahoo.net/t5/Yahoo-Finance-help/Is-Yahoo-Finance-API-broken/m-p/250503#U250503

We are all asking ourselves "now what?"

  • Can Yahoo be persuaded to reinstate the service, possibly at a fee? (see e.g. https://yahoo.uservoice.com/forums/382977-finance/suggestions/19322560-please-bring-back-the-api)

  • Will a commercial actor step in and provide historical equity and exchange rate data at a reasonable price?

  • Are there alternative APIs out there that still work?

Please share your findings with the community.




回答2:


It appears to be down. Quandl is probably the closest free replacement, but it doesn't have all of the same data. In particular, I'm trying to retrieve data on various ETFs, such as VXUS and VTI, which aren't working.




回答3:


One of the great features of the now-discontinued Yahoo data was the "adjusted price" that essentially provided the total return of an instrument. Since that is also no longer offered, you might as well use the Google finance API which still can be automated. This is a snippet of what I use (excel VBA) to open and save a file with the data. The end date I used here is 2019 or whatever you want- it will download to the last available date without generating an error:

startdate = #3/15/2015#
StartingMonth = Format(startdate, "Mmm")
StartingDay = Format(startdate, "d")
StartingYear = Format(startdate, "yyyy")
startdate = StartingMonth & "+" & StartingDay & "%2C+" & StartingYear    
Symbol = "AAPL" 
ThisAddress = "http://www.google.com/finance/historical?q=" & _
            Symbol & "&startdate=" & startdate & "&enddate=Nov+1%2C+2019&output=csv"
Workbooks(ThisBook).FollowHyperlink Address:=ThisAddress
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Symbol, FileFormat:=xlCSV



回答4:


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.

I have put together some quick Python3 code to download the same CSV as before (with adjusted price) through this new API. Please check out the GitHub project yahoo_quote_download.



来源:https://stackoverflow.com/questions/44050518/is-yql-datatables-org-down-as-of-may-17-18-2017

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!