Yahoo finance webservice API

后端 未结 4 766
囚心锁ツ
囚心锁ツ 2020-12-07 14:57

I am trying to get realtime stock data from BSE and NSE using yahoo finance web-services. I was able to get some data using following URL

http://finance.yaho         


        
相关标签:
4条回答
  • 2020-12-07 15:33

    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.

    0 讨论(0)
  • 2020-12-07 15:36

    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

    0 讨论(0)
  • 2020-12-07 15:45

    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).

    0 讨论(0)
  • 2020-12-07 15:46

    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.

    0 讨论(0)
提交回复
热议问题