Trend is your friend

Boosterpool
Boosterpool
Published in
8 min readMay 30, 2023

Introduction

Active liquidity management is crucial for maximization of liquidity provider profit. While developing Boosterpool active liquidity management strategies we face, among others, two problems at hand:

  • Evaluate performance of developed strategies in situations of different market trends (bull market, bear market and neutral market).
  • Compare developed strategies with #1 on the market of active liquidity management solutions — Gamma strategies.

For solving both tasks we developed a backtesting program that calculates profit of different strategies.

Description of Boosterpool strategies

Boosterpool can rebalance position on Uniswap V3, Algebra Finance (and any other AMM, that uses concentrated liquidity approach and Uniswap tick math) according to different criterias. Bot uses two sources of information for taking the decision about rebalancing:

  1. Statical information about the market, which is set in the config file for each pool.
  2. Dynamical information about current market situation, passed to bot in input json file for each block.

By “rebalancing” we mean the process of:

  1. Withdraw all liquidity from the current position and get all fees for it.
  2. Closing the current position.
  3. Calculate parameters (upper and lower tick) of the new position.
  4. Open a new position and transfer all liquidity to it, including fees.

Statical information about market includes:

  1. Criteria of position closing.
  2. Parameters of new position opening.
  3. Market support and resistance levels.
  4. Technical parameters about tokens and pool (decimals and pool commission).

There are several active liquidity management strategies, developed especially for Boosterpool. Let’s consider them in detail.

Strategies types on Boosterpool

Each active liquidity management strategy consist of two main parts:

  • Rules that describe how the position should be positioned in relation to market price at the moment when the position is opened.
  • Rule, which describes when the position should be closed.

As the second rule Boosterpool has two following criterias:

  • Position should be closed when the price crosses its ranges.
  • Or position should not be rebalanced.

For the first rule the situation is more complicated. For fixed position width strategy, optimal active liquidity management strategy can be created if the user takes into account additional information about price movement. Rough assumption of future price movement can be done by dividing it into 3 types, corresponding to different types of strategy:

  • Price will go up (“bull strategy”)
  • Price will go down (“bear strategy”)
  • Price will stay at the same level (“neutral strategy”)

If we have that additional information from the user it can be incorporated into strategy by changing the relative position of liquidity from market price. Namely, if we assume that price will go in some direction, then the main part of liquidity should be positioned at that part of the price. In Boosterpool we use the ¾ rule: if the price will go in some direction, then 75% of the liquidity should be positioned in the same direction. This can be achieved by selecting the position ranges in that way, that current price divides it in 75% to 25% ratio (or vice-versa). If we assume that the price will stay at the same level then the 50%-to-50% ratio will be selected. Each strategy provides more profit, if the price will go in the corresponding direction, but the user will suffer losses if his prediction of price movement is wrong.

Another important question is selection of position width. If we assume that we have market levels, which describe ranges of price movement, then we use the width of levels pair, that are nearest to current price value, as reference levels. Distance between such pairs of levels will be the width of the position. Visualization of different strategies is presented below.

Let’s consider the described strategies in detail

Supported types of position placing

Currently, our active liquidity management bot support the following position placing rules:

  1. Relative in tick spaces. In that case user need to specify in upper and lower distance from position start price to position bound ticks (“upper” and “lower” width respectively). When position rebalancing is initiated, new positions will always have specified distance from current price to position bounds in ticks. Another name is “fixed position width” strategy .
  2. Automatic placement by market levels. That option can be selected only if the user specifies at least two or more resistance or support levels for the market. Bot places the new position between nearest levels at rebalancing block, skipping user selected amount of levels above or below current price.

In both cases, since Uniswap does not allow placing position on arbitrary ticks, real position will be placed on the closest ticks, allowed by Uniswap math. It means the precision of position placement will depend on pool commission (see “tickSpacing” parameter of Uni v3 or Algebra pools).

Uniswap ticks width is different and depends from price, corresponding to that tick. Because of that:

  1. The width of the position will be fixed in ticks, but not in price.
  2. The width of the position cannot be an arbitrary value of ticks.

Strategies for volatile assets

For all of these strategies, position will be actively rebalancing if price goes outside the position bound. The same proportion of price to position division will be kept up on every rebalancing. Correct selection of strategy can significantly improve the obtained profit.

Neutral strategy

In that strategy we assume that price can — with the same probability — move either up or down. If the price moves out the position ranges the position will be rebalanced. Since we do not assume any restrictions about direction of price movement, we conclude that distribution of liquidity should be either equal. So in that case half of the position width should be above price, and half of the position should be below price (See Fig. 1).

Fig. 1. Strategy visualization. Blue horizontal lines denote market levels. Dark green line denotes historical price. Brown line denotes width between reference market levels, used as width of position. Yellow position represents the first position for neutral strategy. Light blue line shows the value of the current price.

