**Welcome to DeFit, with Trainer Joe**

**🏃♂️Session 4**

Today’s session will help you gain some serious knowledge about Impermanent Loss, an often misunderstood and subtly complex concept. You will learn about Liquidity Pools, AMMs, Impermanent Loss, and how to guard against it. Once you’ve read through, lock in those gains with our IL quiz at the bottom of this feature.

**Liquidity Pools**

A liquidity pool consists of equally-weighted token pairs, such as JOE and AVAX, and is a primary facilitator of DEX trading, enabling users to access liquidity which is essential for the swapping and withdrawal of tokens. Anyone can deposit a pair of tokens into a liquidity pool, earning in return a percentage of the trading fees, proportional to their share of the pool.

🏋️♂️ Rep 1: Liquidity pools on Trader Joe are made up of equally weighted token pairs at a 50:50 ratio.

**Automated Market Makers**

An Automated Market Maker (AMM) uses a mathematical formula in order to price assets. This differs from the model employed by traditional exchanges, known as an ‘order book’, where users have to interact with a counterparty in order to trade assets at an agreed-upon price.

AMMs are used to adjust token values in accordance with the purchase and selling of assets by traders. A common formula used by AMMs is **‘X * Y = K’,** where K is the product constant and X & Y represent the token pairs. The product constant refers to the pool’s total liquidity and is measured in the number of tokens supplied, rather than their dollar value which may be prone to change.

🏋️♂️ Rep 2: AMMs ensure that the product constant always remains the same

A common formula for this is ‘X * Y = K’

**AMM Example:**

10 AVAX (X) * 1000 USDT.e (Y) = 10,000 (K)

**Impermanent Loss (IL)**

So what do liquidity pools and AMMs have to do with Impermanent Loss? AMMs are the algorithmic pricing model used to ensure that the pool’s total liquidity always stays the same. This means that when a user deposits an equally weighted pair of tokens into the liquidity pool, the AMM is responsible for ensuring that balance is maintained.

Impermanent Loss occurs when the price ratio of the supplied token pair changes. As a simple rule, the more volatile the assets are in the pool, the more likely it is that you can be exposed to impermanent loss. As the AMM dictates that the total liquidity must remain the same, the ratio is readjusted in order to establish an equilibrium.

The ‘impermanent’ part of IL is an apt description, as the value of the token may yet return to its initial price if it is left in the pool. If the price realigns, then the IL no longer exists, however, if the investor withdraws their funds from the liquidity pool, then the loss is realized fully.

🏋️♂️ Rep 3: Impermanent loss is caused by a bidirectional change in value of either one or both tokens within a pair

🏋️♂️ Rep 4: The more volatile the underlying tokens are in the pool, the more likely you are to experience Impermanent Loss

🏋️♂️ Rep 5: Impermanent Loss is not permanent and is only realised when you withdraw from a Liquidity Pool

**Changing Ratios**

Impermanent loss results from a change in the ratio of the tokens. Let’s dive into an example to see how this may occur.

**Example**

A user (AKA a liquidity provider) supplies a pair of tokens to an AVAX / USDT.e pool at a 50:50 ratio.

*1 AVAX = $100**1 USDT.e = $1**50:50 = 1 AVAX : 100 USDT.e*

The liquidity provider (LP) supplies 1 AVAX and 100 USDT.e to the AVAX / USDT.e pool.

*1 AVAX + 100 USDT.e = $200*

The total value locked in the liquidity pool is 10 AVAX + 1000 USDT.e

*10 AVAX = $1000**1000 USDT.e = $1000**TVL = $2000**LP Share = 10%*

🏋️♂️ Rep 7: The LP share is determined by the percentage of their stake in the pool.

(LP / TVL) * 100 = LP Share

The AMM dictates that the amount of liquidity in the pool remains the same (AKA ‘the product constant’). This is calculated using the formula **‘X * Y = K’.**

*10 AVAX (X) * 1000 USDT.e (Y) = 10,000 (K)*

USDT.e is a stable-coin, so its dollar value is unlikely to change. AVAX, on the other hand, is not pegged and is prone to price fluctuations.

*Original AVAX value = $100**New AVAX value = $250 (an increase of 150%)*

