Google Finance API and 9 Alternatives

10 min read

Get 10-day Free Algo Trading Course

Last Updated on November 25, 2020

Table of contents:

  1. What is Google Finance API?
  2. How to collect historical data using Google Finance API?
  3. How to retrieve Price-to-Earnings ratio using Google Finance API?
  4. How to retrieve Earnings-per-Share data using Google Finance API?
  5. How to retrieve Market Beta using Google Finance API?
  6. What are the alternatives to Google Finance API?
  7. Quandl
  8. Yahoo Finance API
  9. Interactive Brokers
  10. Alpha Vantage
  11. TradingView
  12. IEX
  13. Currencylayer API
  14. Traider API
  15. Polygon

What is Google Finance API?

Google Finance API was a tool which allowed us to extract data about stocks and financial assets from Google Finance.

The API is now integrated with Google Sheets.

Thus, we can’t retrieve Google Finance data via code.

The good news is that we can use Google Finance API directly via Google Sheets using simple “Excel formulas”.

How to collect historical data using Google Finance API?

We can pull data for certain stocks with specified start and end days. The overall structure of the required code looks like this:

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

When filled with our historical data request it looks like this:

GOOGLEFINANCE(“GOOG”, “price”, DATE(2018,1,1), DATE(2019,12,31), “DAILY”)

Here is an image of how it looks:

To view all of its functionalities, feel free to check out the following link: https://support.google.com/docs/answer/3093281?hl=en-GB

» You can use the downloaded data to find suitable assets for Pairs Trading.

Alternatively, learn how to find assets for Pairs Trading without writing a line of code.

Link: Pairs Trading – A Real-World Guide


How to retrieve Price-to-Earnings ratio using Google Finance API?

The Price-to-Earnings ratio (P/E ratio) is calculated by dividing the company’s stock price by its earnings.

Now, let’s see how to download P/E ratios in GSheets:

You’ll use the following formula to obtain the P/E ratio for a certain stock: =GOOGLEFINANCE(stock symbol, “pe”)

In the picture below, I checked for the P/E ratios of Facebook and Amazon:

How to retrieve Earnings-per-Share data using Google Finance API?

Earnings-per-share (EPS) is measured by dividing the total sum of profit generated in a given period, by the number of shares that the company has listed on the stock market.

To retrieve the EPS data in Google Finance API, you’ll use the following code: =GOOGLEFINANCE(stock symbol, “eps”)

In the picture below, I checked for the EPS values of Tesla and Audi:

How to retrieve Market Beta using Google Finance API?

Beta measures the sensitivity of a stock price to that of the overall stock market.

To measure the Beta for a stock, you’ll use the following code: =GOOGLEFINANCE(stock symbol, “beta”)

In the picture below, I checked for the Beta values of Apple and Microsoft:

What are the alternatives to Google Finance API?

As we have seen, the usage and functions of the Google Finance API aren’t top-notch and there are many better alternatives.

In this article, we’ll cover them one-by-one so you can pick the one that best fits your needs.

Here is the full list:

  • Quandl
  • Yahoo Finance API
  • Interactive Brokers
  • Alpha Vantage
  • TradingView
  • Investors Exchange (IEX)
  • Currencylayer API
  • Tradier API
  • Polygon

Quandl

Quandl is a platform that provides its users with economic, financial and alternative datasets. According to Quandl, their user amount is over 400,000 people, which ranges from the world’s top hedge funds to investment banks and various asset managers.

Quandl’s specialization is in the field of data that gets collected over time and is categorized as economic, social and financial data – this includes things like: stock prices, crime rates, unemployment rates, various populations, etc.

Quandl offers both free and premium products. The Quandl API is free to use and grants access to all free datasets. Quandl users only pay to access Quandl’s premium data products.

How to use Quandl?

