Yahoo finance webservice API

删除回忆录丶 提交于 2019-11-28 03:34:56
zacjordaan

I don't know where the definitive documentation might be but for your particular example try appending &view=detail to your URL.

http://finance.yahoo.com/webservice/v1/symbols/COALINDIA.NS/quote?format=json&view=detail

This will at least give you the year_high and year_low that you asked after.

Now, even though the following won't work for your COALINDIA.NS symbol (I suspect the exchange is not supported), it might be worth exploring the following two examples:

Example 1: As before, but for Apple and Yahoo symbols, with &view=detail appended:

http://finance.yahoo.com/webservice/v1/symbols/YHOO,AAPL/quote?format=json&view=detail

Example 2: And now using a completely different url, resulting in much more response data. One key caveat is this data is delayed by 15 minutes:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20IN%20(%22YHOO%22,%22AAPL%22)&format=json&env=http://datatables.org/alltables.env

If you discover the major differences between those two options and what impact they might have then please do let us all know; I'd be interested in finding out more.

If you are fine with getting NSE qoutes, you can use this package for the purpose, it is extremely easy to setup.

http://nsetools.readthedocs.org/en/latest/index.html

Since it uses NSE website/services as data source, the quotes will not be delayed (max few seconds).

Beware that these data are both delayed and inconsistent. You are not getting anything even remotely close to tick or real-time data.

From example 2, refresh a few times, and inspect the "LastTradeWithTime" key-value pair. I sometimes get different quotes from different times of day, for no apparent reason. They are sometimes delayed up to three hours.

You get what you pay for; in other words, this is not a free lunch.

For those who are curious about the different options available in the Yahoo Finance URLs, I think these links might help. If it's not what you're looking for, sorry.

http://internetbandaid.com/2009/03/31/yahoo-stocks-api/

https://ilmusaham.wordpress.com/tag/stock-yahoo-data/

Note: the wordpress site contains information that was taken from a site called gummy-stuff.org which is listed in full at the bottom of the above site (I can only list 2 urls in this post so I had to do the round-about way). Oddly, I found this site on my own yesterday. Funny how stuff comes back around. If you visit this site you'll just see a statement from Yahoo that the info he had originally listed (you're looking at some of this site on the above wordpress site) was never intended to be for public consumption and is a violation of Yahoo's terms and conditions agreement as it can apparently be used for hacking purposes. I was curious to see what was on the original post so I searched for it on the WayBack Machine. BTW, the links to the spread sheets are still active in the archive.

Cheers. Thom

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