【问题标题】:Problem with Stock Quote from Google Finance谷歌财经的股票报价问题
【发布时间】:2010-02-03 15:11:31
【问题描述】:

以下是我从谷歌金融获得的股票报价示例。但它似乎没有工作。股票价格不显示。

谢谢

<body>
Hello world!
Here is your portfolio:<br/>
  GOOG: <span id=_IG_SYM1_l></span> (<span id=_IG_SYM1_c></span>)<br/>
  AAPL: <span id=_IG_SYM2_l></span> (<span id=_IG_SYM2_c></span>)<br/>
  INTC: <span id=_IG_SYM3_l></span> (<span id=_IG_SYM3_c></span>)<br/>


<script type="text/javascript">
  var quote = new google.finance.Quote();
  quote.enableDomUpdates( { 'GOOG' : '_IG_SYM1', 'AAPL' : '_IG_SYM2', 
    'INTC' : '_IG_SYM3' } );

  quote.getQuotes(["GOOG", "AAPL", "INTC"]);
</script>


<!-- start: javascripts -->

<!-- end: javascripts -->
</body>

【问题讨论】:

  • 您遇到了什么问题?
  • 我没有得到股价。
  • Google Finance API 已于 2012 年 1 月永久弃用,没有替代品。

标签: javascript html css stocks stockquotes


【解决方案1】:

看起来您正在使用 http://code.google.com/apis/finance/docs/finance-gadgets.html#JS_API 的示例。如果我理解正确,该 API 仅适用于小工具。它说,

“使用市场数据 API 的小工具 只能在 iGoogle 中运行——要么 生产 iGoogle 或 iGoogle 沙盒。”

regular Google Finance JS API 只允许您获取与用户的投资组合相关的数据。

【讨论】:

  • 就是这样。我认为 /is/ 没有 API 可以在任意网页上获取原始 Google 股票报价。
  • 有,但没有记录。谷歌确实有一个你可以使用的股票 API。 jarloo.com/code/networking/google-stock-api 在 ASP.NET 中有一个示例。这都是基于 REST 的,所以语言并不重要。
【解决方案2】:

您可能需要先对 Google 金融服务进行身份验证。

AuthSubRequest URL 可能如下所示:

https://www.google.com/accounts/AuthSubRequest?
scope=http%3A%2F%2Ffinance.google.com%2Ffinance%2Ffeeds%2F&session=1&secure=0
&next=http%3A%2F%2Fwww.example.com%2Fwelcome.

http://code.google.com/apis/finance/docs/2.0/developers_guide_protocol.html#Authenticating

【讨论】:

  • 谢谢Yada ...通过链接我需要在调用任何API之前添加它吗?
  • 此身份验证适用于不同的 API,它不提供对原始股票报价的访问。
【解决方案3】:

您是否尝试过用引号括住 span id 属性?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-14
    • 2022-01-22
    • 2012-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-06
    • 1970-01-01
    相关资源
    最近更新 更多