Making Sense of Impermanent Loss

or, where the hell is my 137% APR??

R B
Coinmonks
Published in
10 min readJul 29, 2021

--

Primer on decentralized exchanges here.

Have you ever been teased by reports of friends or colleagues earning ridiculously high yields staking cryptocurrency on decentralized exchanges (DEXs)? You decide to go check it out for yourself, run a quick back of the napkin calculation to confirm that fees to liquidity providers (LPs) divided by total value locked (TVL) does indeed work out to an APR north of 100%. Naturally, you toss some tokens in the pool to see what happens. By your calculations, your balance should go up a few cents every minute. You wait, refresh, wait, refresh, and your balance doesn’t move. You refresh again, and your balance has gone down. What the *&@#??

We know that the drawback of providing liquidity to DEXs like Uniswap is impermanent loss (IL). But, as of yet, there has been orders of magnitude more risk taken in LP positions than work done to price them using sound economic analysis. What I will show (without hand waving) is that the risk of IL can be replicated using vanilla options, and thus a model-free estimate of the fair price of IL can be determined over some finite time interval. Then, I will use this result to calculate the breakeven amount of trading volume needed to compensate for the risk of IL and thereby show how to judge the potential profitability of participating in a liquidity pool.

The reference frame I will use is that of a constant product market maker (CPMM) like Uniswap v2, as the range-bound liquidity options provided by v3 complicate this analysis. I will generalize the result to v3 later.

For the uninitiated, I will begin with a brief overview of impermanent loss.

As the name suggests, the product of the quantity of two assets X and Y in a CPMM liquidity pool remain constant, enforced by the algorithms that run them. This condition gives us the well-known chart below illustrating the possible amounts of the two assets in our trading pair at any time. Since the algorithmic price of Y in our CPMM pool is derived by dividing the quantity of X in the pool by the quantity of Y, when the market price of one asset changes, arbitrageurs are incentivized to trade with the pool and thereby adjust the quantities of X and Y until X/Y matches the fair market price. As an LP to the pool, you own a pro rata claim on the pool’s assets, which comprise a changing quantity of X and Y based on traders’ actions. Therefore, your exposure to assets X and Y will vary over time based on price trends.

When k=1, the quantity of X and Y reserves in the pool will sit on this curve.

As an example, imagine the price of Y denominated in X goes to 0 (If you need a more visual example, imagine Y is ETH and X is USDC and the ether price goes to 0 due to a hack, government interference, etc). The CPMM protocol determines the price of Y algorithmically by dividing the quantity of X by the quantity of Y in the pool. Therefore, arbitrageurs will sell worthless Y to the pool at price X/Y until there is no X left — and the LP’s to the pool will be holding a bag of asset Y. So much for that 137% APY we were promised! The important result is that LPs’ exposure becomes entirely asset Y and they own no claims on asset X. Losses denominated in X (USDC in our example) would thus be double what they would have been had the LP’s just HODL’d their 50/50 portfolio of X and Y (in our example they lose all $100 whereas they would have lost $50 if HODL).

In the options trading world, we have a name for a changing exposure to the quantity of an asset as its price changes: gamma. Its properties, risk profile, and fair market price have been well understood in the trading biz since the 1970’s breakthrough of Black-Scholes. Using some (not so fancy) mathematical footwork, we can calculate the gamma of our LP position in the XY pool.

We start with the parameters of our CPMM. To simplify our analysis considerably without a loss of generality, let’s take asset X to be USDC and therefore its value (price) is always equal to 1:

Eq 1
Eq 2

Next, we write the value of our portfolio of X and Y as

In equilibrium, arbitrageurs will trade with the pool to enforce:

We can rearrange equation 2 to see that x = P y, and substitute into equation 1 to get:

Using the above, we can rewrite the value of our portfolio in terms of the parameters of the CPMM algorithm:

Eq 4

Finally, we can start taking derivatives with respect to the market price of Y (you’ll see why soon).

Eq 5

We now have a closed form expression for the gamma of the LP position in pool XY. As expected, it’s negative, which in industry parlance means LPs are short gamma, tantamount to a short options position. Because the value of a short options position is inversely related to volatility of the underlying asset, equation 5 mathematically illustrates why LP positions lose money on large price movements.

Insight from Carr and Madan (2001) shows that any continuous, twice differentiable payout f can be decomposed into vanilla options using the below formula:

Definition of European Call/Put payout at expiry. Note that (S-K)+ is equivalent to max(S-K)

In the above, f’’ is the second derivative of the payout with respect to the underlying asset price, which we have written down in equation 5. We do need to make a simplifying assumption now, which is to match the hypothetical lockup of our LP funds with the tenor (time to expiration) of the options we are using in the replicating portfolio. In other words, to price the risk of holding an LP position for 24 hours, we would need to use options with 24 hours to expiration as a benchmark.

