If you have years of experience in quantitative trading, you’re probably no stranger to the Google Finance API. It was once a very popular tool in the financial trading industry, offering numerous advantages over its competitors. The Google Finance API not only provided real-time stock market data but also allowed users to create and manage their own portfolios. Through the API, users could monitor the market performance of their investments and stay updated on the movements of each asset in real time.

During the infamous 2010 “Flash Crash” in the U.S. stock market, many data services experienced outages amid extreme volatility. However, the Google Finance API stood out by continuing to deliver stable, uninterrupted data — earning a strong reputation in the process.

Unfortunately, on October 20, 2012, Google announced the discontinuation of this service. It was later integrated into Google Sheets, where users can now only query market data via built-in formulas rather than programmatically. If you’re a lightweight user, this built-in approach in Google Sheets can still meet some basic needs. Below are some basic tutorials for using the Google Finance API via Google Sheets.

Fetching Historical Stock Data

Formula:

=GOOGLEFINANCE(ticker, [attribute], [start_date], [end_date|num_days], [interval])

The GOOGLEFINANCE function is the command, and the parameters inside the parentheses are:

  • ticker: Stock symbol. It’s best to include the exchange name for accuracy — for example, NASDAQ:GOOG refers to Google stock.
  • attribute: Optional. Defaults to “price”.
  • start_date: The start date.
  • end_date: The end date.
  • interval: Time interval.

Let’s use an example to fetch Google’s historical stock prices:

=GOOGLEFINANCE("NASDAQ:GOOG", "price", DATE(2023,1,1), DATE(2023,12,31), "DAILY")

This will return Google’s closing prices for each trading day from January 1 to December 31, 2023.

Querying Price-to-Earnings Ratio (P/E)

Formula:

=GOOGLEFINANCE(ticker, "pe")

This one is simple, with only two parameters. Here’s how to fetch Amazon’s P/E ratio:

=GOOGLEFINANCE(“NASDAQ:AMZN”, “pe”)

Querying Earnings Per Share (EPS)

Formula:

=GOOGLEFINANCE(ticker, "eps")

It works similarly to the P/E ratio formula. Here’s an example fetching Apple’s EPS:

=GOOGLEFINANCE(“NASDAQ:AAPL”, “eps”)

Limitations of the Google Finance API

Currently, Google Finance API can only be accessed through formulas in Google Sheets, which isn’t helpful for more advanced, customized programming needs. Moreover, Google’s official documentation clearly states that the data is not real-time — there is a 20-minute delay.

If your work demands higher-quality data, you may need to look for alternative solutions.

Alltick’s market data API is designed specifically for quantitative trading, exchanges, and investment institutions. Our API covers a broader range of assets, including U.S. and Hong Kong stocks, forex, commodity futures, and cryptocurrencies. We offer real-time high-frequency data delivered via WebSocket, with an average latency of just 170 milliseconds. Free trials are currently available — feel free to contact our customer support if you’re interested.