Uniswap V3: Demystifying Concentrated liquidity

Avran
7 min readAug 22, 2022

--

Demystifying Uniswap V3 and possible strategies to determine ranges for concentrated liquidity, none of this is financial advice.

Uniswap V3 is one of the biggest decentralised exchanges out there. In 2021, Uniswap V3 was released, claiming to be both more flexible and more capital efficient. As if normal Automated market makers (AMMs) aren’t complicated enough, Uniswap v3 introduces many new features like concentrated liquidity and range orders.

For your already experienced liquidity providers, these are the key differences between Uniswap V3 and a normal constant product AMM

Concentrated liquidity

Graph from Uniswap V3 whitepaper

The main feature of Uniswap v3 is concentrated liquidity. Compared to earlier iterations of AMMs, liquidity was distributed uniformly along a constant product (x*y = k) reserve curve, where 𝑥 and 𝑦 are the respective reserves of two assets X and Y, and 𝑘 is a constant. Essentially, this design allows users to provide liquidity across all price ranges from 0 to infinity. Since most assets will never see price action spanning the whole spectrum, this means that much of the assets held in a pool are never actually utilised.

Adding liquidity on Uniswap’s App

With concentrated liquidity, users can define a minimum and maximum price range they are willing to provide liquidity for, effectively concentrating their liquidity. Since a pool only needs to have enough reserves to support trading at a certain price, a concentrated liquidity pool can act like a constant product pool with larger reserves within that price range.

For example: Say you wanted to provide liquidity for the ETH/USDC pool.

In a normal AMM, all you would have to do is to provide ETH and USDC in a 50/50 ratio. But for Uniswap V3, you would also have to define the Min and Max price. If the current price is in the middle of the defined range, your ratio would be 50/50 else it will be skewed to one side depending on the curve of the pool. This means that if the Current price is out of your defined range, the liquidity at that range would be depleted, meaning you would hold 100% of either ETH or USDC. And your position would no longer earn any fees until it goes back into your defined range.

This creates a mechanism for market participants to decide where liquidity should be allocated. If the range is too big, you earn lesser fees but are more likely to stay in range, conversely if it’s too small, you earn a higher proportion of fees but run the risk of going out of range. LPs can decide where to concentrate their liquidity in places that would earn the most fees, allowing for a game-theory incentivised way of deploying capital

Range Orders

With concentrated liquidity, another interesting use case is Range Orders

For Uniswap V3:

If current price < Min price

The liquidity for X token at that price would have been depleted, converting your position to an entirely Y token.

If current price > Max price

The liquidity for Y token at that price would be depleted instead, converting your position to X token.

In this case, by narrowing the range, you are essentially setting a limit order for which asset you want to hold in which price range.

Multiple Fee tiers

Fee tiers available on Uniswap’s App

Finally, Uniswap V3 also allows users to customise their fee tiers. Since different pairs will have different risks of impermanent loss, it makes sense for volatile pairs to have higher fees, while stable pairs to have lower fees. Just another feature that improves the flexibility of Uniswap v3

Strategies

So what does this all mean for farmers?

The introduction of concentrated liquidity, adds a rather “active” step when it comes to yield farming. Instead of simply providing liquidity and letting it accrue fees, we now have to decide what range will give us the best fees. If the range is too narrow, we run the risk of it moving out of the range and losing fees. If the range is too wide we don’t get as many fees. The question that should be on our mind is how do I measure a viable range to provide liquidity?

If your goal is just to ensure you earn fees within a certain timeframe, one strategy we can use to estimate the price range is by calculating volatility. If you are looking to maximise your yield, maybe you are just better off copy trading positions with the best performance

Strategy 1: Copy trade

Revert Finance Dashboard

