Selecting a Uniswap V3 Range

Stephen Hankinson
Arrakis Finance
Published in
7 min readApr 12, 2022

One of the hardest things to do with a Uniswap V3 LP Position is select the lower and upper bounds to use for a position. If we dig into some of the math behind the protocol, we can make better-informed choices about selecting a range that might make sense.

If we look at equation 2.2 from the Uniswap V3 paper, we can see an equation that relates tokens X and Y, the range limits Pa and Pb, and liquidity L.

If we take the Uniswap V3 position range to the limit where Pa is 0 and Pb is infinity, the range terms tend to zero, leaving the familiar Uniswap V2 equation for x · y = k, where k is .

This essentially lets us determine the least amount of liquidity that we would get for the Uniswap V3 position if we made the position cover the full range, and it would work very similar to a Uniswap V2 position.

Any position that is more narrow than the full range position will give us more liquidity for the same amount of assets as we are adding terms to both the X and Y multipliers, which is why this is known as concentrated liquidity in Uniswap V3.

To have your position earn more fees, you can increase your part of the total active liquidity by making your range more narrow. However, this does come at the risk of having elevated impermanent loss.

As shown in an article by Peteris Erins, the impermanent loss can be determined for a Uniswap V3 position with the following equation.

Here P is the initial price of asset X in terms of asset Y, while k is the gain that happens to P over a given timeframe. The values of Pa and Pb are the lower and upper price bounds set by the Uniswap V3 position. ILa,b(k) is the impermanent loss experienced by that range for a given gain k and Uniswap V3 LP position.

As you can see, the more Pa moves up from 0 and the more Pb moves down from infinity, the denominator will get smaller for the same value of k, meaning a larger impermanent loss.

The main goal for a Uniswap V3 position should be to set a range that gives enough liquidity in the active range so that the position earns enough fees to at a minimum counteract the impermanent loss for the maximum expected price movement of the assets over the investment period.

In order to possibly work out what that range might be, we need to make a few assumptions. We need to have an idea of how much fees could be earned by the position and we need to have an opinion of how high or low the price of the assets could move over the investment time horizon.

If we take a look at the Uniswap V3 USDC/ETH 0.05% pool, as I’m writing this, it currently has 764M in daily volume, meaning the active liquidity is earning about $382k/day in fees. The total active liquidity for the pool at the time of writing is about 38313936.

Currently, the price shows that 1 ETH is equivalent to 3500 USDC. This means that for a full range Uniswap V3 position we would add 1 ETH for every 3500 USDC added and the liquidity L earned for such a position would be about 59.

That means that this position would earn about 0.00015% of the daily fees from the pool, or about $0.59/day. If this remained static for the year, that is $215.35 earned in fees for the initial $7000 investment, giving approximately a 3.1% APR.

If we assume for this example that the price of ETH will end the year somewhere between a 33.3% loss or a 50% gain, k = 2/3 or k = 3/2, for a full range position we get the following:

This means that in our example the full range position would come out ahead, even if the price of ETH went down by 33.3% or went up by 50%, and do even better if the price ended the year somewhere in the middle of that range.

This is because the position would have earned 3.1% in fees and lost a maximum of 2% to IL in that price range, meaning a 1.1% improvement or better over buy and hold assuming the price remained within our k bounds.

In a future article, we will show how to determine the k values which give exactly a 3.1% impermanent loss. That will help show how far the price could move before the position becomes unprofitable due to the impermanent loss eating away at the earned fees.

What if we wanted to try and make a more concentrated position so that we can earn more fees? After all, that is what Uniswap V3 was designed to do.

The main issue is, how do you know what values to set the range of the LP position to?

Well, we can re-arrange the IL equation to solve for Pa and Pb if we know the current price P, if we have a specific lower k and upper k in mind and have a maximum amount of IL that you’d be willing to hit.

If we re-arrange the IL equation to solve for Pa we get the following:

If we also re-arrange the IL equation to solve for Pb we get the following:

Since we know the current price P and the max IL we want to see for our range of k, we can treat those two parameters basically like constants for our scenario.

If we substitute k in the Pa equation for k1 to reference one of the gains we are targeting and substitute k in the Pb equation for k2 to reference the other gain we are targeting, we can essentially solve the two equations with two unknowns.

Replacing the Pb in the Pa equation with the second equation above and expanding things out and simplifying a bit, we end up with the following equation for Pa which depends only on P, k1, k2, and IL.

Once we use this to solve for Pa, we can then enter that value into the Pb equation above to also solve for Pb.

Note: This only works if you are using an IL in these equations that is less than the IL for a full range LP position, about -2% in our example. This is because making the range more narrow always increases IL (makes it more negative).

Going back to our example, what if we were willing to tolerate up to 10% in impermanent loss. Would we earn enough fees to compensate for that?

For a 10% impermanent loss IL, k1 being 2/3, k2 being 3/2, and the current price P being 3500 we can solve for Pa and Pb:

Using these values, we can plot what IL looks like for a varying k over our expected range.

If we rework the initial equation mentioned at the top of this post to solve for liquidity, we get:

If we solve this equation with Pa=2228.58, Pb=5496.76, x=1, y=3500, we end up with our liquidity L being about 292.8.

This new liquidity for the updated position would earn about 0.00076% of the daily fees from the pool, or about $2.92/day.

That means that this new liquidity position would earn about 0.00076% of the daily fees, or about $2.92/day. If this remained static for the year, that is $1065.80 earned in fees for the initial $7000 investment, giving approximately a 15% APR.

So as long as the price stays within our 33.3% loss to 50% gain estimate over the year-long period and we earn the expected fees, we should be guaranteed to be ahead of buy and hold by at least 5% since we will have at most 10% lost to impermanent loss for the 15% earned in fees. If the price moved less than these amounts we are even further ahead as seen in the graph above.

As mentioned, in a future article we will show how to determine the k values which give exactly a 15% impermanent loss to see how far the price could move before the position becomes unprofitable if all the assumptions hold true.

We are in no way saying that the price of ETH will remain within a 33.3% loss or a 50% gain window over a one-year period or that the swap volume will remain a constant $750M per day. We are simply using this as an example of how you might choose your Uniswap V3 position based on your opinion of price movements and the potential fee earnings of a pool.

If you are interested in learning more about how to manage liquidity on Uniswap V3 in the most efficient way, then connect with us on the official Arrakis Ecosystem Discord channel!

--

--

Stephen Hankinson
Arrakis Finance

Senior Backend Engineer/R&D Financial Models at Arrakis Finance