While learning about cryptocurrencies, I desperately needed data that I could manipulate myself to do my own plots and analyses. Here I show you how to easily get real-time and historical crypto data right in your web browser with minimal programming skills. Source code, links, and some basic plots and analyses included.

Disclaimer: You will not find any financial advice here and I’m no expert in cryptocurrency, cryptoart, NFTs, their trading, etc. I only give away free HTML+JavaScript code to get data through API calls to CryptoCompare.com; and I display some plots derived from that data with some of my own subjective opinions.

I recently got interested in cryptocurrencies, cryptoart, NFTs, etc. Naturally, as a scientist working with data all the time, one of the first things I wanted to do was to play with cryptocurrency data myself. I saw plots everywhere in websites, news, and apps; but how could I get my hands on actual data to play with it and do my own plots and investigations? And especially, how could I be sure it was up to date every time I requested it?

Specifically, the first thing I wanted to put my hands on were the exchange rates between various crypto and Fiat currencies. I found that the website CryptoCompare.com offers a nice API, free for small numbers of calls, that allows programmatic access to data from its base. I also found online various pieces of JavaScript code that I put together into two very simple web apps: one to get updates of BTC-USD exchange rates every 10 seconds; and another to retrieve historical BTC-USD exchange rates every minute, hour, or day throughout the whole history of Bitcoin. Feel free to copy the code I present and to adapt it to your own goals.

Web app 1: get any exchange in real-time

Of course, you could open any cryptocurrency website or app and get this number from there, but suppose that you want to have it always at hand and refreshing automatically, or perhaps you want to have it fed automatically to a calculation system you are developing.

Simple access to this link at CryptoCompare’s API returns the exchange rate of Bitcoin (BTC) in USD right at the moment you make the call:


Likewise, this other example gives you the exchange rate of Ethereum (ETH) in EUR at the moment of the call:


Easy, isn’t it? Well, building on that, the following code returns whatever conversion you…

Continue reading: https://towardsdatascience.com/obtaining-historical-and-real-time-crypto-data-with-very-simple-web-programming-7b481f153630?source=rss—-7f60cf5620c9—4

Source: towardsdatascience.com