Bear strategy

In that case we assume that all the price will go down. So we should put most of the liquidity down the price, to minimize the amount of rebalancing and impact of impermanent loss. We select ¾ as the ratio of liquidity distribution, where ¾ of liquidity will be below the price and the rest will be above price (Fig 2).

Fig. 2. Strategy visualization. Blue horizontal lines denote market levels. Dark green line denotes historical price. Brown line denotes width between reference market levels, used as width of position. Red position represents the first position for bear strategy. Light blue line shows the value of the current price.

Bull strategy

In that case we assume that all the price will go up. So we should put most of the liquidity up the price, to minimize the amount of rebalancing and impact of impermanent loss. We select ¾ as the ratio of liquidity distribution, where ¾ of liquidity will be above the price and the rest will be below price (Fig 3).

Fig. 3. Strategy visualization. Blue horizontal lines denote market levels. Dark green line denotes historical price. Brown line denotes width between reference market levels, used as width of position. Green position represents the first position for bull strategy. Light blue line shows the value of the current price.

Stable strategy

This strategy can be seen as a modified version of neutral strategy. The difference is that in a neutral strategy we rebalance position if price moves outside the hard ranges, and in direct strategy we do not move the position after initial placement, waiting for price return to the position ranges. This strategy is developed especially for pair of stablescons, where position should be centered around normal price for stablecoin pair (normally is 1).

HODL strategy

HODL strategy has two main differences from family of fixed width strategies:

  1. Usage of market levels for calculation of position width on rebalancing.
  2. Strategy uses logarithmic space for calculation of market levels and prices.

Example of position rebalancing using HODL strategy is presented in Fig.4. Let us consider the situation in detail. Let’s assume that we have the following user settings for strategy: skip 0 upper levels, skip 1 lower levels. First position was closed, when price crossed its upper range. At the time of position close levels, nearests to price position are levels 1 and 2. But in our example, according to user settings, first level downwards should be skipped, so the actual bottom range of position will be calculated using level 3. Strategy Is actual for ETH, BTC tokens.

Fig. 4. Example of position placing using HODL strategy for ETH/USDC pair in Traidingview interface. Pink squares denote positions. Blue lines denotes support and resistance levels.

Some notes:

  1. Each level is defined by start and stop points. Each point has two coordinates — block number and corresponding price.
  2. If the current block number is lower than the block number in start price point, or bigger than the block number in stop price point, then corresponding level is not taken into account and considered currently invalid. If the current block bot does not have at least two valid levels, it will close the currently opened position.
  3. Calculation of levels equations and comparison of levels and price values at current block are taking place in logarithmic scale with user-specified log base.

Boosterpool strategies backtesting in different market trends

Input data

For comparing boosterpool strategies in different market trends we use the following settings:

  • Token pair: USD Coin and WrappedETH.
  • Blockchain: Etherium
  • Price source: Uniswap V3 subgraph
  • Input liquidity: USDC.
  • List of strategies to compare: Bull, Bear, and Neutral (so-called “fixed position width strategies”).

Market description is presented in table 1.

Table 1

Results of calculation

Bull, bear and neutral strategies are calculated for all 3 market trends, so we have 9 variants of calculations, presented table 2.

Table 2. Strategy evaluation for different cases.

Descriptions of position rebalancing for results in table 1–2 we prepare figures 5–7.

Figure 5. Neutral strategy on a neutral market.
Figure 6. Bull strategy on bull market.
Figure 7. Bear strategy on bear market

Boosterpool vs Gamma

Input data

For comparing Boosterpool strategies with Gamma we use the following settings:

  • Token pair: USD Coin and WrappedETH.
  • Blockchain: Etherium
  • Price source: Uniswap V3 subgraph
  • Gamma positions source: gamma official site.
  • Input liquidity: 1000 USDC.
  • List of strategies to compare: Gamma WIDE, Gamma NARROW and boosterpool HODL, Bull, Bear, Neutral.
  • Start block:block 17000000, Apr-07–2023 11:58:11 PM +UTC
  • Stop block:block 17230500, May-10–2023 02:08:23 PM +UTC
  • Start price: 1866.1668125988
  • Stop price: 1883.25735557083

Results of calculation

Profit is calculated as the difference between input and output token amount presented in a given token.

Table 3. Results of calculation

Conclusions

Results of backtesting leads to some important conclusions:

  • Optimal strategy should have a minimal amount of positions (i.e. rebalancing), because a significant amount of rebalancing will result in impermanent loss.
  • While using boosterpool strategies it is important to correctly predict market trends.
  • Boosterpool strategies significantly outperforms gamma solutions.

Website | App | Twitter | Telegram

--

--

Boosterpool
Boosterpool

Manage your liquidity on Uniswap V3 more efficiently with automatic rebalancing and fees reinvestment!