✨ Instagram integration is live! Tutorial

How to Import Stock Prices from Alpha Vantage API to Airtable

Jul 28, 2021Andy Cloke

In this guide, we'll import stock prices from the Alpha Vantage API to Airtable. We will use the Data Fetcher Airtable extension to connect to Alpha Vantage with no-code. We'll then build a stock tracker to manage our investments in Airtable.

Create Stocks Table

Create a table in your base called 'Stocks'. If you've already got a table with your stock tickers/ symbols in, you can use that instead.

Change the name of the primary field to 'Symbol'. Add the stock symbols/tickers you want to import stock prices for, e.g. 'IBM', as records in this table.

stocks-output-table.png

Install Data Fetcher

Install Data Fetcher from the Airtable marketplace. After the extension launches, sign up for a free Data Fetcher account by entering a password and clicking 'Sign up for free'.

Group 1Data Fetcher Sign Up .png

Import Stock Prices from Alpha Vantage API to Airtable

On the home screen of the Data Fetcher extension, click 'Create your first request'. Requests in Data Fetcher are how you import data to or send data from your Airtable base.

click-create-your-first-request.png

On the create request screen in Data Fetcher, for Application, select 'Alpha Vantage'.

alpha-vantage-application.png

Next, you need an Alpha Vantage API key. You can sign up for one here.

get-alpha-vantage-api-key.png

Enter this key into the API Key input in Data Fetcher.

For Endpoint, select 'Latest price (open, close, high, low etc.) for a stock'.

Enter a Name for your request, e.g. 'Import Stock Prices'. Then click 'Save & Continue'.

stock-prices-save-continue.png

For Stock symbol, we want to insert a reference to our 'Stock symbol' field. First click the + button.

stock-symbol-add-button.png

Then, on the modal that opens, select 'Stocks' for Table, 'Symbol' for Field, 'Grid view' for Run for every record in view. Then click 'Confirm'.

stock-symbol-table-reference.png

Stock symbol should now contain a reference to the table.

stock-symbol-table-reference.png

Select the Output Table & View you want to import stock prices into.

stocks-output-table.png

Alpha Vantage's free stocks API has a rate limit of 5 per minute, so we need to make sure we do not exceed this. Click 'Advanced settings' to open the advanced settings. Then scroll down to Rate Limit (requests per minute) and enter '5'. You can buy a premium Alpha Vantage plan to increase this limit.

stocks-rate-limit.png

Click 'Save & Run'.

stock-prices-save-run.png

The request will run and the Response field mapping modal will open. This is where you set how the available fields from Alpha Vantage (e.g. 'Price', 'Open', 'Close', 'Volume) should map to the fields in the output table.

For each Alpha Vantage user field, you can either import or filter it. For an imported field, you can set whether to map them to an existing field or create a new field, as well as set the field type.

Make sure you import the 'Price' field, which is the latest stock price. Import any other fields you want. Then click 'Save & Run'.

stock-prices-save-and-run.png

Data Fetcher will create any fields that need to be created in the output table, then run the request again for each symbol and import the stock price into Airtable.

imported-stock-prices.png

Build a Stock Tracker in Airtable

Create a table in your base called 'Portfolio'. Add a field called 'Stock' that is linked to the 'Stocks' table. Add a field called 'Price' that is a lookup of the 'Stock' table's 'Price' field.

Screenshot 2022-02-03 at 09.03.04.png

Add a field called 'Shares' with type 'Number'. For each stock, enter how many shares you own. Add a formula field called 'Value (USD)' with the formula Price*Shares and select 'Currency' formatting.

Screenshot 2022-02-03 at 09.04.23.png

You have now created an Airtable stock tracker! Each time we run the 'Import Stock Prices' request in Data Fetcher and import the latest stock prices, the prices in our 'Portfolio' table will update. The 'Value (USD)' field will now contain the value of all shares for that stock symbol. The summary bar will contain the total value of all your investments.

airtable-stock-tracker.png

Import Stock Prices to Airtable Automatically

At the moment, we have to manually run the request to import the stock prices from Alpha Vantage. We can use Data Fetcher's scheduled requests feature to automatically import them every 15 minutes/ hour/ day etc.

In Data Fetcher, scroll to Schedule and click 'Upgrade'.

table-1-schedule-upgrade-button.png

A new tab will open where you can select a plan and enter your payment details to upgrade.

Screenshot 2021-12-29 at 10.25.19.png

Return to the Data Fetcher extension and click 'I've done this'.

table-1-schedule-ive-done-this-button.png

Click 'Add API key' in order to add your Airtable API key. You can find your Airtable API key here.

Group 11(1).png

Enter your Airtable API key and click 'Save'.

save-airtable-api-key.png

Enable Schedule this request.

schedule-data-fetcher-request.png

Select how often you want the request to run, e.g. 'Every 15 mins'. Click 'Save' The request will now run on the schedule and import the stock prices from Alpha Vantage automatically.

Group 11(2).png

Related Posts

How to Import Company Revenue, EPS and Financial Ratios in Airtable

How to Import Company Revenue, EPS and Financial Ratios in Airtable

Mar 22, 2022

Rosie Threlfall

Alpha VantageFinance
Import Historical Exchange Rates in Airtable

Import Historical Exchange Rates in Airtable

Feb 20, 2022

Andy Cloke

FinanceCurrency Conversion
Import Time Series Data for Stocks in Airtable

Import Time Series Data for Stocks in Airtable

Feb 14, 2022

Andy Cloke

FinanceAlpha Vantage