Retrieving live data for markets and wallets with R6 classes
This section will explain how to create a simple requester, which is an object that requests external information (from an API over the internet in this case). We will also develop our exchange and wallet infrastructure.
Creating a very simple requester to isolate API calls
Now, we will focus on how we actually retrieve live data. This functionality will also be implemented using R6 classes, as the interactions can be complex. First of all, we create a simple Requester
class that contains the logic to retrieve data from JSON APIs found elsewhere in the internet and that will be used to get our live cryptocurrency data for wallets and markets. We don't want logic that interacts with external APIs spread all over our classes, so we centralize it here to manage it as more specialized needs come into play later.
As you can see, all this object does is offer the public request()
method, and all it does is use the formJSON()
function from...