If you are lazy and simply don’t have the time to actively monitor your position, you might just be better off copying other people’s positions. One interesting tool we can use is Revert finance’s dashboard. It shows you information about every open position in a given pool. Depending on your risk tolerance and expected returns, you can simply filter by APR, position_age and so on. Of course, past performance doesn’t equate to future performance, but it’s still better than making a blind guess, especially if you don’t have the time or skills to calculate ranges yourself.

FlipsideCrypto’s Dashboard

To get a better understanding of how much your risk and reward are, you can also make use of calculators from Flipsidecrypto, which project your expected yield. These are all tools which you can use to make sense of Uniswap V3 from a liquidity providers perspective

Strategy 2: Running a Monte Carlo to estimate price range

Take note that data was used as of 27/07, and might be outdated by the time this is published

Monte Carlo simulation to project 30 day price action

Of course, if you are more technical and have the time, why not just run simulations to figure out the statistical price range given a period? Of course, this is also not a guaranteed method to profit, since predicting the prices of any asset is an incredibly difficult thing to do. But similar to the previous strategy, it’s at least better than nothing.

A Monte Carlo Simulation involves running many scenarios with different random inputs and summarising the distribution of the result. In our case, using the ETH-USDC example, we can calculate the distribution of returns for the price of ETH over a period, and use that to randomly generate price levels for a given time frame. By summarizing the resulting prices, we can gauge the probability that ETH will stay in a given range.

While the exact details of how to run a Monte Carlo simulation are not the purpose of this article, this will be our approach:

  1. Calculate the mean returns and standard deviation in the past year.
  2. Use it to simulate price changes for the next 30 days assuming a normal distribution.
Projected price distribution based on historical mean and std dev

From our calculations, the mean expected price of ETH is 974.64. While the current price (as of 27/07/22) is around 1450. I have also highlighted the top and bottom 10 percentile for visualisation.

Selecting price range on Uniswap’s App

Of course, the perfect scenario would be to have the current price sandwiched nicely in the centre, so that we can keep earning fees within the range. But given the volatile nature of crypto, this is tough to do. With the expected price lower than the current price, what we can do is to set the lower limit of our position below the expected price, and the upper range just above the current price. This is so that we have a higher chance of maintaining the range in the next 30 days. How much more or less you want to adjust the range depends on your goals and risk tolerance. As you can see, this is more or less where the majority of liquidity is at anyways. We can also use FlipsideCrypto’s calculator to project our yield as well.

That said, this method isn’t perfect either and has some limitations

  1. We are assuming that returns on ETH can be modelled with a normal distribution
  2. This analysis is also purely statistical. Since Crypto is run by narratives, an upcoming catalyst like ETH 2.0 can severely change the behaviour of the asset

At the end of the day, it’s tough to predict prices. Any bet on prices especially with cryptocurrencies will come with some (or a lot of) risk, and that is also why the people that can do it well stand to gain over 100% in fees. It’s best to use a combination of tools, whether quantitative or qualitative to set a suitable range for your risk tolerance.

Hopefully, this article has been useful to you. Uniswap and concentrated liquidity created a new mechanism for speculative yield farmers to toy around with. In the next piece, we will be looking at how concentrated liquidity changes risk metrics around providing liquidity, as well as possible methods to hedge against that risk. If you like the content do consider following me on my journey and sharing this around :)

Twitter: https://twitter.com/neavra_

References

https://revert.finance/#/pool/ethereum/uniswapv3/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 (Revert Finance Dashboard)

https://science.flipsidecrypto.xyz/uniswapv3/ (FlipSideCrypto’s Calculator)

https://uniswap.org/whitepaper-v3.pdf (Uniswap V3 Whitepaper)

https://app.uniswap.org/ (Uniswap App)

https://medium.com/analytics-vidhya/monte-carlo-simulations-for-predicting-stock-prices-python-a64f53585662 (Tutorial for Monte Carlo Simulations in Python)

https://www.interviewqs.com/blog/intro-monte-carlo (Introduction to Monte Carlo Simulations)

--

--