Import Binance API Data to Airtable

In this guide, we will fetch crypto prices in Airtable using the Binance API. Binance is a cryptocurrency exchange that provides crypto market data via an open API. We'll use this API and the Data Fetcher Airtable app to create a crypto portfolio tracker in Airtable.

Install Data Fetcher

Create Output Table

  • Create a table in your base called 'Coins'.
  • Change the name of the primary field to 'Symbol'. Add cryptocurrency symbols you want to fetch, e.g. 'BTC', here.

Import Binance 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 Binance Data'.

Based on the Binance API documentation, the base URL for all API requests is 'https://api3.binance.com/'. We'll use the '/api/v3/ticker/24hr' endpoint to get market data for the last 24 hours.

  • Enter this URL on the create request screen:

https://api3.binance.com/api/v3/ticker/24hr

  • Add a parameter with the name 'symbol' and the value '***Coins*Symbol***USDT'. When the request runs the '***Coins*Symbol***' bit will get replaced by a value in the 'Symbol' field so the value will be, e.g., 'BTCUSDT'. The 'USDT' here signals we want the value of BTC in US dollars.
  • 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-03-23 at 13.21.59.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-03-23 at 13.22.43.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 'lastPrice' field. Change the data type to 'Currency' and enter 'Last Price' next to 'or, create field'.
  • Add any other fields you want to keep in the same way.
Screenshot 2021-03-23 at 13.33.21.png
  • Click 'Confirm'. The app will create the 'Last Price' field for your. Then the request will run again and update 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 Crypto Prices Automatically

At the moment we have to update our coin 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'.