Ultimate magazine theme for WordPress.

How to explore historical DeFi data

Have you ever wondered what the annual percentage rate (APR) of a pool was yesterday, a week ago, or two months ago? Or maybe you were wondering what the average APR of a pool was for the last week, month, or year? How about resenting the fact that you have to visit twenty different apps to find the best APR for a specific asset, app, or platform? Maybe you’re just frustrated that there are too many platforms with too many apps and assets and it seems impossible to make the best investment decision? Enter Yield Samurai.

What you will learn

  • How to explore complete historical data for different DeFi apps like Aave, Compound, Uniswap and more
  • How to use filters to find exactly what you’re looking for
  • How to read the data for individual pools to make better DeFi investment decisions
  • Common terminology for decentralized finance
  • The methodology and data sources we use to collect and analyze blockchain data and build our historical DeFi archive

DeFi Historical Data on Yield Samurai

Open Yield Samurai and wait for the data to load:

As you can see, we have two tables – one for credit pools and one for liquidity pools. Credit pools are pools that have both depositors and borrowers, while liquidity pools only allow depositors. The former appear in apps like Compound and Aave, while the latter are children of Bancor, Uniswap, and other automated market makers.

terminology

  • TVL — Total value locked in the pool (in USD), ie the sum of the USD value of all assets in the pool.
  • BAPR — The APR is the annual interest paid on loans from a pool, e.g. B. if you borrow 100 ETH from the compound ETH pool at 1% BAPR, you need to return 101 ETH to close the position after one year.
  • ACCORDINGLY — Annual Deposit Percentage is the annual interest paid on deposits. If you e.g. B. Deposit $100 into the WBTC-WETH pool on Uniswap V3 at 10% DAPR, you will have earned $10 by the end of the year.
  • II — Impermanent loss, ie the difference between holding an asset and depositing it in a liquidity pool (read more about IL here).
  • use — the percentage of borrowed deposits in a pool, e.g. B. If 100 ETH is in the compound ETH pool and 50 is borrowed, the utilization is 50%. The higher the utilization of a pool, the more interest is paid by borrowers and subsequently paid out to depositors.

periods

As you can see some of the columns have dot buttons next to the title. This means that the numbers (and charts) displayed for the column are relevant to that time period. For example, if you select a 1 month period for the Volume/Fees column, you will see how much total trading volume (and fees) the pools generated for that period. However, if you select the 1 month period for the DAPR column, you will see the average DAPR for that period. Yield Samurai currently supports the following time periods:

  • 24 hours
  • 7 days
  • 1 month
  • 3 months
  • 6 months
  • 1 year
  • All

data sources

Asset pricing and metadata comes from CoinGecko’s API.

Data for pools comes directly from the blockchain as APIs do not provide complete historical data and have a tendency to go down at times. Therefore, we run our own blockchain archive nodes. For our Ethereum node, we use Erigon to make things easier, and we’re working on setting up nodes for other blockchains as well – Avalanche, BSC, Fantom, etc. – as implementations of Erigon are being developed for each of these platforms.

methodology

For every app supported by Yield Samurai, we analyze their documentation and integrate them with their smart contracts to pull complete historical data from the blockchain.

Let’s take Uniswap V2. As the second iteration of the most popular decentralized exchange (Dex), Uniswap V2 features a familiar smart contract architecture:

  • A factory contract is the main entry point for the app
  • A swap event is issued for each trade

To get full history data for Uniswap V2 we need to do two things: first find all pools listed in the app; Second, you get the total trading volume generated by each pool.

To complete the first task, we open the factory contract and get the allPairsLength variable – that’s the number of pools listed in the app. We then call the allPairs method on each index in allPairsLength to get the address of each pool. For example, the first pool listed on Uniswap V2 (index 0) is USDC-WETH.

Once we have the pool address we can open the pool contract and get the details we need to list the pool i.e. asset addresses via the token0 and token1 variables. Once we have the addresses of the two assets in the pool, we get the data we need for each asset from their smart contracts – name, symbol and decimals. At this point we have everything we need to list the pool on Yield Samurai.

To get historical data for each pool on Uniswap V2, we need to get the total trading volume generated by the app as well as the TVL each pool had at specific points in time. We get the trading volume by retrieving all swap events from the blockchain and assigning them to each pool based on the address parameter. We get the TVL by calling the pool’s getReserves method, which returns reserve0 and reserve1, the balances for Token0 and Token1 at a given point in time.

Once we have the total trading volume and TVL for each pool, we can calculate the historical DAPR for any desired time period. For example, to calculate the DAPR for a single day, we get the total trading volume from that day, charges from the volume and we annualize it by multiplying it by 365. We divide the result by the TVL for that day to get the DAPR:

dapr = (fees * a) /tvl \ where \ a room room is a room multiplier room such room that room-fees room room are annualized

We perform a variant of this process for each app that we integrate with Yield Samurai, retrieving the required smart contract data based on the app documentation and applying app formulas to get complete historical data.

How to use Yield Samurai

Let’s say you hold 1,000 DAI and want to find the best pool to deposit and earn interest. With Yield Samurai, this task becomes child’s play. First, let’s find and select DAI:

Enter samurai search terms

We then set a minimum TVL limit of $10,000 to filter out really small pools:

Yield samurai filter

We click Apply filter and wait a moment for the results:

Output Samurai DAI search results

We now see all pools (in supported apps) that contain DAI and have more than $10,000 TVL. To make things even easier, we can sort the results by DAPR to find the highest response rate for a selected time period. Let’s say we want to see the highest DAPR for the past week. All we do is click on the DAPR column:

DeFi Watch DAI search results sorted by DAPR

And now, after just a few clicks, we have a list of the best DeFi pools that contain DAI. At this point we can jump into the individual pool analysis, taking into account asset prices, temporary losses, the trend of the pool and any other data we have.

To continue our example, let’s take a closer look at the DAI-WETH Uniswap V3 pool with 0.05% fee:

Yield Samurai DAI-WETH Uniswap V3 Pool with 0.05% fee

Each pool’s individual page allows us to interpret key details that will help us decide whether or not to join the pool. For example, a simplest calculation would be to compare DAPR and IL for the same period; If IL is higher than the DAPR, the pool is not worth it.

Furthermore, we can determine the trend of the pool, i.e. the direction it is moving, by checking the DAPR for different time periods and analyzing the historical data chart, preferably in full screen mode:

Yield Samurai historical data chart in full screen mode

Because there is a lot of data for each pool, we use tooltips to show the finer details. For example, hovering over an asset name shows the asset’s current price and a seven-day price chart and percentage change for that period. Hovering over the TVL shows the amount of each token in the pool. Hovering over the fees shows the amount collected in each asset.

This example shows a simple way you can use Yield Samurai to make better DeFi investments, but the tool offers a lot more:

  • You can scroll through table pages and marvel at the variety of apps, pools and assets
  • You can follow new pool and asset lists to discover gem pools that are still in their infancy
  • You can filter by platforms, apps, a variety of assets, by DAPR, TVL, and creation date
  • You can analyze your favorite pools by key metrics and compare their historical performance to other prospects

In short, Yield Samurai helps you earn more from DeFi.

Summary

Yield Samurai is a decentralized aggregator of historical financial data. It allows you to explore and analyze pool of prospects across different platforms and apps to find the best place to earn interest on your cryptocurrency holdings.

Learn Crypto Trading, Yield Farms, Income strategies and more at CrytoAnswers
https://nov.link/cryptoanswers

Comments are closed.

%d bloggers like this: