In a previous post, I introduced a new term called the impermanent loss rate, which measures the cost per annum of delta hedging a liquidity pool due to its embedded optionality.
In another post, I outlined the history of Uniswap and summarized the key formulas that characterize its AMM design. In the following post, I derive a closed-form formula for the impermanent loss rate of a Uniswap v3 liquidity pool position.
A Uniswap v3 “position” can be described with the following set of equations:
Or, by solving for x and y,
Now, by the chain rule (from Calculus 101), we can write
where y’ is the first derivative of y with respect to x. Therefore,
where P is the current price of the liquidity pool. By substitution, we have
Now, we can write the market value of the liquidity pool position as a stochastic process i.e.,
For example, in an ETH/USDC liquidity pool position, Pₜxₜ is the market value of ETH (expressed in USDC) and y is the market value of USDC.
But this only applies within the price range i.e., P ∈ (pₐ, pᵦ). Outside of this range, we have
Finally, we can write the position’s “payoff function” as a stepwise function i.e.,
Under the standard assumptions used in the derivative pricing literature, the value of a portfolio can be expressed as
where r is the risk-free rate and g(P) is the probability density function of P. Moreover, if we assume that P can only take positive values, then
To simplify things, we can rewrite this expression as a set of integrals from a constant to infinity:
But note that
for any random variable that takes only positive values. Hence,
Note that we now have three integrations of the forms
for some constant K. Before continuing, we derive the general solutions to these integrations under the assumption that ln(P) is normally distributed (i.e., the standard Black-Scholes model) with standard deviation w. From the properties of the lognormal distribution, the mean of ln(P) is m, where
Define a new variable
This variable is normally distributed with a mean of zero and a standard deviation of 1.0. Denote the density function for Q by h(Q) so that
(Note that π here is the famous constant and is unrelated to the use of π above, which means the value of the liquidity pool position.)
Now we can integrate over Q in lieu of P i.e.,
and N(x) is the probability that a variable with a mean of zero and a standard deviation of 1.0 is less than x. (Note that the naming convention d₂ mirrors that typically used in the Black-Scholes formula.) We can also write,
For the third type of integration, we have
Finally, we can return to our original problem:
We now apply the risk-neutral measure to derive the correct pricing formula.
And, by substitution, we have
And again by substitution,
which is the result we’re looking for.
Finally, we can characterize the Impermanent Loss Rate (ILR) as
See here for additional context on this term.
To get a sense for the ILR at different liquidity concentration levels, we define a constant c < 1 such that
When c = 1, you have maximum concentration. The case where c = 0 is equivalent to a traditional constant product AMM (like Uniswap v2). From a previous post, we know that when c = 0 (and assuming r = 0),
The formula derived earlier allows us to compute the impermanent loss rate for liquidity concentration levels greater than 0, which is the typical scenario for the Uniswap v3 liquidity pool position. The results are shown below for various levels of σ.
In a previous post, I considered how one might use the impermanent loss rate for liquidity pool investing. More specifically, I used the heuristic: Net APY = Nominal APY−Impermanent Loss Rate. (Nominal APY was estimated simply by dividing historical fees by the liquidity pool TVL.)
While the impermanent loss rate accounts for delta hedge losses, there are other things to consider for a more complete analysis of the topic from an investment perspective.
Firstly, as implicitly addressed here, the nominal APY (i.e., the LP fees) and the impermanent losses rate are positively correlated. (In fact, there is a view that liquidity pool fees will always exceed impermanent losses for any fee percentage greater than zero.) To see why this might be the case, consider any change in the liquidity pool price. This obviously results in an impermanent loss. However, the price change occurs only because traders buy or sell the swap, which generates fees i.e., there is no exogenous mechanism to change the liquidity pool price without fee-generating trading activity. Hence, a price change always means that a) both fees are generated and impermanent losses occur, and b) the size of the fees and the impermanent loss are both positively correlated with the magnitude of the price change.
Secondly, this heuristic assumes that the nominal APY isn’t correlated with P. But, of course, Uniswap v3 fees are not earned unless P ∈ (pₐ, pᵦ). Therefore, estimating nominal APY using recent history does not account for states where the LP position does not generate fees. In other words, E[nominal APY] can no longer be estimated by simply dividing historical fees by the liquidity pool TVL. The full probability distribution of P must be accounted for.
Hull, John. Options, futures, and other derivatives. Boston: Pearson, 2015. Print. (See Appendix to Chapter 15)