zerokn0wledge

Impermanent loss explained: derivation, formula and mitigation

Thread787 words

Derives impermanent loss for a 50/50 constant product pool: LP return scales with sqrt of the price change while holding returns the average, giving divergence loss 2*sqrt(dP)/(1+dP) minus 1. Lists mitigation via stable pools and IL insurance.

Key claims
Net divergence loss is 2*sqrt(dP)/(1+dP) - 1, strictly negative unless price is unchanged
At a 500% relative price move, IL on Uniswap is about 25%
Stable asset pools on Curve and IL insurance (Bancor, THORChain) reduce the problem
0/ by providing liquidity on a #DEX like @Uniswap, users can earn trading fees & potential liquidity mining incentives💰 however, if you plan to provide liquidity on $UNI, $SUSHI, $JOE or $BOO & co you need to know about impermanent loss(IL)⚠️ explainer-🧵 on IL (0/24)⚖️👇 1/ I recently introduced AMM mechanics in detail. Before reading this thread, it might be worth checking out how AMM DEXes work: x.com/expctchaos/status/1568934063611969536 2/ re-using the #Uniswap example, market makers that provide liquidity to @Uniswap earn 0.3% transaction fees hence, more trading volume leads to higher profits for LPs, that earn from fees & potential liquidity mining incentives 3/ however, locking tokens into a liquidity pool can lead to losses relative to simply holding the two tokens. The more prices move, the higher the losses. This loss is referred to as divergence risk or impermanent loss 4/ let’s analyze it mathematically & assume Alice wants to deposit liquidity: - at time t = 0 Alice has quantities X & Y of 2 tokens (representing equal dollar values) - P(0) = P(XY) is the quoted price at time t = 0 • liquidity pools on $UNI have same ratio: x(0)*P(0) = y(0) 5/ s denotes the fraction of the holdings relative to the available liquidity: x(0) = sX(0) y(0) = sY(0) 6/ Alice wants to provide liquidity on Uniswap, posting X(0) and Y(0) for a time period t = 0 to t = 1 thereby she owns a fraction s of the liquidity pools & will earn a fraction s of the transaction fees accrued from the volume traded between t = 0 & t= 1 7/ now, suppose that during the period, the price moves by... - ∆P = P(1)/P(0) ...in gross percentage terms 8/ initially, the value in units of Y of the liquidity posted by Alice is: s(x(0)P(0)+y(0))=2*s(y(0)) 9/ at t = 1, after the price moved to P(1), the value changes to... - s(x(1)P(1)+y(1)) = 2*s(y(1)) ...where x(1) and y(1) are the available amounts of liquidity at t = 1 10/ the return from liquidity provision is therefore: R(liq) = (2*s(y(1)))/(2*s(y(0))) = y(1)/y(0) 11/ now, remember that the constant product rule gives: - x(0)*y(0) = k ⇒ P(0) = y(0)/x(0) = y(0)^2/k we can hence solve for y(0) to get y(0) = sqrt(kP(0)) 12/ similarly, at time t = 1 we have y(1) = sqrt(kP(1)) notice that k is a constant and hence the same in both equations. We can thus re-write the liquidity provision return as: R(liq) = y1/y0 = sqrt(kP(1))/(kP(0)) = sqrt(∆P) 13/ now let's look at the return that would have arised from merely holding the assets. Luckily, the return from holding X(0) and Y0 are simpler to compute 14/ since the monetary values of X0 and Y0 are the same, the return on holding is just the average between... - ...the return of holding X0, i.e. ∆P • ...the return of holding Y0, i.e. just 1 hence, the return from holding the tokens is: R(hold) = 0.5*(∆P+1) 15/ the divergence loss from providing liquidity on #Uniswap instead of holding on the tokens is therefore: DL = R(hold)/R(liq) = sqrt(∆P/0.5*(∆P+1)) = 2*(sqrt(∆P)/(∆P + 1)) this is always a strict loss unless ∆P = 1 16/ this plot shows the net divergence loss 2*(sqrt(∆P)/(∆P +1))−1 as a function of the price change ∆P 17/ the net profit or loss of a market maker (excluding potential liquidity mining incentives) thus depends on: - the price movements (loss from divergence) - the amount of traded volume (gain from fees) 18/ when providing liquidity on a $DEX like $UNI or $SUSHI, users should always consider impermanent loss (IL). IL also depends on the asset ratio and can hence vary between $BAL pools and 50/50 #Uniswap pools at a relative price change of 500%, $UNI users incur an IL of ∼25% 19/ impermanent loss calculators like the one offered by @coingecko can be helpful tools for investors: www.coingecko.com/en/impermanent-loss-calculator 20/ moreover, @ApyVision is a great tool to find the best liquidity pools out there and monitor your positions across multiple chains app.apy.vision/liquidity-pools 21/ to mitigate the problem of impermanent loss, one can simply provide liquidity in the form of stable assets (e.g. $wBTC & $renBTC or $USDC & $USDT) on @CurveFinance 22/ also, some decentralized exchanges like @Bancor or the cross-chain DEX @THORChain built on the #Cosmos SDK have introduced impermanent loss insurance mechanisms. Always worth checking out the details of the protocol your using to make sure you get the most out of it 23/ on that note, happy yield farming 24/ thanks for reading if you made it until the end! If you liked this thread, please support me by following & sharing the first post of the thread 🥰✨

4 images on X

Open on X

What came next · since 12 Sep 2022

Show how the 4 covered assets moved

This explainer walks through how things work without making a call on the token, so price moves since publication are shown as market context.

Mentioned for context
$UNIUniswapsince publication+11%−70% vs BTC
$SUSHISushisince publication−83%−96% vs BTC
$JOEJOEsince publication−87%−97% vs BTC
$BOOSpookySwapsince publication−99%−99.7% vs BTC

Daily closes in USD from DefiLlama and Yahoo Finance. Only a bullish or bearish call in a thesis or market take is tracked; explainers, lists, maps and mentions are neutral context. Not financial advice.

zerokn0wledge avatar
Working together

Research, advisory and builds for deep-tech teams.