Thus, the value of the LP position as written in equation 3 can be rewritten in terms of options on asset Y as follows (unfortunately we have to introduce big K, the strike price here):

Eq 6

Carr and Madan showed that having solved for gamma (f’’) at all P, we can replicate the LP position in vanilla options space. The f’’ are also known as the “weights”, as they describe how much of the option at strike K to include in the replicating portfolio.

Let’s put the math aside and switch back to intuition for a second. Recall that in the event of a crash of asset Y, the pool would be left with a portfolio of worthless Y tokens? Well, notice our weightings are proportional to sqrt(1/K³). This means that as K approaches 0, its weight goes to infinity. Said differently, the LP position is short an infinite amount of 0-strike puts. As the price of Y trends toward 0, arbitrageurs put an infinite amount of worthless Y into the pool to vacuum out all the X. Our math checks out with our intuition.

These results are extraordinary because, thanks to the liquid options market for ETH/USDC, we can actually use them in practice to make (or save) money. My favorite crypto options exchange has always been Deribit. We can check out the latest prices of ETH options here (make sure to click Ethereum in the top left hand corner).

To actually calculate the fair value of participating in the Uniswap v2 ETH/USDC pool, we will focus only on the last term in equation 6. This is because the first term (the one that does not depend on P) replicates the initial value of the portfolio (x+P y) and the second term (the one that depends on the first order of P) replicates the initial exposure to asset Y (that is, y units of Y). These terms have no convexity in P and thus are not interesting, since any non-convex payout can be replicated by borrowing money (or the asset) and purchasing (or shorting) units of the underlying asset.

To approximate the integral, we will discretize as follows:

In plain English, we will take the price of the out-of-the-money (OTM) put and call at all listed strikes with nonzero bids, multiply by the calculated weight (f’’), add them up, and divide by 2 (the negative just tells us we are short the options, not that illuminating). Additionally, I will assign a price of 0 to options slightly farther out of the money than the last listed OTM option with a bid. Finally, I will use the trap rule to numerically estimate the sum.

See my spreadsheet to view the calculation in action. I used the listed expiry closest to 1 week away at time of writing (it turns out to be 200 hours from expiration), and have chosen the constant product parameter k to be equal to 1. Also, the price of ether when I made this calculation was about 2305.

The estimated annualized return on the replicating portfolio of options in this case turned out to be 16.16%. Using the TVL in the Uniswap v2 ETH/USDC pool, we can now calculate how much fees need to be generated for LP’s to match the 16.16% annualized return of the options. Recall first that:

Now, we want to use the ROI we calculated to find the breakeven trading volume:

Eq 7

Around the same time as I snapped the options chain, I snapped the pool statistics on Uniswap v2, shown below:

Substituting observed pool TVL, our required rate of return of 16.16%, and the v2 fee rate of 0.3% into equation 7, we can solve for breakeven trading volume. We get a result of $14.7bn, which is an annual rate and equals a 7-day breakeven volume of $281.6mm. As we can see above, this is a bit higher than the trailing 7-day volume of $253.2mm, and can be interpreted in several ways.

One interpretation is that the market expects trading volume to be higher in the next 7 days than in the past 7 days, in which case the observed prices on Uniswap and Deribit can tie out. The more interesting interpretation is that traders on Uniswap v2 expect a lower volatility in the next 7 days than traders on Deribit, in which case an arb opportunity would exist in the absence of transaction costs. At any rate, the most important takeaway is that if you do not assume that trading volume will rise in the next week, an LP position on Uniswap v2 would have a negative expected value. This is because the cost of the options portfolio on Deribit is a “fair” or “efficient” value, i.e. the expectation of holding the position is 0, otherwise traders would buy or sell options and move the prices.

One final thing to note is that if you sold the replicating portfolio of options, you would very rarely expect to keep the entire premium collected, or 16.16%. For that to happen, the underlying asset price would have to equal the exact same price as when the position was initiated. If not, some OTM puts or calls would expire with positive value which the seller would owe. Similarly, you should almost never expect to earn the back of the napkin APR calculated by dividing expected fees by TVL.

There is a ton of research left to do here and I have just scratched the surface with this analysis. I am extremely excited about the new features introduced by Uniswap v3, and I look forward to writing about them. If you liked this article and it helps you make (or prevents you from losing) money, share it and send a tip to 0x4683e61663D1dF94340D09E3Ed92D7B05aF2FdB0. Also, follow me on Twitter at @BasriRoss.

Also Read

--

--

R B
Coinmonks

Technologist. I write about things I find interesting.