27

So far I was using this URL to get stock quotes from google finance, and parsing the json data using PHP:

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:

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.

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.

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.

https://finance.google.com/finance/getprices?p=1d&f=d,o,h,l,c,v&q=NIFTY&x=NSE&i=60
Sumit Kumar
  • 761
  • 1
  • 6
  • 17

4 Answers4

27

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.

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

Google Ticker: https://finance.google.com/finance?q=NASDAQ:AAPL&output=json

Or you can use 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

Here the parameter i(interval) = 600 seconds = 10 minutes.

enter image description here

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) = 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:

<?php
$timestamp=1504669800;
echo gmdate("Y-m-d\TH:i:s\Z", $timestamp);
?>

Online Convertor Here

Hope this help.

Mohammad Hammadi
  • 733
  • 2
  • 11
  • 34
  • Thanks for the link. One question. When using that link, which is the latest tick. One on top, or one at bottom? I added the "d" parameter in the format, but it doesn't seem to be giving a timestamp. Just a series like this: 1,2,3,4 so on... Here's the link I used: http://www.google.com/finance/getprices?q=.NSEI&x=NSE&i=600&p=1d&f=d,o,h,l,c,v – Sumit Kumar Sep 06 '17 at 13:38
  • Hi, Thank you a million times for your help here! Deeply appreciate. Thanks for the yahoo link as well. But that yahoo link is not returning data for India based stocks like ASHOKLEY.NS or INFY.NS etc... Is there some other parameter I need to add so Indian stocks quotes will be returned as well? Once again, many many many thanks :) – Sumit Kumar Sep 07 '17 at 00:54
  • 1
    I think it is not working anymore for Indian market https://in.answers.yahoo.com/question/index?qid=20130711195331AAoMOCm – Mohammad Hammadi Sep 07 '17 at 07:24
  • 1
    You can use multitasking to send multiple request for different stocks symbols at the same time which will speed up the process. – Mohammad Hammadi Sep 07 '17 at 09:02
  • Sumit Kumar check the Google Ticker – Mohammad Hammadi Sep 09 '17 at 21:24
  • Hi Mohammad, is there some limit to google's data feed? It kept blocking me when I used it to pull data using php and curl. So I coded a java utility, and its bloccking it too... I download only once per 15 minutes, and that too just some 200 symbols... (The ones I personally use for day trading etc...) I can still open the feed in browser, but not with php or java etc... – Sumit Kumar Sep 13 '17 at 05:44
  • @SumitKumar I have observed that there is limit of 100 symbols on Google side. Try 100 symbols if it works for you. – Ravi Jain Sep 30 '17 at 13:21
  • @Mohammad yahoo no longer works btw http://finance.yahoo.com/d/quotes.csv?s=AAPL+GOOG+MSFT&f=snbaopl1 – Chad Priddle Nov 07 '17 at 18:18
  • NOW GOOGLE UPDATED Check https://www.google.com/finance/getprices?q=INFY&x=NSE&i=1. This method not works anymore. – TarangP Mar 08 '18 at 07:54
  • Hi, The google realtime intraday backfill has also stopped working since August 1st. It redirects to google.com/search?q=stock_symbol now. I tried the alphavantage API, but that is limited to 5 calls per minute. – Sumit Kumar Aug 03 '18 at 15:15
8

It seems to be Google Finance API down today (September 6, 2017). You can use alphavantage as an alternative FREE API with JSON output for U.S. Stocks

Anton_Dev
  • 133
  • 1
  • 6
  • Hi, Thanks for the link. The benefit with google was that I can send a list of comma separated stock symbols to it in a single URL/query. It returned json for all stocks in the list. Took just 1 minute to get 200 stock symbols data... Used to repeat every 15 minutes... Can this be done with this one? Thanks :) – Sumit Kumar Sep 06 '17 at 13:46
  • Do you have knowledge about this? will it work again or it will remain down forever? – Gaganpreet Kaur Sep 07 '17 at 09:16
  • I don't have any additional knowledge about Google Stock API, I have used this service since it has been interrupted on Sep 6, as alternative I use Alphavantage – Anton_Dev Sep 07 '17 at 13:49
  • @Anton_dev is this just for nasdaq/nyse based stocks? Or can I get data for a NSE/BSE (India) stocks as well? Like INFY, RCOM, COLPAL etc... Also is there a way to retrieve a list of stock symbols with this api? Thanks – Sumit Kumar Sep 13 '17 at 15:49
  • 2
    AlphaVantage is free and it mostly works, but the API design is quite poor and the performance is quite slow. – MikeB Oct 01 '17 at 21:16
  • Alphavantage allows only 5 API calls per minute, meaning prices for just 5 stocks per minute. Then they start prompting to upgrade to premium API, which is 15 stock prices per minute. Then upgrade to more, 60 stock prices per minute. – Sumit Kumar Aug 03 '18 at 15:20
3

The following works

https://finance.google.com/finance?q=TICKER&output=json

And returns a json with lots of information for you to parse.

potuz
  • 303
  • 2
  • 7
1

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.

Peter
  • 138
  • 3
  • 1
    I dont think APi is Shut Down But it is moved to `finance.google.com` to `google.com/finance` – TarangP Mar 07 '18 at 08:57