Data and Machine Learning for DeFi — KeyFi Pro Development Blog

KeyFi
News & Updates
Published in
4 min readMar 11, 2021

--

One of the primary objectives of the KeyFi project is the development of AI models and the data infrastructure to power those models.

One of the first models we are developing is a predictive analysis of DeFi assets and platforms that help to answer the following question:

“Based on the current set of conditions, what allocation of assets and platforms will yield the best return on investment?”

Stablecoins & Interest Rates

The DeFi community has many different platforms where a user can deposit an asset and receive interest, and each of these platforms offers different interest rates for different assets. An example list includes:

  • Compound
  • Aave
  • dYdX
  • CREAM
  • yEarn

One of the most popular asset classes to deposit into an interest-bearing DeFi account is called a Stablecoin. A Stablecoin is pegged 1:1 to another asset, typically a fiat currency such as the USD. Some popular Stablecoins include:

  • USDT
  • USDC
  • DAI
  • TUSD
  • sUSD
  • BUSD

There are several reasons why DeFi platforms offering interest on Stablecoins have become quite popular:

  1. DeFi interest rates are much higher than what traditional banks offer, with major DeFi platforms typically offering between 5% to 12% APY
  2. There is no minimum deposit required to access these high-interest rates
  3. DeFi is accessible to anyone around the world, with little restriction
  4. Stablecoins are free from the volatility typically associated with cryptocurrencies

However, in spite of these benefits, there is still a lot of confusion and debate around which particular Stablecoin on which particular platform will yield the best ROI for a depositor.

Who (or what) determines your interest rate?

DeFi platforms are typically algorithmic in nature. This means that the interest rates are determined purely by an algorithm coded into the platform’s smart contracts themselves. As such, the interest rates will vary based on the algorithm’s determination.

This is typically reflective of another value called the utilization rate. What this means in layman’s terms is supply and demand — the lower the available supply of a particular asset, the higher the interest rate will become in order to incentivize depositors to add more of that asset to the available supply. When that takes place, the utilization rate will decrease along with the interest rate for that asset.

So when viewed as a whole, you have a wide variety of Stablecoin assets offering different rates of returns on different platforms. This can make the decision unclear for a depositor looking to maximize the yield on their Stablecoin assets.

Using AI and Data to find a solution

Using predictive analysis, we can attempt to determine the best allocation of assets and platforms into the future. There are many different ways to approach this problem, however, there are a couple of unifying factors that all approaches will take.

First is the need for data. Machine learning models require training data in order to function. To accommodate this requirement, we’ve built a secure, ever-growing data lake, which is constantly collecting and organizing large amounts of raw data to be formatted and prepared for use training the AI models.

Then next is output. Any useful model will provide an output that allows us to make a decision. In our case, the model should provide data that helps us decide which platform(s) and asset(s) we should deposit in order to get the best return on investment.

In our development process, we first start with small sample datasets and test train very basic models, focusing on how we should format our data and what our desired output should look like.

When we have reached the limits of what we can achieve in the sandbox, we will scale the data. This can be done in a variety of ways. In our case, we wanted to build a system that is continuously collecting data and training new models, creating a continuous feedback loop. Finally, in order to serve the AI model to users, we need to create the infrastructure that allows access via a client application.

The client application should seem very simple and straightforward to the user, hiding all of the complexity of the technical foundation and providing the user exactly what they need — concise, actionable information that helps them make the best financial decision possible.

A high level overview of the flow of data used for training AI models

At KeyFi, we are dedicated to developing this data and AI backend, constantly collecting new data, training new models and finding new ways to present it to our users in a way that makes sense to them.

Watch out for our upcoming KeyFi Pro app which will feature some of the first DeFi focused AI models as well as a set of unique visualizations to help you make better decisions with your DeFi portfolio.

--

--

KeyFi
News & Updates

Intelligent tools for managing your DeFi portfolio