Coder Perfect

How can I use the Google Finance API to get stock quotes?

Problem

I’m seeking for Google services that provide me access to financial data.

I discovered this URL, which provides Microsoft stock statistics.

What are all of the potential parameters for this type of HTTP request that Google allows? I’d like to view all of the many types of information available to me.

Asked by Josema

Solution #1

Although the Google Finance Gadget API has been officially deprecated since October 2012, it is still in use as of April 2014:

http://www.google.com/finance/info?q=NASDAQ:GOOG http://www.google.com/finance/info?q=CURRENCY:GBPUSD http://finance.google.com/finance/info?client=ig&q=AAPL,YHOO

You can also get charts from Google Finance: https://www.google.com/finance/getchart?q=YELP

It’s worth noting that accessing the Google Finance API in a public-facing application is against Google’s terms of service.

The whole python code may be seen at google-finance-get-stock-quote-realtime.

Answered by digitalPBK

Solution #2

There’s an entire API dedicated to portfolio management. The link has been removed. For this, Google no longer provides a developer API.

Stock quotes are a little more difficult to get by. I came across an article where someone used Google Spreadsheets to get stock quotes.

You can utilize the gadgets as well, but I’m guessing that’s not what you’re looking for.

The API you describe is intriguing, but it doesn’t appear to be documented (at least not that I’ve found).

For the sake of reference, here is some historical pricing data.

Answered by cletus

Solution #3

This website was really useful to me.

http://benjisimon.blogspot.com/2009/01/truly-simple-stock-api.html

It points to a Yahoo API that appears to be very easy and useful.

For instance:

http://finance.yahoo.com/d/quotes.csv?s=GOOG+AAPL&f=snl1

Full details here:

Financial Data You Will Find On Finance.Yahoo.Com

Answered by fratrik

Solution #4

Edit: the api call has been removed by google. As a result, it is no longer functional.

I concur with Pareshkumar’s response. For the url call, there is now a python wrapper googlefinance.

Install googlefinance

$pip install googlefinance

It is simple to obtain the current stock price:

>>> from googlefinance import getQuotes
>>> import json
>>> print json.dumps(getQuotes('AAPL'), indent=2)
[
  {
    "Index": "NASDAQ", 
    "LastTradeWithCurrency": "129.09", 
    "LastTradeDateTime": "2015-03-02T16:04:29Z", 
    "LastTradePrice": "129.09", 
    "Yield": "1.46", 
    "LastTradeTime": "4:04PM EST", 
    "LastTradeDateTimeLong": "Mar 2, 4:04PM EST", 
    "Dividend": "0.47", 
    "StockSymbol": "AAPL", 
    "ID": "22144"
  }
]

Google Finance is a website that offers real-time stock information. Other yahoo APIs exist, such as yahoo-finance, but they are 15 minutes behind for NYSE and NASDAQ equities.

Answered by hongtao

Solution #5

It’s being used for business purposes. It’s not a major deal when your site/app is still little, but as soon as you expand a little, the exchanges start issuing cease and desist letters. FinancialContent is an example of a licensed solution: http://www.financialcontent.com/json.php Xignite is another option.

Answered by Bart

Post is based on https://stackoverflow.com/questions/527703/how-can-i-get-stock-quotes-using-google-finance-api