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 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.
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'.
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.
On the create request screen in Data Fetcher, for Application, select 'Alpha Vantage'.
Next, you need an Alpha Vantage API key. You can sign up for one here.
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'.
For Stock symbol, we want to insert a reference to our 'Stock symbol' field. First click the + button.
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 should now contain a reference to the table.
Select the Output Table & View you want to import stock prices into.
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.
Click 'Save & Run'.
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'.
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.
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.
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.
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.
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'.
A new tab will open where you can select a plan and enter your payment details to upgrade.
Return to the Data Fetcher extension and click 'I've done this'.
Under Schedule click '+ Authorize'.
Next, a new window will open where you can authorize the Airtable bases you want Data Fetcher to be able to access.
It's recommended that you choose 'All current and future bases in all current and future workspaces' to avoid any issues with unauthorized bases in the future.
Click 'Grant access'.
In Data Fetcher, Schedule this request will have toggled to on.
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.
Mar 22, 2022•
Rosie Threlfall•Alpha VantageFinance