Aave and Compound Interest Rates Offchain Data Sourcing

Executive Summary

This document aims to find and compare the deposit and borrowing rates of the two biggest lending protocols in DeFi along with other important factors such as number of supported assets, utilization rate, total value locked(TVL) and difference between borrowing and lending rate for the same asset in a protocol.

These two protocols are Aave and Compound.

Live data for comparison between the protocols has been fetched from native APIs for Aave and Compound.

Protocol Analysis

AAVE

Introduction

Aave is a decentralized finance protocol that allows people to lend and borrow crypto.

Lenders earn interest by depositing digital assets into specially created liquidity pools. Borrowers can then use their crypto as collateral to take out a secured loan using this liquidity.

Task

The task is to extract lending and borrowing data from Aave using Aave’s Native API and present the findings in an exploratory manner.

Data Retrieval

Data is retrieved using native API of Aave protocol with python programming language and Jupyter Notebook. Full code is available at this link.

Code

# Fetching Data from AAVE v2 Data API 
AAVE_DATA = {}


res = requests.get('https://aave-api-v2.aave.com/data/liquidity/v2?poolId=0xb53c1a33016b2dc2ff3653530bff1848a515c8c5').json()
AAVE_DATA = res
    
ASSETS = list()


for i in range(len(AAVE_DATA)):
    
    data = AAVE_DATA[i]


    _name = data['name']
    _symbol = data['symbol']
    _decimals = data['decimals']
    _totalLiquidity = data['totalLiquidity']
    _depositRate = float(data['liquidityRate']) * 100
    _borrowRate = float(data['variableBorrowRate']) * 100
    _availableLiquidity = data['availableLiquidity']
    _lastUpdateTimestamp = data['lastUpdateTimestamp']
    _utilizationRate = data['utilizationRate']
    _totalDebt = data['totalDebt']




    ASSETS.append({'name': _name, 'symbol': _symbol, 'totalLiquidity': _totalLiquidity, 'depositRate': _depositRate, 'borrowRate': _borrowRate, 'availableLiquidity': _availableLiquidity, 'totalDebt': _totalDebt, 'utilizationRate': _utilizationRate, 'lastUpdateTimestamp': _lastUpdateTimestamp})



ASSETS = pd.DataFrame(ASSETS)


ASSETS.head()


ASSETS.to_csv('./aave_assets.csv', index=False)

Output

Glossary

name - Name of the asset

symbol - Symbol of the asset

totalLiquidity - Quantity of asset deposited in Aave

availableLiquidity - Quantity of asset currently present with Aave

totalDebt - Quantity of asset currently loaned out to borrowers

utilizationRate - Ratio of available assets to total liquidity of the asset

depositRate - Annual Percentage Yield(APY) of depositors for providing liquidity of an asset

borrowRate - Annual Percentage Yield(APY) of protocol from users borrowing asset

lastUpdateTimestamp- Timestamp of the last updated entries

Observations

  • Low risk assets generally have the highest utilization ratio as they provide a secure collateral for borrowing the asset and also have one of the highest deposit and borrow rates.

  • Medium risk assets have the lowest utilization ratio and also the lowest deposit and borrow rates.

  • High risk assets have a higher utilization ratio as compared to medium risk assets and lower when compared from low risk assets and also the same is true for their deposit and borrow rates.

  • Fei USD (FEI) is the low risk asset(stablecoin) with highest deposit and borrow rates of 15.27% APY and 23.71% APY respectively.

  • Curve DAO Token is the asset with highest deposit and borrow rates of 13.43% APY and 37.44% APY respectively.

Compound

Introduction

The Compound Protocol is an Ethereum smart contract for supplying or borrowing assets. Through the cToken contracts, accounts on the blockchain supply capital (Ether or ERC-20 tokens) to receive cTokens or borrow assets from the protocol (holding other assets as collateral). The Compound cToken contracts track these balances and algorithmically set interest rates for borrowers.

Task

The task is to extract lending and borrowing data from Compound using Compound’s Native API and present the findings in an exploratory manner.

Data Retrieval

Data is retrieved using native API of Compound protocol with python programming language and Jupyter Notebook. Full code is available at this link.

Code

# Fetching Data from COMPOUND v2 Data API 
COMPOUND_DATA = {}


res = requests.get('https://api.compound.finance/api/v2/ctoken').json()
COMPOUND_DATA = res['cToken']


ASSETS = list()


for i in range(len(COMPOUND_DATA)):
    
    data = COMPOUND_DATA[i]


    _name = data['underlying_name']
    _symbol = data['underlying_symbol']
    
    _depositRate = float(data['supply_rate']['value']) * 100
    _borrowRate = float(data['borrow_rate']['value']) * 100
    _compDepositRate = float(data['comp_supply_apy']['value'])
    _compBorrowRate = float(data['comp_borrow_apy']['value'])
    
    _totalSupply = float(data['total_supply']['value'])
    _totalBorrows = float(data['total_borrows']['value'])
    _lastUpdateTimestamp = time.time()
    # _utilizationRate = _totalBorrows/_totalSupply
    _availableLiquidity = _totalSupply - _totalBorrows




    ASSETS.append({'name': _name, 'symbol': _symbol, 'totalSupply': _totalSupply, 'depositRate': _depositRate, 'borrowRate': _borrowRate, 'COMP_depositRate': _compDepositRate, 'COMP_borrowRate': _compBorrowRate, 'totalBorrows': _totalBorrows, 'availableLiquidity': _availableLiquidity, 'utilizationRate': _utilizationRate, 'lastUpdateTimestamp': _lastUpdateTimestamp})


ASSETS = pd.DataFrame(ASSETS)


ASSETS.head()


ASSETS.to_csv('./compound_assets.csv', index=False)

Output

Glossary

name - Name of the asset

symbol - Symbol of the asset

totalSupply - Quantity of asset deposited in Compound

availableLiquidity - Quantity of asset currently present with Compound(number of tokens available in the asset pool)

totalBorrows - Quantity of asset currently loaned out to borrowers

depositRate - Annual Percentage Yield(APY) of depositors for providing liquidity of an asset

borrowRate - Annual Percentage Yield(APY) of protocol from users borrowing asset

COMP_depositRate - Annual Percentage Yield(APY) of COMP tokens awarded to depositors for providing liquidity of an asset

COMP_borrowRate - Annual Percentage Yield(APY) of COMP tokens awarded to users borrowing asset

lastUpdateTimestamp- Timestamp of the last updated entries

Observations

  • DAI is the low risk asset(stablecoin) with highest deposit and borrow rates of 2.44% APY and 4.10% APY respectively along with awarded Compound tokens deposit and borrow rates of 1.03% APY and 1.46% APY

  • SushiToken (SUSHI) is the asset with highest deposit and borrow rates of 6.50% APY and 17.19% APY respectively.

Comparison between both protocols

Based on data points shown above we deduced below findings upon comparing both lending protocols, Aave and Compound.

  • Aave(31) supports 50% more assets for lending and borrowing as compared to Compound(20).

  • Difference between deposit rates and borrow rates is greater on Compound.

  • TVL of Aave($19 bn) is also greater than the compound($11 bn).

Both the protocols have relatively similar user interfaces. But Aave is comparatively easier to use with its on-click borrow and supply buttons.

Aave attracts a more customer base with other networks like Polygon and Avalanche with fractional gas fees as compared to Compound which only supports Ethereum network.

Contributors

Last updated