# How Lending Pool Interest Rates actually work

If you open up a DeFi loan explorer, you’ll immediately notice that there are many assets across multiple platforms, each with wildly different interest rates:

So how are these interest rates actually set? The short answer is “algorithmically by supply and demand”. This article goes through the longer version of the answer.

Most commonly, the interest rate for a decentralized lending pool is determined by a **function** which takes the state of the pool as input:

I(R)

Here, I is *Interest Rate *and R is the* utilization ratio. *An *R *0 means no assets are lent out. An *R* of 1* *means all of the assets are lent out.

Let’s first consider the trivial case where we simply ignore the state of the pool and return a constant interest rate:

I(R) = 0.2

A lending pool with a constant interest rate curve is setting the interest rate at 20% under all circumstances. A real world example is huobi, which sets their interest rate at 0.1% per day.

As a centralized exchange, huobi can effectively give out an unlimited number of loans. For decentralized peer to peer platforms where loans are backed by real on-chain assets, it is generally desirable to choose an interest rate function that incentives a balanced utilization ratio. Under-utilization is bad because too little interest is generated, and over-utilization is bad because a tapped out pool can no longer meet borrowing demands.

Thus, let’s move onto a function which varies with utilization ratio:

I(R) = 0.2 + 0.3R

An increasing function makes perfect sense. If few people are borrowing, interest rate is lower. If a lot of people are borrowing, then interest rate is higher. Compound is an example of a lending pool with a linear model.

Next, let’s consider higher order functions:

I(R) = 0.2 + 0.5R²

Why bother with a non-linear curve? One reason is to be able to tweak sections of the curve differently. In the median case, users appreciate a relatively stable, robust curve. In the extreme case where the pool is near illiquidity, the interest rate shifts rapidly in an attempt to restore balance.

The linear curve is already rewarding lenders for providing a scare asset during times of need. The non-linear curve goes beyond that. One justification for the additional reward is the existence of **liquidity risk**: if utilization rate is high and many lenders withdraw at the same time, then some of them must wait until outstanding loans are paid back.

Our decentralized margin exchange DDEX uses a non-linear interest rate function. Another real world example is dYdX.

**Points of Consideration**

To illustrate the similarities and differences between various real world models, let’s pick a few points along the curve and see what happens.

For reference, here are the actual interest rate functions for the stablecoin DAI for Compound, dYdX, and DDEX:

Compound: 0.05 + 0.15R

dYdX: 0.15R + 0.85R⁶

DDEX: 0.10 + 0.4R⁴ + 0.5R⁸

**R=0: Initial State, Minimum Interest Rate**

One interest point to consider is R = 0, the edge case where 100% of the assets are available. This is the minimum interest rate of the platform. Let’s plug in the numbers:

Compound(0) = 0.05

dYdX(0) = 0

DDEX(0) = 0.10

The philosophical argument for a non-zero interest rate is that stablecoin assets should demand an interest rate equal to or higher than the risk free rate of USD.

**R=1: Over-Utilized Pool, Maximum Interest Rate**

On the other end of the spectrum, let’s consider what happens when all the assets in the pool are loaned out, and the pool is in a state of illiquidity. In this scenario, we have the maximum interest rate of the platform.

Compound(1) = 0.2

dYdX(1) = 1

DDEX(1) = 1

The maximum interest rate is 50% for Compound, and 100% for both DDEX and dYdX.

dYdX and DDEX pools primarily exist to support margin trading, and a tapped out lending pool is really bad because trading is no longer possible. Compound is a more general purpose lending pool with an IOU system (cToken), so high utilization rate is not as undesirable.

Different curves make sense for different pools. At the end of the day, a good interest rate model is one that helps approximate the equilibrium interest rate, where total borrowing demand equals total lending supply. Algorithmic interest rate models are the most popular solution today because they do a good job of this and are simple and easy to implement on-chain.