Likewise, this other example gives you the exchange rate of Ethereum (ETH) in EUR at the moment of the call:Įasy, isn’t it? Well, building on that, the following code returns whatever conversion you ask for (in this example BTC in USD) every 10 seconds, in a small web page that you can make private to follow your favorite rates in your own website: Get crypto data in real time const getBtcData = async () => 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: 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. Feel free to copy the code I present and to adapt it to your own goals. 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. I found that the website offers a nice API, free for small numbers of calls, that allows programmatic access to data from its base. Specifically, the first thing I wanted to put my hands on were the exchange rates between various crypto and Fiat currencies. 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? 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 recently got interested in cryptocurrencies, cryptoart, NFTs, etc. I only give away free HTML+JavaScript code to get data through API calls to and I display some plots derived from that data with some of my own subjective opinions.Īnd… If you need any ad hoc job such as a web app tailored for your problem, just contact me ! Source code, links, and some basic plots and analyses included.ĭisclaimer: You will not find any financial advice here and I’m no expert in cryptocurrency, cryptoart, NFTs, their trading, etc. Here I show you how to easily get real-time and historical crypto data right in your web browser with minimal programming skills. While learning about cryptocurrencies, I desperately needed data that I could manipulate myself to do my own plots and analyses. Obtaining historical and real-time crypto data with very simple web programming
0 Comments
Leave a Reply. |