Whether you’ve just taken your first steps into the world of DeFi or you’re a veteran in the space, one thing is for sure - it is not risk-free. Price action in cryptocurrency is highly volatile, and sometimes all you can do is wait for the price to go up. But the more savvy users can use their crypto assets for yield farming, lending, or staking their tokens to earn returns. And in crypto, returns of up to 10,000% per annum or even more are not uncommon, but it is important to know how these yields are calculated and whether you will actually receive the returns as displayed.
While providing liquidity on DeFi can be very profitable, users are exposed to another form of risk known as impermanent loss that can quickly eat into your earnings. On some occasions, the effects can be quite disastrous. And even though the term is prevalent in the DeFi space, many users are still unaware of what impermanent loss is and how it works. Without going too deep into the technical aspects, we will be diving into the different elements of yield calculation in crypto and impermanent loss.
What is APY in Crypto?
APY, short for annual percentage yield, measures the rate of return when users deposit their funds into different lending and yield farming protocols. APY includes the effects of compound interest, which can transform low daily or hourly returns into massive amounts over time. Since APY reflects the return on investment over a year, you should only expect to receive the advertised rates if your funds are deposited over this time horizon. Returns may also vary at any moment due to a multitude of factors such as token price and additional token incentives.
How is APY Calculated in Crypto?
In crypto, APY is often calculated differently depending on how often the yield is disbursed. For example, rebase tokens such as Olympus, Wonderland, and Klima allow depositors to earn rewards every epoch, usually every 8 hours. This means that your deposited tokens will effectively compound 3 times within a day, resulting in a much higher APY than if your tokens were only compounded daily.
With that being said, APY can also fluctuate based on the token price and the total amount of deposits. Some protocols usually provide returns in the form of other tokens, where users need to manually claim, sell the tokens and compound them to their initial deposit. The APY shown will then be the yield that depositors can expect to receive if they manually compound on a daily or weekly basis. For example, Sunny is a yield aggregator on Solana which provides rewards in the form of SBR and SUNNY tokens, which can be claimed together in a single click.
The general rule of thumb is that the higher the number of compounding periods, the higher the APY. Sometimes, a protocol may display the APR, or annual percentage rate, instead of APY. The key difference is that APR can be regarded as simple interest, where the effects of compounding are not included. Both protocols could have the same APR, but the APY can vary wildly based on how often new tokens are continuously added to your initial deposit.
What is the Difference Between APR and APY?
Although both of these terms refer to the return you would get on your deposits, APR does not consider the effect of compounding, while APY does, which is why it is usually much higher than the APR for any investment. Below is the APR for Trader Joe’s farms, which highlights both the yield for providing the liquidity, as well as the bonus returns from staking the LP tokens in the corresponding farm.
Assuming your yield is compounded every month, investors could earn interest on top of the interest earned from previous months, resulting in additional yield that can be pretty significant in the long term. If the yield is generated annually, then the APR and APY should be precisely the same.
Depending on the amount of liquidity as well as the trading activity associated with a particular liquidity pool, depositors can usually expect a generous return, even more so if they are particularly early or own a large share of the liquidity pool. But as we’ve mentioned before, impermanent loss is a risk for liquidity providers everywhere, even for the most seasoned yield farmers.
So What is Impermanent Loss?
Impermanent loss is incurred when liquidity providers receive different amounts of assets upon withdrawal, compared to when they first deposited them into a liquidity pool on an automated market maker (AMM) such as Uniswap or Sushiswap. This is due to changes in token price, which affects the composition of the liquidity pool, resulting in you having slightly less or more of a particular token. For example, even if you deposited your assets at a 50:50 ratio at the start, there is no guarantee that you will receive the same amount of each asset in the end. This may result in liquidity providers receiving a lower value of assets than if they just chose to hold the tokens in their wallet instead.
Here’s an example. Let’s assume that the price of 1 ETH is equal to 1000 USDC. Most AMMs require the same value of tokens to be deposited on both sides of a token pair. Let’s say that Alice wants to provide liquidity to the ETH-USDC pool. She needs to deposit 1,000 USDC for every unit of ETH she plans to deposit, or vice versa. Alice deposits 1 ETH and 1,000 USDC into the liquidity pool, which now holds 10 ETH and 10,000 USDC in total. In other words, Alice’s $2,000 deposit now makes up 10% of the pool, which has liquidity of 100,000.
It is important to note that since AMMs don't have order books, the price of the assets is determined by the ratio of assets in the pool. If the price of ETH jumps to 4,000 USDC on other exchanges, arbitrageurs will take advantage of the price discrepancy on the AMM by swapping more USDC for ETH until the price is approximately the same everywhere else.
If no one withdrew their liquidity, it should remain constant at 100,000. However, the ratio of ETH and USDC in the pool has now changed, consisting of less ETH and more USDC. At a price of 4,000 USDC, there should be 5 ETH and 20,000 USDC currently in the liquidity pool. Since Alice owns 10% of the pool, she would receive 0.5 ETH and 2,000 USDC if she chooses to withdraw her assets, which would be worth $4,000. If she had just held 1 ETH and 1,000 USDC instead, her funds would have been worth $5,000.
© CoinGecko Research
By providing liquidity, we can see that Alice made less money than she could have made by just holding. Even though she didn’t technically lose her initial capital, she experienced what we know as impermanent loss, which becomes permanent after she withdrew her tokens. Assuming she leaves her assets in the pool until the price of ETH drops back to 1,000 USDC, the impermanent loss will be reversed, and she may even make some money from the trading fees collected by the AMM.
How Do You Calculate Impermanent Loss?
Now that you’ve understood how impermanent loss occurs, how do you calculate exactly how much you’ve lost from providing liquidity? If the price of the assets in a pool changes by a certain amount, the total value of your deposits will be affected, and we can simply plot these results on a graph. Since we are talking about the price change, it does not matter whether the price of the assets goes up or down, as you would still be better off holding the assets instead.
© Alex Beckett, Understanding Impermanent Loss
For example, if one of the assets in the pool doubles in value, you would suffer an impermanent loss of 5.72%. However, this assumes that the weightage of both assets in a liquidity pair is equal. Some DEXs allow users to create liquidity pools with different weights or more than two assets, such as Balancer and KyberSwap. In this case, the impermanent loss would be calculated differently.
Depending on the amount of liquidity as well as the trading activity associated with a particular liquidity pool, depositors can generate a positive return if the earned fees exceed their impermanent loss or not at all. These fees that depositors can expect to receive are usually represented as APY.
DeFi has opened up many opportunities for users to put their assets to work. Instead of holding them in their wallet for the long term, their tokens can be used to generate returns via liquidity provision to different platforms. To attract more users, new protocols will typically introduce various campaigns and incentives, where depositors can earn the protocol’s native token.
More often than not, the price of the newly minted governance tokens will skyrocket, either due to excessive demand or low liquidity. In either case, the APYs for staking and providing liquidity balloon to massive proportions, which will attract even more depositors. However, as we’ve seen on numerous occasions, this form of liquidity mining is unsustainable and will not last for long. As such, it is essential to determine how the yields are generated and calculated. High APYs won’t count for much if the protocol doesn’t survive for long.
And even if the liquidity mining program has a more steady and sustainable emission of rewards, depositors should also consider the impact of impermanent loss. Cryptocurrency prices are always volatile, and if you’re not too experienced, you could earn much more by holding rather than providing liquidity. Sometimes being a lazy investor goes a long way but if you’re not too lazy, you can also make the most out of your yield-farming strategies by using our new APY and impermanent loss calculator.
Khor Win Win
Win Win is an avid gamer, interested in navigating the vast world of NFTs and the cryptoverse. Follow the author on Twitter @0x5uff3r