Automate Importing Financial Market Data To Google Sheets Using Polygon.io API

Reading Time: 6 minutes

Polygon.io is a platform that provides data about various financial markets like stock, forex, cryptocurrency, and options chains. The key data include market data endpoints like aggregates, gainers/losers, technical indicators, etc.

You can automate importing financial market data to Google Sheets using Polygon.io API. in just a matter of a few seconds with an extension called Amigo Data. Amigo is a data integration and automation tool that you can use to automate data imports to Google Sheets.

Below is a snippet of dividends data imported into Google Sheets with Polygon API.

Apple dividends data imported into Google Sheets with Polyogon API

So let’s learn how to automatically import financial market data to Google Sheets using Polygon.io API.

In this tutorial, we will learn how to import the Relative Strength Index (RSI) of a stock. RSI helps one understand if a particular stock is overbought or oversold.

Below are the steps to import market data of stock into Google Sheets with Polygon.io API:

How to automate importing financial market data to Google Sheets

Install the Amigo Data add-on

Install the Amigo Data Google Sheets add-on from the Google Workspace Marketplace.

Click here to install.

Install Amigo to import market data to Google Sheets

Alternatively, you can get it from Google Sheets.

  • Open a new sheet
  • Go to Extensions→Add-ons→Get add-ons
  • Search for Amigo Data and install

Generate Polygon.io API key

Visit Polygon.io and click Get your Free API Key.

Automate importing financial market data to Google Sheets using Polygon.io API

Sign up to Polygon.io to get your Polygon API key.

Sign up to create a Polygon API key

Upon signing up to Polygon.io, your Polygon.io API key will be created, and you’ll be redirected to the Polygon API dashboard.

Polygon.io API dashboard

On the left side of the dashboard, click the API Keys option to view your API key. 

Select API Keys option

You’ll find the Polygon.io API key under API Keys.

Polygon API key

Get the endpoint of the data

On the Polygon API dashboard, click RESTful Docs under the Documentation header to go to the Polygon.io API documentation.

Select RESTful Docs option

You will be taken to the Stocks API documentation. To explore other APIs such as options API, and forex API, click the respective APIs.

Select the stocks tab

For this article, we’ll import the relative strength index of a stock using the Stock API.

Under Market Data Endpoints, expand Technical Indicators and select Relative Strength Index (RSI).

Under the technical indicators section, select Relative Strength Index (RSI)

In the stockTicker parameter, AAPL (Apple) stock is added by default. Let us import the RSI data for Google, so we will enter GOOGL (Google ticker symbol) in the stockTicker parameter. You can also query by timestamp (YYYY-MM-DD). Window is used to adjust the span of RSI indicator; by default, it is 14 days. 

Polygon API parameters

You can tune in the RSI indicator according to your requirements by simply adjusting the parameters. For the sake of simplicity, keep the default parameters as they are.

Scroll down a bit and you will find the Polygon API endpoint URL link. The URL gets dynamically modified with the change in parameters. Before proceeding, you can run the query to verify if the parameters you’ve inputted are valid. If it shows success with response code 200, then it means that the endpoint it working perfectly and the passed parameters are valid. 

Copy the Polygon.io API endpoint URL using the copy option. This is the URL we’ll use to import Polygon stock data to Google Sheets.

Polygon.io API URL

Import the data to Google Sheets

Now to back to Google Sheets and launch Amigo Data to import stock data to Google Sheets with Polygon.io API by clicking Extensions→Amigo Data→Connect.

Launch Amigo to import stock data to Google Sheets with Polygon API

Then select Custom API from the list of sources.

Selecting the source in Amigo Data

Paste the Polygon.io API endpoint URL in the API URL field.

Enter the Polygon API endpoint URL

Click the PREVIEW button to retrieve the data and preview the data to import to Google Sheets.

Click the button to preview

Flatten the nested datasets and click IMPORT.

Flatten and import the data

The Polygon market data will be imported into Google Sheets in a short while. Below is the snippet of the data imported to Google Sheets using Polygon API.

Snippet of the imported data

Other types of data can also be imported to Google Sheets in a similar manner. You can also likewise import option data to Google Sheets using the Options API, crypto data with the Crypto API, and forex data using the Forex API.

Examples of few other endpoints

Daily Open/Close options data

Select the Options tab to view the options API documentation.

Options API

Under the market data endpoints, select the daily open/close option. Enter the options contract ticker symbol along with the date. An options contract ticker symbol comprises the stock ticker symbol, expiry date and strike price. To know about the structure of options contract ticker symbol, click here. Add the optional parameters to filter the result.

Enter the options contract ticker symbol

Scroll down and copy the endpoint URL to import data using the Amigo Data add-on.

Click this button to copy the URL

Previous close Forex data

This endpoint gives the exchange rate data at the time of close. In the parameter section enter the ticker symbol of the currency pair to fetch the data. 

For example, for the EURUSD currency pair (EUR for base currency and USD for target currency), the URL link is as follows:

Similarly, you can also explore other endpoints. Some endpoints may require a premium subscription. Polygon.io has so much to offer. You can import any kind of financial market data using this interface. To explore more endpoints go through the documentation of Polygon.io API.

After importing the data, you can also set a refresh schedule so that the data are updated automatically at regular intervals. By this you can automate importing financial market data to Google Sheets. To learn how to set a refresh schedule, follow this link.

There are several other types of data that you can import into Google Sheets using Amigo Data such as Marketstack data,  Coinmarketcap data, Nasdaq data, and many more. 

Some related articles you may be interested in:

Get Real-time Stock Data In Google Sheets Using MarketStack API

Import CoinMarketCap Data To Google Sheets

Import Data From Nasdaq To Google Sheets

Leave a Reply

Discover more from Amigo: No-code Data Integrations to Google Sheets

Subscribe now to keep reading and get access to the full archive.

Continue reading