DeFi Leverage Calculations

Attention!

This post doesn’t give financial advice. Everything tried or done from this post is at one’s own risk. Remember to be careful out there, markets are brutal.

What is Aave?

Aave is one of the biggest decentralized finance (DeFi) protocols. It’s a platform that lets you lend and borrow cryptocurrency assets without KYC or negotiations, it’s fast and easy. That’s because Aave is non-custodial platform that relays on code and algorithms. Interest rates, liquidations and much more are defined algorithmically. Right now the total value locked in the protocol is around 12 billion USD. New improvements and changes to the protocol are voted by the community of AAVE token holders. With Aave (and DeFi) you are your own bank, but remember, more freedom means more responsibility.

Why Use DeFi?

If you have used trading tools on centralized exchanges like Binance, FTX or Kucoin, you probably know that cryptocurrency world is very leveraged. You maybe have seen or even used leverage options such as BTC 5x short or ETH 10x long. These work fine, but often centralized exchanges take a notable fee for using their services. In addition centralized exchanges are somewhat unreliable (like banks). FTX, for example, trades against its own users. This is why it’s nice to use decentralized services. 

Longing or Shorting an Asset with Leverage on AAVE

It’s quite easy to short or long with leverage on Aave. First we need to decide an asset. Let’s say that we believe ETH will do great in the future and we want long it. How to go long:

  1. Go on aave.com
  2. Make sure you have deposited some capital (to be able to borrow, you need to have a starting collateral)
  3. Borrow the wanted amount of stablecoins (either USDC, DAI or USDT) , but make sure your health factor stays green or yellow (you can’t borrow too much)
  4. Now you need to go a DEX  (decentralized exchange) like uniswap.org or traderjoexyz.com (depending on the network used)
  5. Buy/swap the asset you want long (in this case ETH) with the borrowed stablecoins
  6. Go back to aave.com and deposit the swapped ETH (now your health factor will increase, meaning you can borrow more)
  7. If you want to leverage up your long, you need to repeat steps 3-6 as many times as you’re comfortable with (REMEMBER: When your health factor is closer to 1 and red, you have a bigger risk to get your assets liquidated)

We also might think that BTC will go down in the near future and we want short it.  How to go short (very similar process, but reversed):

  1. Go on aave.com
  2. Make sure you have deposited some capital (to be able to borrow, you need to have a starting collateral)
  3. Borrow the wanted amount of WBTC, but make sure your health factor stays green or yellow (you can’t borrow too much)
  4. Go to a DEX  (decentralized exchange) like uniswap.org or traderjoexyz.com (depending on the network used)
  5. Buy/swap your borrowed WBTC to stablecoins (either USDC, DAI or USDT)
  6. Go back to aave.com and deposit the swapped stablecoins (now your health factor will increase, meaning you can borrow more WBTC)
  7. If you want to leverage up your short, you need to repeat steps 3-6 as many times as you’re comfortable with (REMEMBER: When your health factor is closer to 1 and red, you have a bigger risk to get your assets liquidated)

If you leverage up your short/long position, you might want to calculate how many times you have to loop the steps 3-6. Every time you loop (meaning you repeat the steps 3-6), your position gets more leveraged. If you want see how loop count affects your leverage size, you can calculate your overall position (everything deposited and lent) like this (this works with a one asset at a time):

    \[\text{overall position}=S_n=\sum_{k=0}^{n}{CT^k}=C\sum_{k=0}^{n}{T^k}=\boldsymbol{C\frac{1-T^{n+1}}{1-T}}, 0<T<1\]

\text{where:}

    \[n=\text{"loop count"}\]

    \[C=\text{"starting collateral deposit"}\]

    \[T=\text{"loan to value (LTV)"}\]

We can also calculate the overall theoretical maximum position, where we loop our leverage process infinite times. Keep in mind that trying this in practice is actually very risky, because your health factor will approach 1 and you will probably get liquidated soon. But still, this is a good way to compare your possibilities. The overall theoretical maximum position will always approach some finite value, because it’s a convergent series.

    \[\lim\limits_{k\to\infty}(CT^k)=C\cdot0=0,0<T<1\]

    \[\text{Overall theoretical maximum position}=S=\sum_{k=0}^{\infty}{CT^k}=C\sum_{k=0}^{\infty}{T^k}\]

    \[=\lim\limits_{n\to\infty}S_n=\lim\limits_{n\to\infty}(C\sum_{k=0}^{n}{T^k})=\lim\limits_{n\to\infty}(C\frac{1-T^{n+1}}{1-T})=C\frac{1-0}{1-T}=\boldsymbol{\frac{C}{1-T}}, 0<T<1\]

\text{where:}

    \[n=\text{"loop count"}(=\infty)\]

    \[C=\text{"starting collateral deposit"}\]

    \[T=\text{"loan to value (LTV)"}\]

\text{If you want to calculate your \textbf{debt-to-equity (D/E) ratio} a.k.a. leverage ratio , you can do that as well:}

    \[\text{leverage ratio}=\frac{\text{overall position}}{\text{starting collateral deposit}}=\frac{S_n}{C}=\frac{C\sum_{k=0}^{n}{T^k}}{C}=\sum_{k=0}^{n}{T^k}=\boldsymbol{\frac{1-T^{n+1}}{1-T}}\]

\text{where:}

    \[n=\text{"loop count"}\]

    \[C=\text{"starting collateral deposit"}\]

    \[T=\text{"loan to value (LTV)"}\]

 

 

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *