DEXes are a marvel of technology, and it wouldn’t be outlandish to call them one of the wonders of the modern-day internet. Indeed, a decentralized, open, trustless market operated by verifiable and transparent code, where almost anything can be traded via fungible and non-fungible blockchain-based tokens, is at the very least worthy of such admiration.
One of the possibilities that tend to catch the eyes of newcomers is the APY (Annual Percentage Yield) and APR (Annual Percentage Rate) rates advertised on these marketplaces. These are rates expressed in percentage terms that are given as a reward for providing liquidity to a decentralized exchange. The main difference between APY and APR is that the former includes compound interest whereas the latter doesn’t, but both express annual rates.
But if you’ve ever taken the time to read about providing liquidity to a DEX, you’ve often heard of the term “Impermanent Loss”; but what does it mean? How can your deposited funds lose value over time? What are the risks to take into consideration, and is there a way of avoiding them?
Impermanent Loss Explained
In order to understand how impermanent loss works, we need to understand how DEXes work and what makes token swaps on a decentralized exchange possible. Unlike centralized exchanges (CEXes), most DEXes use an AMM (automated market maker) instead of an order book. In such cases, various parties provide liquidity to the exchange by depositing tokens in Liquidity Pools so that other traders can easily swap tokens on-chain.
Since one token is swapped for another, at least on the most basic level, different pools will consist of different token pairs. In order to add liquidity to any of these pairs, users will need to deposit both tokens with equal value. In return for providing this service, liquidity pools collect small swap fees (independent of gas fees) and distribute them proportionally to their contributions using smart contracts.
However, this comes with a caveat. Whenever the price of one token increases or decreases disproportionally to the paired token, the depositor suffers from impermanent loss and may walk away with fewer assets than they would have had had they merely held them in their wallets. Yes, even if the price of one or both tokens increases, impermanent loss can occur.
How Does This Happen?
Assume we have a pool of tokens X and Y, valued at $1,000,000.
The price of X at the time of depositing is $5.
The price of Y at the time of depositing is $10.
This means that the ratio of depositing X and Y tokens is 2:1 and that there are a total of 100,000 X tokens and 50,000 Y tokens in the pool.
Of that amount, a user owns $10,000 worth of X and Y tokens, which is 1,000 X tokens and 500 Y ones. But once they make the deposit, they don’t own a specific number of tokens, rather, a percentage of the pool which is represented by LP tokens (liquidity pool tokens) which can be used to withdraw one’s assets at any time.
Now let’s assume that the price of token Y surges upwards due to an exciting announcement or milestone, and reaches $20 per token. Due to the price differences, the ratio of tokens should change from 2:1 to 4:1 since each Y token is worth 4 times the value of X. This change takes place due to arbitrage traders taking advantage of price inefficiencies between token pairs like this, so they keep swapping X for Y to sell them in other markets for a profit until the price in this pool balances out.
As a result, there are now 141,420 X tokens in the pool and 35,355 Y ones.
So, when this user withdraws their 1% share of the pool, they now receive 1414.20 X tokens and 353.55 Y tokens worth $14,142. Yes, our trader did make a profit, but had they held their tokens in their wallet, they’d have $15,000 instead.
They suffered from an impermanent loss of 5.72%.
The larger the discrepancy between the price directions, the greater the impermanent loss becomes, regardless of the general direction of either token. In essence, unless the prices of the tokens are moving proportionally and in the same direction, impermanent loss will occur to some degree.
Here’s a useful tool for calculating impermanent loss!
How to Avoid Impermanent Loss
There are a few strategies one can utilize to minimize impermanent loss, but given how liquidity pools and AMMs work, there is no true escape from it.
- Stablecoins: Since stablecoins are pegged to an underlying currency, providing liquidity for stablecoins of the same currency should in theory be the safest from impermanent loss. Unless a major de-pegging event occurs such as that of UST, a user’s funds’ value should remain the same.
- Related projects: Providing liquidity for 2 projects heavily related to one another can be a safer approach than for completely unrelated projects. This is because when one project is doing well, its partner project might also see an uptick in price. Of course, the same idea applies when the price is going downwards.
- Ecosystem projects: Similar to the previous approach, projects in the same ecosystem may surge together when the ecosystem as a whole is booming, and/or the native ecosystem token is seeing a surge in demand.
- Long-term projects: Concepts that apply to investing in a project also apply to providing liquidity since, at the end of the day, you are purchasing project tokens to provide liquidity in the first place. If both projects are fundamentally sound, then both may be bound to rise given the time they need.
- External factors: Taking into account the external factors that influence the market, and more importantly, the projects you’re invested in, may give you a glimpse of probable future price actions, and hopefully, enough time for you to react.
Investment Pools: The Safer Alternative
You could, alternatively, provide liquidity to investment pools. What are they? In essence, they’re pools utilized by our incredibly sophisticated, AI-assisted, DeFi trading algorithm. We have a more in-depth article on investment pools which you can read by clicking here, but how they function is rather simple. Sentient, the algorithm in question, utilizes the funds from these pools to carry out various investment strategies, including but not limited to those that leverage arbitrage trading.
Since it’s easier to conduct profitable arbitrage trades (assuming you’re a lightning-fast program connected to dozens of CEXes and DEXes) the risk for losses is extremely minimal — if at all present. Sentient actually learns from previous trading data, including data fed from external sources, and uses the information to improve its strategy and make the appropriate adjustments for the best outcome! This is in addition to the experts behind the software itself, who can make manual adjustments and updates to further improve the protocol.
If you’d like to try out Sentient then be sure to stay tuned for the beta announcement!