Uniswap V3 LP Strategies Explored

Momin
Credmark
Published in
8 min readJul 29, 2021

--

In this article, I hope to explore 3 topics:

  • The importance of open sourcing yield strategies (and open source in general) as it pertains to creating a mature distributed financial system (aka DeFI).
  • an analysis of Bollinger bands as an LP strategy
  • a look forward at other strategies that we plan on implementing

The Benefits of Open Source

Last week, July 19th, Credmark launched its first consumer product, SmartPool, as a Beta. Alongside the launch, we released some insights we made while backtesting our strategies and decided to share that raw data publicly.

Continuing with that spirit, we are also sharing the code that powers our tool. Stored as a jupyter notebook, the code contains detailed comments and explanations on how our strategy operates.

This is the first step in our journey to fulfilling the goals we laid out in our white-paper. Primarily, we wanted to create a platform where our community would not only build models, but also hold each other accountable. In the future, we plan on having a system in place that incentives accountability through an automated governance system that rewards agents who critique and improve the models built on our platform.

In the short term however, we have to do things a bit more manually. Keeping things within the Liquidity Providing universe, we’ve seen how community driven data and insights can be beneficial. The clearest example is one of my personal favorite Dune dashboards, Uniswap v3 Vault Performance:

It’s not perfect (as many on crypto twitter will point out) but it allows us to track the performance of these strategies in real time and is a great genesis point of academic conversation.

We’ve seen Hayden James instigate online debate about optimal v3 strategies, and forums like the LP Cafe Discord channel have proven to be wonderful places to seek alpha when deciding to deploy capital.

Additionally, the folks at Visor and Charm Finance have made their code publicly available which has been instrumental for us and many others to better understand what works and what doesn’t when it comes to Uniswap v3 and what works best when investing in DeFi as a whole.

Not only can we explore the code used to make decisions, but we can evaluate the underlying data powering these models and come to conclusions as a community about whats important when interpreting on-chain data. This way, when DeFi begins to achieve mass adoption, we can confidently move forward with more sophisticated products knowing that we as a community have done the legwork to ensure that our data and products are best-in-class.

Onto the code!

Bollinger Bands

Bollinger bands are well known in the world of traditional finance. At their core, they are used by traders to help them make decisions about when to buy and when to sell a certain asset. How do they accomplish this?

Lets take a look at some code from our own strategy:

Calculate the moving average and standard deviation of a asset pair over a given time period

Bollinger bands utilize the moving average and the standard deviation of an assets price movement over a certain time period in the past. The bigger the standard deviation, the more volatile an asset.

Given the standard deviation, we can compute each risk strategy.

Using the standard deviation, we can formulate our strategies for each risk tier. Depending on the risk tier, we set the upper and lower ticks based on multiples of the standard deviation split 50/50 above and below the current price.

We can see in this example that we are using the past 10 days to calculate the standard deviation of an asset pair, and each strategy is a multiple of that number.

Bollinger bands are fairly simple, but given the right time frame and proper data, can be extremely effective in managing a portfolio of assets. For LP’ing, they provide a user with a simple way to set upper and lower boundaries for their position based on a historic sample set, saving the user a lot of time and effort when creating a position. But how effective are they in practice?

Let’s take a look at some active LP solutions that implement Bollinger bands. We’ll be referencing some charts off of the Dune dashboard shared earlier:

Visor Finance Strategy

Red is holding ETH; Blue is the LP strategy; Green is LP’ing into Uni v2.

Charm Finance Strategy

As has been well documented over the last few months, active LP’ing in v3 pools has not lead to any meaningful improvement over providing liquidity to the same pool in v2. Compared to holding ETH, both active v3 and v2 lessened the blow on downward price movement, but upward price movement benefited the v2 position in almost every case. One of the supposed benefits of Bollinger bands is that the window of time used to calculate volatility is constantly shifting, meaning that the strategy should adjust to recent trends, but the returns do not seem to reflect that.

It should be noted that the ETH-stablecoin pool in v3 have proven difficult to actively manage for pretty much everyone, including our strategies here at Credmark (reference my blog from last week for a clear example). But a semi-recent thread from Aloe Capital might provide a solution. Many active LP’ing strategies use one-sided range orders in order to rebalance a position that has become inactive. Using Bollinger bands however presents a problem when trying to rebalance:

