# An article to understand Uniswap V3 uncompensated loss calculation, higher or lower risk?

How much is the Uniswap V3 liquidity nil loss?

Earlier this week I wrote about how to derive the Unconstant Loss formula for Uniswap V1 and V2. We will use the same approach to calculate the invariant loss for Uniswap V3 and concentrated liquidity positions.

Imputation loss is a popular concept for automated market makers (AMM) like Uniswap. As a liquidity provider, your position may fall in value relative to any asset, and the inconstant loss is usually defined as the percentage loss suffered by the LP for a given price movement.
Uniswap V3 liquidity providers offer liquidity within a fixed price range. This feature is called centralized liquidity. But what does it mean to provide liquidity within a fixed range [a, b]? In the case of position concentration, the reserves of both assets in the pool are depleted at a higher rate during the trade, causing them to be completely exhausted at either end of the range (a or b).

You can think of this as providing liquidity through leverage. You can provide more efficient liquidity (also called virtual liquidity) if the price is not out of range. If this is the case, you have only 1 asset left in your position and will not earn transaction fees until the price moves back into that range.

When trading with leverage, gains and losses are magnified, as is the case with Uniswap V3. Concentrated positions have a higher share of transaction costs, but also higher impermanent losses. We will find out exactly how much.

Definition
We give an example of a market with liquidity L. In a concentrated liquidity position, the number of assets X and Y are x and y, respectively.

We set the initial price of asset X to P based on asset Y = y / x and consider the price change to P’ = Pk, where k > 0. We also define [p_a, p_b] as the price range of our concentrated liquidity position. Assume that both P and P’ are within this interval.

According to the white paper, the reserve for a concentrated position can be described according to this curve.

This means that for a given price range, a smaller set of reserves x, y can act as a larger set of reserves.

From our previous post, we can determine the virtual reserve based on liquidity (L) and price (P), which we can use here.

We again define three values.

V_0, the value of the initial holding of asset y

V_1, the value of the holding if retained in the pool (x, y shifted with price)

V_held, the value of the holding if retained outside the pool (x, y constant)

Derivation
As before, V_1 is equivalent to replacing P in V_0 with P’.

Next is V_held.

Finally, we calculate the invariant loss as a percentage change.

where IL_a,b(k) is the invariant loss of a concentrated position in the range [p_a, p_b] and IL(k) is the invariant loss of a V2 position in the range (0, +∞).

We can do two quick checks. First, in the extreme case of p_a = p_b = P, then the invariant loss will be 0.

Second, we can set p_a → 0 and p_b → +∞ and see that IL_{0,+∞}(k) = IL(k), which means that the larger the price range, the more this equation converges to the invariant loss equation for V2.

Finally, setting k = 1, we do get 0, since there should not be any invariant loss in this case.

Caution
Note that if prices fall outside the liquidity range [p_a, p_b], this equation will not apply because asset holdings stop changing outside the price range. We leave it as a simple exercise for the reader.

Analysis
How large is the invariant loss? Consider a simple example where p_a/P = 1/n and P/p_b = 1/n. In this case.

We can see what this ratio looks like for different values of n.

Even if our liquidity range is large enough to accommodate a doubling or a cut in price, the impermanent loss is nearly four times higher than if we were to provide liquidity across the entire price range. This does not include the impermanent losses associated with falling outside of the concentrated liquidity range ……

In short, keep your money safe!