Getting blockchain data is increasingly accessible and faster. In this post we will see how to extract data from a DeFi (decentralized finance) protocol to create a dataset with a Google spreadsheet. With it we will create a dashboard that shows this data in real time, providing us the information about the loans requested in the Aave protocol.

Getting data

What we are going to extract is data related to requested loans, all the history, to be able to analyze them later. To do it we must create a query like the following:

{
  borrows (first: 1000) {
    id,
    amount,
    reserve {
      id,
      symbol
    },
    borrowRate,
    borrowRateMode,
    timestamp
   }
}

With this query we obtain the first 1,000 results, that is the maximum that The Graphs allows in a data block, and then we will keep iterating to get the following until we recover all of them.

If we test this query in this playground we see that it returns:

Image for post

After that we will have the data of all the loans, with the requested crypto asset, its amount, interest and the interest rate. By importing this data directly into our document in Google Sheets, we will have a real-time dataset to build our analysis models.

#ethereum #data-science #defi #blockchain #bitcoin

How to Create an Ethereum DeFi realtime dashboard
14.30 GEEK