Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google finance json stock quote stopped working [closed]

Tags:

json

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 
like image 293
Sumit Kumar Avatar asked Sep 06 '17 08:09

Sumit Kumar


People also ask

How delayed are GOOGLEFINANCE quotes?

Volume information, as well as price data for trades that don't execute on those exchanges, are consolidated and delayed by 15 minutes.

Does GOOGLEFINANCE API still work?

The Google Finance Gadget API has been officially deprecated since October 2012, but as of April 2014, it's still active. It is completely dead as of March 2022. Note that if your application is for public consumption, using the Google Finance API is against Google's terms of service.

What happened GOOGLEFINANCE?

A Google Finance mobile app was removed from the Google Play Store in 2015. Google Finance was relaunched in 2020 with tools to help users get started investing.

Is GOOGLEFINANCE deprecated?

Google Finance is deprecated in 2012. However, it doesn't shut down all the features. There's a feature in Google Sheets that support you get stock marketing data. And it's called GOOGLEFINANCE in Google Sheets.


2 Answers

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.

like image 193
Mohammad Avatar answered Sep 21 '22 22:09

Mohammad


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

like image 26
Anton_Dev Avatar answered Sep 21 '22 22:09

Anton_Dev