Predictive Model for Borrowing Cost/ Earnings Gained from Popular DeFi Protocols

Grant 3 Funding

Name of Project: Predictive Model for Borrowing Cost and Supply Earnings of Popular DeFi Protocols

Proposal in one sentence: Help DeFi investors minimize borrowing interest payments and maximize supply earnings across DAI, USDT, and USDC as well as have an interactive web app.

Data Gathered

DeFI Protocol: CompoundV2 and AaveV2
Network: Mainnet

Features: borrowing rate, deposit rate, borrow volume, and supply volume

Training Date Range: January 1st, 2021 - December 31st, 2021
Unseen data Date Range: January 1st, 2022 - May 10th, 2022

Stable Coins: DAI, USDT, or USDC

Other Tokens: ETH

Predict: Which stable coin will have the lowest borrowing rate / highest supply rate

Different models: 7 day, 14 day, 21 day in the future prediction

Project Description

Everyone wants cheap debt and stable debt. These models aim to provide a user with the tools to be able to have the cheapest debt over 7, 14, or 21 days.

Especially in the bear season, it is important to maxmize earnings as much as possible. These models aim to provide a user with the tools to be able to earn the most interest over 7, 14, or 21 days.

The focus of the approaches are on stable coins, as the pegs allow for a more simple debt position to predict.


  • There is some success in the CompoundV2 models. Models yield savings 7 days 0.05%, 14 days 0.14%, 21 days 0.13%. There is some success, but the models could improve by adding more features. For instance, the number of suppliers to each Compound pool and possibly weighting the collateralization ratio of each token. It is also important to note that borrowing volume on Aave is low in 2022, besides for May 9th. Borrowing volume usually occurs in bull markets.
    Support - Dune and Specific dashboard - Dune

  • There is a new UX to interact with time window models for 7, 14, 21 days!

  • Gathered AaveV2 Jan 2021 - May 10th, 2021, performed EDA and preliminary testing with RandomForestClassifier

  • Determine Online Learning Time - Retrain Monthly, Weekly, etc.

  • Use Messari Subgraph (Much of the cleaning is done already)

  • Refactor and clean ML pipeline

Previous Grant Deliverables

[X] Publish Compound 2021 and 2022 datasets to Ocean’s data marketplace -

[X] Test models trained on the Compound DeFi protocol on unseen data - Estimated savings for 5-7,5-14,5-21

  • It is important to note that unlike 2021, 2022 USDC has the lowest borrowing rate. The model would be better be tested when there is more volatility.

[X] Build interactive app
[X] Gather data for the Aave protocol and start training models

This was a deliverable for the Ocean grant sorry about the overlap

[ ] Publish the top 3 models to Ocean’s algorithm marketplace - top models for 5-7,5-14,5-21

  • Ocean’s publishing of algorithms is a little slow. Below are the dids
    5-7 model - did:op:05c2991a04ce800b57ef7ba40444eb5f28f5c520dd0be0b8376894ce1760923d
    5-14 model - Link in comments
    5-21 model - Link in comments

Grant Deliverables

  • We will begin training AaveV2 models for borrowing and supply rate prediction
  • Add more features to compound model such as number of suppliers to supply pools.
  • Predict supply rates as well as borrowing
  • Create a streaming to predict real time data. The Graph to Web App. This will enable
    our models to be online learning and handle model drift.

Funding Requested: $1000

Squad: Arshy, Christian, Iago, Vintage Gold

Create a web app to interact with model predictions - Defi app -

Gather data for the Aave protocol and start training models -

Miro Board - Miro | Online Whiteboard for Visual Collaboration