🏋️♂️ Rep 8: Volatile token pairs are prone to IL due to price fluctuations, whereas stablecoins are highly unlikely to change in value.

The pool is now imbalanced, as the 50:50 ratio has been altered by the increase in AVAX’s price. The imbalance means that AVAX is now 75% cheaper in the pool, causing an arbitrage opportunity for investors looking to exploit differences in the price of an asset across the market. In order to regain a 50:50 ratio, AVAX has to decrease and USDT.e has to increase. This continues until 1 AVAX = $250 in the pool.

*Original AVAX/USDT.e ratio = 0.01 (1 USDT.e = 0.01 AVAX)**New AVAX/USDT.e ratio = 0.004 (1 USDT.e = 0.004 AVAX)*

🏋️♂️ Rep 9: The price ratio is determined by calculating using the formule

Y / X = Price Ratio

To return the pool to a 50:50 ratio, a formula is deployed.

*$AVAX = √(product constant * price ratio) = x**$USDT.e = √(product constant / price ratio) = y**$AVAX = √(10,000 * 0.004) = 6.32 AVAX**$USDT.e = √(10,000 / 0.004) = 1581.13 USDT.e**Original Pool Ratio: 10 AVAX : 1000 USDT.e**New Pool Ratio: 6.32 AVAX : 1581.13 USDT.e*

🏋️♂️ Rep 10: The formula for bringing the pool back to a 50:50 ratio involves the product constant (the pool’s total liquidity) and the price ratio.

X = √(product constant * price ratio)

Y = √(product constant / price ratio)

*Hard session, but keep at it. You’ll get DeFit.*

**Calculating Impermanent Loss**

The LP now wishes to withdraw their 10% share of the pool.

*AVAX: 0.632 (10% of 6.32 AVAX)**USDT.e: 158.11 (10% of 1581.13 USDT.e)**Total: $316.22*

The LP initially supplied $200 to the pool, and upon withdrawal received $316.22.

*Original Deposit: $200**Withdrawal: $316.22**Gain: $116.22 ($316.22 — $200)*

The LP has made a profit from AVAX’s 150% increase in value, however their tokens have suffered an impermanent loss.

*AVAX + USDT.e LP 50:50 = $316.22 (1 AVAX = $158.11 + 158.11 USDT.e)**AVAX + USDT.e HODL = $350 (1 AVAX = $250 + $100 USDT.e)**Impermanent Loss = 9.65% ($350 — $316.22 = $33.78)*

If the LP had held their assets in their wallet, the tokens would have appreciated in value without suffering the impermanent loss of the ratio rebalance.

🏋️♂️ Rep 11: Impermanent Loss is only measurable relative to the value of tokens held outside of the liquidity pool, e.g. your wallet.

**Impermanent Loss Calculators**

The above example illustrates the process by which IL may be realized. There are of course simpler ways of calculating the impact of impermanent loss by using an IL calculator such as:

**Calculate IL: https://dailydefi.org/tools/impermanent-loss-calculator/**

Simply input the price of Token A and B, followed by the new price of Token A and B, and voila — your IL will be calculated instantly.

**How to Avoid Impermanent Loss**

When dealing in volatile markets, IL is virtually inescapable, however, there are ways to mitigate the effects.

**Trading Fees**

On the Trader Joe platform, 0.25% of the trading fees are distributed as rewards to liquidity providers. In the above example, the 0.25% was not factored into the resultant IL calculation. In many cases, these fees are enough to offset any impermanent loss, with investors gaining more from supplying assets to a liquidity pool than simply holding them in their wallets.

**Low volatility pairs**

The more volatile the assets, the more likely the chance of impermanent loss. This means that tokens with a limited price range, such as stablecoins, are less likely to be exposed to IL. The advantage of stablecoins is that, when paired with more volatile tokens, they have the effect of offsetting the risk of any adverse price movements. This can be taken a step further by deploying assets in low-risk pools of pairings exclusively made up of stablecoins. The stability of these pools renders risk of IL virtually non-existent, allowing for changes in token ratios without much cause for concern.

Rep 12: You can mitigate IL by choosing low volatility pairs, such as stablecoins, and by factoring in the additional yield through trading fees.

Nailed it.

**Congratulations — Session Complete 🥇**

**Need further assistance?**

Come visit us in our Discord server to get dedicated one-on-one support.