谷歌金融 json 股票报价停止工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46070126/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
google finance json stock quote stopped working
提问by Sumit Kumar
So far I was using this URL to get stock quotes from google finance, and parsing the json data using PHP:
到目前为止,我使用这个 URL 从谷歌财经获取股票报价,并使用 PHP 解析 json 数据:
http://finance.google.com/finance/info?client=ig&q=nse:infy,nasdaq:aapl
Today it stopped working However, I can still access this one:
今天它停止工作但是,我仍然可以访问这个:
http://finance.google.com/finance/?client=ig&q=nse:infy
The problem is that this one is only returning quotes for a single stock, and not multiple ones like previous one used to do...
问题是这个只返回单个股票的报价,而不是像以前那样的多个报价......
Anyone knows how to get stock quotes for multiple stocks using this URL? When I tried like this:
任何人都知道如何使用此 URL 获取多只股票的股票报价?当我这样尝试时:
http://finance.google.com/finance/?client=ig&q=nse:infy,nse:ashokley
it still returns some json stating that both stocks are active. But it won't include quotes etc... Any help is greatly appreciated.
它仍然返回一些 json 说明两只股票都处于活跃状态。但它不会包括引号等......非常感谢任何帮助。
Or if its not possible to get it from here, please point me to another place where I can get OHLCV data for similar stocks.
或者,如果无法从这里获取,请指点我到另一个可以获取类似股票的 OHLCV 数据的地方。
Updating on 04 Aug, 2018 Google realtime intraday backfill has also stopped working. The below URL will redirect to google search page for the symbol.
2018 年 8 月 4 日更新 Google 实时盘中回填也已停止工作。下面的 URL 将重定向到该符号的谷歌搜索页面。
https://finance.google.com/finance/getprices?p=1d&f=d,o,h,l,c,v&q=NIFTY&x=NSE&i=60
采纳答案by Mohammad
As Peter Said, Google Finance API was to shut down on October 2012. Google left the servers functioning without supporting or monitoring them. They will turn off the servers when a major bug or security hole is discovered as mentioned by Jeff Nelson here.
正如 Peter Said 所说,谷歌金融 API 将于 2012 年 10 月关闭。谷歌在没有支持或监控的情况下让服务器正常运行。当发现重大错误或安全漏洞时,他们将关闭服务器,正如 Jeff Nelson在这里提到的那样。
You can use Yahoo finance to get the prices for multiple stock symbols as follow :http://finance.yahoo.com/d/quotes.csv?s=AAPL+GOOG+MSFT&f=snbaopl1
您可以使用雅虎财经获取多个股票代码的价格,如下所示:http: //finance.yahoo.com/d/quotes.csv?s=AAPL+GOOG+MSFT&f=snbaopl1
Google Ticker: https://finance.google.com/finance?q=NASDAQ:AAPL&output=json
谷歌股票代码:https: //finance.google.com/finance?q =NASDAQ: AAPL&output =json
Or you can use Google Realtime Intraday Backfill Data.
或者您可以使用Google Realtime Intraday Backfill Data。
This is an overview about the above google api since it is a litile tricky. I will use the url you wrote in the comment: https://www.google.com/finance/getprices?q=.NSEI&x=NSE&i=600&p=1d&f=d,o,h,l,c,v
这是关于上述 google api 的概述,因为它有点棘手。我将使用您在评论中写的网址:https: //www.google.com/finance/getprices?q=.NSEI&x=NSE&i=600&p=1d&f=d,o,h,l,c, v
Here the parameter i(interval) = 600 seconds = 10 minutes.
这里的参数 i(interval) = 600 秒 = 10 分钟。
One tricky bit with the first column(date) has the full and partial timestamp.(Please check the notes in image )
第一列(日期)的一个棘手位具有完整和部分时间戳。(请检查图像中的注释)
The first row has timestamp = 1504669800. The second row in the data set in image has an interval of 1. You can multiply this number by our interval size (600 s, in this example) and add it to the last Unix Timestamp. That gives you the date for the current row. (So our second row is 10 minutes after the first row. Easy.)
第一行的时间戳 = 1504669800。图像中数据集中的第二行的间隔为 1。您可以将此数字乘以我们的间隔大小(在本例中为 600 秒)并将其添加到最后一个 Unix 时间戳。这为您提供了当前行的日期。(所以我们的第二排是第一排后 10 分钟。简单。)
1504669800 + (1 * 600) = 1504670400 -> timestamp for second row
1504670400 + (2 * 600) = 1504671600 -> timestamp for Third row ... and so on.
The last row (in the bottom) has the highest date and the latest tick.
最后一行(底部)具有最高日期和最新的刻度。
It is easy to convert the unix time stamp to formatted date in any programming language, php example:
在任何编程语言中都可以很容易地将 unix 时间戳转换为格式化的日期,php 示例:
<?php
$timestamp=1504669800;
echo gmdate("Y-m-d\TH:i:s\Z", $timestamp);
?>
Hope this help.
希望这有帮助。
回答by Anton_Dev
It seems to be Google Finance API down today (September 6, 2017). You can use alphavantageas an alternative FREE API with JSON output for U.S. Stocks
今天(2017 年 9 月 6 日)似乎是 Google Finance API 关闭了。您可以使用alphavantage作为美国股票的 JSON 输出的替代免费 API
回答by potuz
The following works
以下作品
https://finance.google.com/finance?q=TICKER&output=json
https://finance.google.com/finance?q=TICKER&output=json
And returns a json with lots of information for you to parse.
并返回一个包含大量信息的 json 供您解析。
回答by Peter
The Google Finance API was due to be be shut down on October 20th 2012. However it remained working since then, until now. Google Finance is a discontinued service which offers no support.
Google Finance API 原定于 2012 年 10 月 20 日关闭。但从那时起,它一直有效,直到现在。Google 财经是一项已停产的服务,不提供任何支持。