Aloe Capital:

…the manager is saying that it is willing to accept a worse price for its excess tokens just to convert them faster. The movement of LP density toward the current price is formalizing “buy high, sell low”. And, if the conversion is made, IL is now permanent

…Each time the range position is moved closer to the current price, a loss is incurred…

Each time the movement of the order is in the direction of the current price (looking at the single-token part of an order), IL is “locked in”. This loss is realized when the order is fulfilled.

This mean “chasing” the current price aggressively will incur a loss.

And an example from Revert Finance is given using JNP’s tool, which shows how rebalancing when the the core strategy is based on Bollinger bands leads to IL so great that it offsets any additional fees earned from concentrated liquidity.

Finally, Aloe Capital provides a potential solution.

You can move LP density to shift the range away from the current price. If price actually moves into it, the LP has a net gain! (even disregarding fees!)

This has the risks of decreasing earned fees if the prediction is wrong, the lower density means less fees per trade. But the fundamental premise of an active LP manager is to keep trading in range, which means adjusting for longer-term changes in volatility and mean.

A reactive LP manager is an IL maximizer, and makes those losses permanent. A proactive LP manager is almost a trader, but one that does not need fine-grained price movements to come out ahead.

Great! So in order for an active LP strategy to be effective, we need to be able to predict price movement in some meaningful way. What would that look like?

RSI Strategy

Enter the Relative Strength Index strategy, better known as RSI.

RSI is similar to Bollinger bands in that takes historic data and creates metrics based on the standard deviation of price.. Where it differs is where it view the “middle”. Where Bollinger bands take the current price and creates a 50/50 range above and below, RSI takes the data from the timeframe and creates a biased range, generally a 70/30 range. What does this mean?

If the past 10 days show the price of an asset is trending upwards, RSI assumes that this asset is overbought and makes a prediction that there will be a correction downward. Similarly, if the trend is downward, RSI assumes that it is oversold and adjust the ranges anticipating a return upward. The 30/70 split comes into play when making this predictive choice. An asset that has downward price trend over past window will have a lower bound that is 60% the standard deviation and the upper bound will be 140% the standard deviation.

As stated by Aloe Capital, “A reactive LP manager is an IL maximizer, and makes those losses permanent. A proactive LP manager is almost a trader, but one that does not need fine-grained price movements to come out ahead”. When comparing RSI to Bollinger bands, a common explanation is that Relative Strength Index (RSI) is a leading indicator and Bollinger Bands is a lagging indicator. One way to interpret this is that Bollinger bands are reactive where RSI is proactive.

How does this play our in reality?

We can gauge the success from our own SmartPool application (app.credmark.com/strategy). Our strategy simulates both Bollinger and RSI starting from the mainnet deployment of v3 and simulates rebalancing the position for each risk preference. The data is limited, but the main metric to observe is how long each position remained active given the strategy.

The below examples are for the ETH-USDC 0.3% pool and each strategy is allowed to rebalance once every 5 days.

As we can see, RSI has a small edge over Bollinger for the Low and Medium risk cases. But we see the advantage when we go to the High risk strategy. Bollinger bands only stayed in range 90% of the time while RSI was able to maintain an active range for 96% of the time. The magic of RSI predictive made apparent in the number of rebalances. Bollinger had to rebalance 7 times where the RSI strategy only had to rebalance twice.

By leveraging a very simple form of implied volatility, the RSI strategy was able to effectively predict the price movement of ETH and keep the position in range far more effectively than a reactive strategy such as Bollinger bands. An even more effective strategy would be to gauge the volume and movement of ETH derivatives and gauge market sentiment and trends much like a professional day trader would. Bringing those types of metrics on-chain is a challenge, but there is clearly a path to an active LP strategy that is effective for a stable-volatile pair like ETH-USDC.

Keep an eye out for the RSI strategy in our SmartPool app in the coming weeks. Incorporating that with a rebalance feature will allow retail users to better take advantage of Uniswap v3.

--

--