Quandl is really easy to use and is beginner-friendly. All you need to do is to go to their website (https://www.quandl.com/) and register for an account.

After that you’ll get your API key that allows you to take your Quandl game to various programs like Excel, Python, MATLAB, R, Ruby…

Pros of Quandl

  • Quandl offers an enormous collection of data (over 20 million data sets).
  • All datasets are available for instantaneous download in any preferred format.
  • All datasets on Quandl are available through the same API, irrespective of who originally published the data or in what format.
  • The data is transparent.
  • Datasets are easy to find and cleaned.
  • Quandl is free and open to everyone.
  • New data is added weekly.
  • Quandl can be used in many programs (Excel, Python, Ruby, MATLAB…)

Cons of Quandl

  • It needs more datasets.
  • They offer limited amounts of help when constructing analyses or discovering information.
  • They don’t have real-time or delayed stock price data.
  • They don’t have a master security list.

You can find a complete on how to retrieve Quandl data using Excel and Python here: Quandl: A Step-by-Step Guide

Yahoo Finance API

Yahoo Finance API is the most used alternative for Google Finance API. It’s among the most popular and visited financial websites which provides its users with substantial stock market data.

The Yahoo Finance API has a variety of libraries/APIs/methods (yahoo_fin, yFinance, etc) that allow us to get real time and/or historical data for a wide range of products and financial markets. We can get data on things like stocks, bonds, Cryptocurrencies and regular currencies…

Have in mind that Yahoo’s official API has been shut down since the year 2017. This means that we can use several unofficial APIs that now exist. The best free API is yFinance, but as it’s facing some issues currently, the better option is yahoo_fin.

Under the Basic plan for the Yahoo Finance API, you have 500 API calls per month and the rest are charged $0.002 per additional request.

How to use Yahoo Finance API?

The Yahoo Finance API is easy to use. It’s also available in Python. An unofficial Yahoo Finance API is available on RapidAPI (https://rapidapi.com/). Moreover, the RapidAPI website allows you to find and connect to thousands of APIs.

With the use of Yahoo Finance API we can query things like:

  • Finance summaries
  • Stocks
  • Quotes
  • Movers
  • and more

Have in mind that you don’t need to sign up for an account to get their API key.

You can find a complete guide to the Yahoo Finance API (using yahoo_fin) and yfinance Library on our blog:

Pros of Yahoo Finance API

  • It’s free
  • It has a wide range of available data
  • The setup is fairly quick and easy
  • The overall use of it is simple
  • It offers us a monetary record of character stocks

Cons of Yahoo Finance API

  • Not officially for data requests
  • It can make you rate limited/blacklisted
  • Sometimes it’s too simple
  • Not an official API anymore

Interactive Brokers

When it comes to Interactive Brokers (IBKR), they’re another viable alternative and are transparent with their low commissions and financing rates. They also provide its users with on demand learning on their website.

IBKR attract traders with low per-share pricing, good trading platform, a plethora of tradable resources and low margin rates. Some of their trading resources include: stocks, forex, crypto, warrants, precious metals, options, futures, mutual funds, fixed income and more.

Their IBKR Lite plan has no activity fees and offers commission-free trades of stocks and ETFs. On the other hand, the IBKR Pro has some activity fees and is most suitable for advanced traders. This plan includes a per-share pricing of $0.005 and a good trading platform.

Have in mind that both plans have a $0 account minimum deposit.

IBKR offers a demo account too. Signing up for a demo account is fuss-free and just requires an email address.

Check out our IBKR demo account sign up guide here: How to Sign Up for an Interactive Brokers Paper Trading Account

How to use Interactive Brokers?

The Interactive Brokers API is mainly used for trading but you can use it to retrieve data from Interactive Brokers.

However, you are only able to pull data for which you have a subscription for.

Fortunately, you’ll get access to popular assets such as major US stocks even if you don’t pay for a data subscription.

And yes, you can retrieve data using a demo account too.

IBRK Lite accounts do not offer access to the IBKR API unfortunately.

You can find a full step-by-step guide on Interactive Brokers Python API on our blog:

Pros of Interactive Brokers

  • Low commissions rates
  • They offer Options Trading
  • Margin rates are low
  • They offer fractional shares
  • Good investment selection
  • Good research tools

Cons of Interactive Brokers

  • The IBKR native API is not easy to learn.
  • Interpreting and finding info on their website can be tricky
  • They have inactivity fees for the IBKR Pro plan
  • The desktop trading platform is complex
  • The live account opening process can be complicated
  • IBKR Lite users can’t use the smart order router

Alpha Vantage

Alpha Vantage is another great replacement for the Google Finance API as its maintenance is regular. It offers free public endpoints that require a key for tracking your usage.

According to Alpha Vantage’s website, they provide their services to institutions like Harvard University and Ycombinator.

Their documentation is made public and you have a wide range of available data that you can use. Some of the notable ones are real-time and historical stock data, forex, cryptocurrency, sector performance data, fundamental data, technical indicators, and more.

How to use Alpha Vantage?

Alpha Vantage API integration is quite smooth and easy. Their API is available in Python, Javascript, PHP, Java and more. They have over 500 repositories on GitHub (https://github.com/search?q=alpha+vantage), and even offer official add-ons for Excel and Google Sheets.

Some of the functions you can use are: time series, interval, endpoints, overview, income statements, currency exchange rate, and more.

Have in mind that the user has a limit (5 API requests per minute and 500 per day) and that they offer an account upgrade that allows you to do 1200 requests per minute.

You can find an Alpha Vantage introduction guide on our blog:

Alpha Vantage Introduction Guide

Pros of Alpha Vantage

  • It’s free to use
  • Provides extensive data
  • Offers a wide range of technical indicators
  • Offers real-time data
  • Includes great documentation with examples

Cons of Alpha Vantage

  • API call limits
  • Cryptocurrencies don’t have intraday updates
  • Data sources are delayed

TradingView

TradingView is a viable alternative for the Google Finance API. It’s easy to use and intuitive which makes it great for beginners. Take note that TradingView offers you a way to discover various investment ideas and has a large and active community of traders. This makes the website great for learning and sharing ideas.

The website is armed with many widgets, charting solutions, brokerage integrations and advertising opportunities.

There aren’t any complex installations or setups required. You can simply use their website for all of your needs and purposes.

Types of data that can be found on TradingView go along the lines of stocks, futures, bonds, forex, crypto, and more.

They offer 4 types of accounts: one is free and the others are paid for. The billing is offered as monthly, yearly and every two years. Have in mind that all of the paid plans come with a 30-day trial.

How to use TradingView?

To export data as CSV, choose your asset and open up a full featured chart.

Click on the “burgers” on the top left and choose “Export chart data…”.

Unfortunately, TradingView only allows paid plans users to download data.

Pine Script

A semi-workaround is Pine Script.

TradingView has designed its own scripting language called Pine Script. With it, you can create various indicators and strategies.

Without a paid plan, you can still use Pine Script to backtest your ideas using their data.

Pine Script’s syntax is easy to learn and use. With it, you can make a large number of simple and complex tools.

Here is our guide to TradingView’s Pine Script:

Pine Script (TradingView) – A Step-by-step Guide

Pros of TradingView

  • Provides great screeners
  • Great charting options
  • The free plan is great
  • Great backtesting tool
  • Has its own scripting language (Pine Script)
  • Has an indicator library produced by its community
  • Many customizable options

Cons of TradingView

  • Requires a paid subscription to download data
  • Has a limited broker support
  • Doesn’t have level 2 data
  • News feed can be improved upon

IEX (Investors Exchange) Trading

IEX is another great alternative for the Google Finance API. IEX is a free web-based API that allows us to obtain a wide range of data. In my opinion, it’s great for developers that like to make rapid requests for data. It can also be used to build various apps and services.

IEX offers various types of data to be pulled, and the notable ones are: real-time and historical stock price data, forex, cryptocurrencies, fundamentals, and more.

How to use IEX?

It is quite easy to get the hang of IEX. The public endpoints of IEX are free to use and they even have unofficial wrappers that are available in C, C++, Python, Ruby, Java, Go, and others.

IEX gives us a nice range of functions like: quote, time-series, rule creation, REST, stats, financials, cash-flow, income, dividends, and more.

Here is the full list that covers all you need to know about the Investors Exchange Trading API and its usage: https://iexcloud.io/docs/api/#rest-how-to.

You can check out the IEX API Introduction Guide that is found on our blog:

IEX API Introduction Guide

Pros of IEX

  • It’s free
  • There is no disclosed limit to their API and they have officially stated that developers can make up to one hundred requests per second.
  • IEX is among the venues with the lowest adverse selection for small and medium-sized stocks.
  • IEX has a speed bump with two layers of delays which are triggered when the Crumbling Quote Signal forecasts an unfavorable change in pricing.

Cons of IEX

  • It doesn’t perform exceptionally on the adverse selection measures and large-cap stocks.
  • No official library.
  • The speed bump that they have is questionable.
  • There isn’t much historical data available for backtesting.

Currencylayer API

Currencylayer API is a valuable alternative for the Google Finance API. They offer real-time ticker updates and the data you obtain is in the JSON format.

The API they provide is an easy-to-integrate REST API with which we can obtain a wide range of data concerning real-time and historical exchange rates for more than 150+ world currencies and precious metals.

Currencylayer API provides us with forex market values that are available for every API request. Moreover, it powers currency converters, mobile apps, and various financial software components.

Currencylayer API has 4 account plans: a free one and 3 that are paid for. The free plan is limited to 250 requests per month.

How to use Currencylayer API?

Currencylayer API provides an easy to use REST API. After you sign up for an account, you’ll be given a personal API key which you’ll need to validate in order to use the Currencylayer APIs features.

The API has various functions like: real-time rates, historical rates, currency conversion, endpoints, time –frame queries, and more.

On their website you can find a full documentation on the API and some code examples for PHP, JavaScript and Java: https://currencylayer.com/documentation

Pros of Currencylayer API

  • It’s free
  • The prices are affordable
  • You have a flexible subscription plan
  • The free version is good
  • Has a large library of historical data

Cons of Currencylayer API

  • All subscription levels are limited to a certain number of API requests
  • There are different refresh times for different subscriptions
  • Rate limit is slow if you’re not paying for an API key

Traider API

Traider API offers a quality asset for programmers and algorithmic traders who are looking to trade on the same platform they’re using to track stocks. Data streaming over HTTP is also available.

Some of the types of data that the Traider API offers are the following: options, indices, real-time and historical market data, corporate calendars and more.

Traider API’s rate limit for its free and public endpoints can vary between 60-120 requests per minute.

Take note that the Traider API has fees and commissions per stock that can accumulate over time. They also have fees for the usage of their software platforms.

How to use Traider API?

Traider provides us with the RESTful API through which we can access the platform’s trading functions. The Traider API can be easily integrated in Python, Perl, Ruby and Java.

Have in mind that the Traider API’s endpoints require you to authorize your API key.

The full documentation to the Traider API can be found at the following link: https://documentation.tradier.com/

Here you can find some open-source libraries for the Traider API: https://documentation.tradier.com/brokerage-api/overview/libraries

Pros of Traider API

  • It’s free
  • Good Trading API
  • Data streaming over HTTP is available
  • Platform is user-friendly
  • Good amount of requests for the free version

Cons of Traider API

  • Quite a number of commissions and fees
  • You need an authorization token for access
  • No level 2 data

Polygon

Polygon is a great alternative for the Google Finance API if you’re looking for real-time data that is streamed directly from US exchanges.

When it comes to the data Polygon provides us, it goes along the following: real-time and historical stock data, quotes, aggregates, tickers, market status, locales, exchanges, forex and more.

They offer 4 types of accounts of which one is free. Their free version is limited to 5 API calls per minute while the other ones are unlimited.

How to use Polygon?

Polygon’s API can be easily integrated into Python, JavaScript, GoLang, PHP, C# and others. Their data is divided into 3 clusters (Stocks, Forex and Crypto) and the API key allows one simultaneous connection to each cluster.

Here is the link to the full documentation of the Polygon’s API: https://polygon.io/sockets

Pros of Polygon

  • API easy to use
  • Supported by the open-source community
  • High-quality data

Cons of Polygon

  • Expensive
  • Provides only EOD data
  • Intraday data limited to the US only

Igor Radovanovic