雅虎财经网络服务API [英] Yahoo finance webservice API

查看:56
本文介绍了雅虎财经网络服务API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用雅虎财经网络服务从 BSE 和 NSE 获取实时股票数据.我能够使用以下 URL 获取一些数据

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.yahoo.com/webservice/v1/symbols/COALINDIA.NS/quote?format=json

但它给我的信息非常有限.

But it gives me very limited information.

{
  "list": {
    "meta": {
      "type": "resource-list",
      "start": 0,
      "count": 1
    },
    "resources": [
      {
        "resource": {
          "classname": "Quote",
          "fields": {
            "name": "COAL INDIA LTD",
            "price": "367.649994",
            "symbol": "COALINDIA.NS",
            "ts": "1418895539",
            "type": "equity",
            "utctime": "2014-12-18T09:38:59+0000",
            "volume": "2826975"
          }
        }
      }
    ]
  }
}

我需要更多信息,例如年度最高价、最低价、最后交易价格等,但我无法从雅虎找到任何与此相关的文档,其中详细说明了如何获取更多信息.

I need more information like yearly high, low, last traded price etc. and I couldn't find any documentation related to this from yahoo where it details how to get more information.

是否有与这些服务相关的文档?或者请建议是否有任何可用的替代方案.

Is there documentation available related to these services? Or please suggest if there are any alternatives available.

推荐答案

我不知道权威文档在哪里,但是对于您的特定示例,请尝试将 &view=detail 附加到您的 URL.

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

这至少会为您提供您所要求的 year_highyear_low.

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

现在,即使以下不会适用于您的 COALINDIA.NS 符号(我怀疑不支持交换),但可能值得探索以下内容两个例子:

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:

示例 1: 和以前一样,但对于 Apple 和 Yahoo 符号,附加了 &view=detail:

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

示例 2: 现在使用完全不同的 url,从而产生更多的响应数据.一个关键的警告是此数据延迟了 15 分钟:

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.

这篇关于雅虎财经网络服务API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