Get Cryptocurrency stats with CoinMarketCap

If you want to create your cryptocurrency portfolio tool, you can do it with dashdash.

For this purpose, we will be using the Coin Market Cap API. The API is very simple, and so we can start right away.

We will use the first column to identify the crypto asset.

  • A1: Crypto asset
  • A2: bitcoin
  • A3: ethereum

In the second column, we’ll put the currency we want to price the asset in.

  • B1: Convert to
  • B2: eur
  • B3: eur

In the 3rd column, we’ll make the request to the CoinMarketCap API. We call the endpoint using GET() to get a specific asset. We could also do it by getting all the prices of all assets, putting them in a list, and then VLOOKUP()-ing it. Cells C2 and C3 return a JSON structure, something with lots of {} and [ ].

  • C1: Request
  • C2: =GET("https://api.coinmarketcap.com/v1/ticker/"&A2&"/?convert="&B2)
  • C3: =GET("https://api.coinmarketcap.com/v1/ticker/"&A3&"/?convert="&B3)

In the 4th column, we’ll get the price in the currency of column B from the result of the request (column C). We use function PARSE() that fetches specific data inside a JSON. The results of this API have the following structure: [{},{},{}]. We’re only fetching one crypto-asset, so we need the first element {} of the master structure array [], so we use [0]. Then inside this {} object we want to fetch the value price_eur, so we call PARSE(crypto-asset-cell, "[0].price_cur"). The result is the following:

  • D1: Price
  • D2: =PARSE(C2,"[0].price_"&B2)
  • D3: =PARSE(C3,"[0].price_"&B3)

This is what the app looks like:

This is the basic crypto-tracker. If you want something more sophisticated, you can record the date you invested and how much you did, so that you know how much you’ve gained.

Automatically refresh data

You can automate the info refreshing. You can in principle just place a REPEAT(GET(...),60) inside each request cell and your function would repeat every 60 minutes. However, you should avoid using too many REPEAT()s as they are very expensive. So you should have only one REPEAT(1, 60), lets say in cell E1 and then point at the cell inside each request cell, for example IF(E1, GET(...), "Not Running"). Because every time E1 repeats the value 1, and 1 is TRUE, then it will refresh the data request in GET().

2 Likes