Import CoinGecko Data to Airtable

In this guide, we'll look at how to import cryptocurrency prices to Airtable using the CoinGecko API. CoinGecko is a popular source of crypto data with a free API. We'll use this API and the Data Fetcher app to create a crypto tracker in Airtable.

Install Data Fetcher

Create Output Table

  • Create a table in your base called 'Coins'.
  • Rename the primary field to 'Id'.
  • Add a field called 'Name' with type 'Single line text'.
  • Add a field called 'Price' with type 'Currency' and the maximum precision (number of decimal places).
  • Add a field called 'Last Updated' with type 'Date time'.
Screenshot 2021-02-24 at 09.09.57.png

  • Add some records for the cryptocurrencies you want to track by entering the CoinGecko ids in the 'Id' field. CoinGecko ids use all lowercase and hyphens for spaces, e.g. bitcoin, ethereum and binance-coin.

Import CoinGecko API Data to Airtable

  • On the home screen of the Data Fetcher app, click 'Create request'.

Screenshot 2021-02-17 at 16.12.14.png

  • On the create request screen, enter the request name 'Fetch Coin Prices'.

Based on the CoinGecko API documentation, the base URL for all API requests is 'https://api.coingecko.com/api/v3'. We'll use the '/coins/markets' endpoint to get price data for each coin in our table.

  • Enter this URL on the create request screen:

https://api.coingecko.com/api/v3/coins/markets

  • Add a parameter called 'vs_currency' with the value 'usd'.
  • Add a parameter called 'ids'. For the value we want to use a reference to our 'Ids' column in the 'Coins' table, so enter '***Coins*Id***'.

The full URL should now be:

https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=***Coins*Id***

  • Set the output table to the 'Coins' table by clicking 'Use current'.
  • Set the output view to 'Grid view' by clicking 'Use current'.

Screenshot 2021-02-24 at 09.29.13.png
  • Click 'Advanced' to open the advanced settings.
  • Under 'Run on Multiple Records', click 'Use current' to set the table to 'Coins', then click the second 'Use current' button to set the view to 'Grid view'. This means an API request will run for every record in our 'Coins' table and update the price.
Screenshot 2021-02-24 at 09.29.27.png
  • Click 'Run'. You'll see a loading message while the request runs, then the response field mapping modal will open.
  • Click 'Filter all' to remove all fields, then re-add the following field mappings:
    • 'id' -> 'Id'
    • 'name' -> 'Name'
    • 'current_price' -> 'Price'. Change the 'Data type' to 'Currency' first.
    • 'last_updated' -> 'Last Updated'
  • Click 'Confirm'. The request will now run for every record in our 'Coins' table.
  • Click 'Save'.

Build a Crypto Portfolio/Tracker in Airtable

  • Create a table in your base called 'Portfolio'.
  • Change the primary field to 'Id' with type 'Autonumber'.
  • Add a field called 'Coin' that is linked to the 'Coins' table.
  • Add a field called 'Price' that is a lookup of the 'Coin' field's price.
  • Add a single select field called 'Exchange' with some options for the coin exchanges you use, e.g. 'Binance', 'Coinbase' e.t.c.
  • Add a field called 'Balance' with type 'Number'. This is how much of the coin you have in that exchange.
  • Add a formula field called 'Value (USD)' with the formula '{Price}*Balance' and select 'Currency' formatting with the maximum precision.
Screenshot 2021-02-24 at 09.53.15.png

Update Coin Prices Automatically

At the moment we have to update our prices by manually clicking the 'Run' button. Let's configure them to update automatically by using Data Fetcher's scheduled requests feature.

  • In Data Fetcher, scroll to 'Schedule'.
  • You will need a paid account to use this feature, so click the link to upgrade your account if you haven't already. After upgrading, click the 'I've done this' button.
  • Add your Airtable API key if you haven't already.
  • Turn on 'Schedule this API request'.
  • Set how often you want the request to run.
  • Click 'Save'.