Published using Google Docs
ClipFinance-TechDoc-v20240310.docx
Updated automatically every 5 minutes

Clip Finance 

Clip Finance Dynamic Asymmetric System (DAS) for Liquidity Management of Volatile Pools

Methodology with backtesting results on Linea

Version:         March 11, 2024

Author:         Clip Finance

Table of contents

1. Introduction        3

2. Foundations of providing liquidity        5

3. Methodology        10

4. Backtesting results        14

Conclusions        18

References        19

1. Introduction

Current whitepaper focuses on describing strategies on how to efficiently manage concentrated liquidity positions by choosing optimal ranges and hedging price movement risk (i.e. impermanent loss). We provide backtesting results on various strategies to show how active management of liquidity positions can help to enhance returns of the liquidity providers (LPs).

Liquidity refers to the ability to quickly buy or sell assets in a market without causing a significant change in their price. It is crucial for efficient operations of markets and enhancing market stability. In decentralized finance (DeFi), liquidity is provided by participants who lock their assets in liquidity pools on decentralized exchanges (DEXs) which operate smart contracts for automated market makers (AMMs) to facilitate the process of liquidity provision. These liquidity providers (LPs) earn fees from trades executed against the liquidity they've provided.

The introduction of concentrated liquidity has significantly improved the capital efficiency and flexibility for liquidity providers. By allowing providers to allocate their capital within specific price ranges, smart contracts with concentrated liquidity market makers algorithm (CLMMs) offer improved control over risk and potential returns. CLMMs enhance capital efficiency compared to previously used AMMs but it comes with a challenge of actively managing liquidity positions to be able to take advantage of the capital efficiency boost.

However, given the volatility of crypto markets, it is a challenge to effectively provide liquidity in the DeFi markets as it carries inherent risks, including impermanent loss (a temporary loss compared to holding assets outside the pool), and exposure to sudden market movements. With CLMMs, the choice of the liquidity price range can amplify both the returns and the exposure to impermanent loss. Thus, LPs have some similarities to financial option writers, including the need for hedging delta and gamma risk.

To be able to efficiently provide liquidity, LPs need to get fairly compensated for taking such risk, as the use of constant function market maker algorithms (CFMMs) means that LPs have to inevitably sustain arbitrageurs order flow. It is also possible to consider LPs risk preferences or market view when setting up ranges.

This paper is organized as follows: Section 2 lays out the mathematical foundations of providing liquidity and illustrates how managing liquidity within certain price ranges can reduce risks and enhance returns. In Section 3, we describe our methodology for more effectively managing liquidity positions in tight ranges. Finally, Section 4 presents the results of our backtesting, which are based on the methods outlined in this paper.


2. Foundations of providing liquidity

The following section lays out the mathematical foundations of providing liquidity and is based on the excellent work of Ottina et al. (2023). This provides the foundation for developing the Clip Finance range management system.

In this section we refer to the price of token X in terms of token Y. The price range of the LP is referred to as [pa, pb]. When the price goes out of this range, the position’s assets are not used for trading. If the price falls below pa, then the liquidity provider’s position will be fully converted to token X, and if the price goes above pb, then the liquidity provider’s position will be fully converted to token Y. The liquidity function is defined as a product of the quantity of token X and token Y as: xy = L2.

Table 1. Real balances of tokens and value of a position for CLMMs.

Price range

Real balance of token X

Real balance of token Y

p ≤ pa

$$ \frac{L}{\sqrt{p_a}}-\frac{L}{\sqrt{p_b}} $$

0

pa ≤ p ≤ pb

$$ \frac{L}{\sqrt{p}}-\frac{L}{\sqrt{p_b}} $$

$$ L\sqrt{p}-L\sqrt{p_a} $$

p ≥ pb

0

$$ L\sqrt{p_b}-L\sqrt{p_a} $$

Price range

Value of a position

p ≤ pa

$$ V(p)=\left(\frac{L}{\sqrt{p_a}}-\frac{L}{\sqrt{p_b}}\right)p=L\left(\frac{1}{\sqrt{p_a}}-\frac{1}{\sqrt{p_b}}\right)p. $$

pa ≤ p ≤ pb

$$ V(p)=\left(\frac{L}{\sqrt{p}}-\frac{L}{\sqrt{p_b}}\right)p+L\sqrt{p}-L\sqrt{p_a}=L\left(2\sqrt{p}-\frac{p}{\sqrt{p_b}}-\sqrt{p_a}\right). $$

p ≥ pb

$$ V(p)=L\sqrt{p_b}-L\sqrt{p_a}=L\left(\sqrt{p_b}-\sqrt{p_a}\right). $$

Given the concentrated liquidity market making algorithm, the real balances of a LPs position depend on whether the market price is below the price range, in the price range, or above the price range and can be represented as in Table 1, which also presents the value of the liquidity position given the market price and the chosen price range.

The value of the LPs position in terms of token Y also depends on the current market price and is relatively flat when the price is above pb but poses open risk to when p < pb as seen in Figure 1.

A diagram of a function

Description automatically generated

Figure 1. Value of a liquidity provider’s position as a function of the price p.

Current illustration assumes that the value of the liquidity position is measured in terms of price p which would be the case for an investor, who measures his/her returns in terms of token Y which would usually represent a non-volatile token (e.g. a stablecoin). However, another risk of the LP is the impermanent loss which is the difference of the hypothetical gain of holding tokens deposited into the liquidity pool vs holding the liquidity pool position.

The size of the impermanent loss depends on the price p0 at the initiation of the liquidity position. For example, if p0  [pa, pb] the LP has to deposit tokens to the pool in the amount defined by the formulas in Table 1 which means that the LP will hold a certain amount of both tokens and will be vulnerable to price movements of both tokens in terms of impermanent loss. However, if the LP only held one token and had to go through a token swap to initiate liquidity providing, impermanent loss is just an hypothetical measure and the LP should economically probably more care about the liquidity provider’s position as shown in Figure 1.

If we look at the most common case where p0  [pa, pb] at the initiation of the liquidity position, impermanent loss can be calculated as the following:

   $$ {\displaystyle \begin{array}{ll} IL(p)&amp; =\frac{V(p)}{W(p)}-1\\ {}&amp; =\frac{L\cdot \left(\frac{1}{\sqrt{p}}-\frac{1}{\sqrt{p_b}}\right)\cdot p+L\cdot \left(\sqrt{p}-\sqrt{p_a}\right)}{L\cdot \left(\frac{1}{\sqrt{p_0}}-\frac{1}{\sqrt{p_b}}\right)\cdot p+L\cdot \left(\sqrt{p_0}-\sqrt{p_a}\right)}-1\\ {}&amp; =\frac{2\sqrt{p}-\frac{p}{\sqrt{p_b}}-\sqrt{p_a}}{\frac{p}{\sqrt{p_0}}-\frac{p}{\sqrt{p_b}}+\sqrt{p_0}-\sqrt{p_a}}-1.\end{array}} $$$$ {\displaystyle \begin{array}{ll} IL(p)&amp; =\frac{V(p)}{W(p)}-1\\ {}&amp; =\frac{L\cdot \left(\frac{1}{\sqrt{p}}-\frac{1}{\sqrt{p_b}}\right)\cdot p+L\cdot \left(\sqrt{p}-\sqrt{p_a}\right)}{L\cdot \left(\frac{1}{\sqrt{p_0}}-\frac{1}{\sqrt{p_b}}\right)\cdot p+L\cdot \left(\sqrt{p_0}-\sqrt{p_a}\right)}-1\\ {}&amp; =\frac{2\sqrt{p}-\frac{p}{\sqrt{p_b}}-\sqrt{p_a}}{\frac{p}{\sqrt{p_0}}-\frac{p}{\sqrt{p_b}}+\sqrt{p_0}-\sqrt{p_a}}-1.\end{array}} $$

This means that impermanent loss depends also on the price range chosen for providing liquidity. The narrower is the range, the higher is the sensitivity to price changes which means a higher gamma risk for narrower ranges. On the other hand, a narrow range provides more capital efficiency and thus higher leverage compared to having a wide range or providing liquidity without a range at all (e.g. as for Uniswap v2). Figure 2 illustrates the shape of the impermanent loss function in comparison for a concentrated liquidity position (or narrow range) vs unconcentrated liquidity (or wide range).

A graph with a red line and blue line

Description automatically generated

Figure 2. Impermanent loss of a concentrated liquidity (narrow range) position (blue color) vs unconcentrated liquidity (wide range) position (red color).

Providing liquidity in CLMM pools enables to collect fees in proportion which depends on the interval that each liquidity provider chooses, and fees are earned only when trades occur within the interval chosen by the LP. This means that some LPs may be able to earn more fees in respect to other LPs if their liquidity positions are more concentrated near the price where trading took place. However, there is a risk that having a too concentrated or large position near the current market price may give a larger opportunity for arbitrageurs to take advantage of price differences between different market venues, when market price suddenly moves. This scenario enables the LP to earn more fees but at the same time brings along higher probability of suffering impermanent or liquidity position loss and hedging LPs positions become more important.

Table 2 illustrates the capital efficiency gains between concentrated liquidity position vs non-concentrated liquidity position such as for example Uniswap V3 vs V2. Let  and given formulas of Table 1, we get the following approximate values for such ratios with corresponding  values which illustrate the leverage (or multiplier) effect of having concentrated liquidity position vs un-concentrated liquidity position as shown in Table 2.

For example, if r = 1.01, then pb = 1.021⋅pa, which means that price pb is 2.1% higher that price pa. In such an interval, the liquidity parameter of a concentrated liquidity position will be approximately 200 times higher than for unconcentrated liquidity position.  For example the leverage for a price range with the width of ca 2% is about 5 times higher than for a price range with the width of ca 10%. Such a leverage ratio can be interpreted as a measure of capital efficiency whereas higher ratio of  means higher capital efficiency.

Table 2. The ratios between concentrated and unconcentrated liquidity positions.

r

1.005

1.010025

401.5

1.01

1.0201

201.5

1.05

1.1025

41.5

1.1

1.21

21.5

1.2

1.44

11.5

2

4

3.41

10

100

1.46

Ottina et al. (2023) show that the amount of fees that a liquidity provider earns in a concentrated liquidity pool depends only on the price movement and the parameters that define their position and not on the positions of the other liquidity providers. The price movement itself can depend on the amount of liquidity in the pool but in most cases we consider the price movement to be external and driven by arbitrageurs. In such a case the amount of liquidity provided by the LP does not play an important role, as price shocks can all be considered external. The empirical simulation of Volosnikov, Pimenov and Tikhomirov (2024) seems to support that. The impact of just-in-time liquidity (JITL) can further complicate the backtesting of any strategies as it would make historical estimation of hypothetically earned fees inaccurate, but Li, Qian, and Lalwani (2023) show empirically that JITL contributes below 2% of volume.


3. Methodology

As outlined in Section 2, providing liquidity in concentrated liquidity pools with tight ranges can offer significant leverage compared to wider ranges or providing unconcentrated liquidity. The fees collected for providing liquidity depend on price movement and the chosen range. Thus, it becomes important to choose optimal ranges and consider possible risks of price movements to the liquidity position value or as an impermanent loss, by managing the delta risk and considering gamma exposure. Another input to choosing optimal ranges is the cost in terms of gas fees associated with adjusting liquidity position range in both absolute terms and as a proportion to the employed capital as also shown by Li et al. (2023).

Figure 3. ClipFinance process of range management

Our approach (see illustration in Figure 3) of adjusting ranges depends on various quantitative measures about the market state and price volatility and movement which are used as an input to the algorithm that suggests recommended range for a liquidity position. We employ an active liquidity management strategy as the volatility of the crypto market tends to be high so that passive liquidity management would require wide range selection which in turn means less capital efficiency.

Our dynamic asymmetric system (DAS) for liquidity management (see also Figure 4) includes the following components:

  1. Choosing or creating attractive liquidity pools which enable to collect fees in attractive proportions relative to the amount of employed capital.
  1. Fees earned in the pool have to compensate for open risk to price movement.
  2. Chosen pool must attract enough volume to produce the required minimum amount of fees.
  1. Using volatility prediction models, including autoregressive models in combination with realized volatility modeling and machine learning models to make both short- and long-term predictions of market volatility. We utilize the following volatility metrics in our models.
  1. Long-term volatility estimation from GARCH type of models
  2. Short-term volatility estimation from realized volatility models
  3. Implied volatility from CEX option market
  4. True range from the chosen liquidity pool
  1. Based on volatility estimation, custom algorithms determine optimal liquidity range width.
  1. Range width will be adjusted dependent on actual volatility and swap activity in the pool
  1. Machine learning models (incl. a custom implementation of a LSTM neural net model) and traditional technical analysis market indicators are used to predict and react to the changes of market price movement to adjust the liquidity range and take on necessary hedging measures. Based on the estimation, the following regimes will be identified:
  1. Positive market price trend
  2. Negative market price trend
  3. Neutral trend or price fluctuating in a channel
  1. Based on the direction of the market price movement or user risk preferences or market view, liquidity range will be adjusted dynamically:
  1. Dynamic asymmetric range in trending market
  2. Symmetric range in non-trending markets
  3. Asymmetric or symmetric range dependent on user risk preferences or market view

The general market regime estimations are based on longer term trends and outlook, whereas range and liquidity management models and algorithms are considering more short-term fluctuations as liquidity management is performed actively which can mean multiple adjustments per day in certain volatility situations but can, in contrast, result in rare weekly adjustments during low volatility markets.

Figure 4. ClipFinance Dynamic Asymmetric System (DAS) for range management.

The choice of liquidity pools for providing liquidity depends on the fee accrual rates but is also dependent on the characteristics of the traded assets. For low volatility assets (like stablecoins) the price movements are usually small which means that optimal ranges should also be small to provide higher capital efficiency. Small price movements also mean that trading in such pools may not be that profitable for arbitrageurs and thus the current characteristics of the pool (e.g. total value locked (TVL) in the pool and fee accumulation metrics) play a more important role. For volatile assets (e.g. WETH/USDC pair) it is more likely that arbitrageurs will trade in the pool, if the spot price changes. In the first case the fees earned will be lower and thus, price movement risk is smaller; in the second case the opposite is true.

Our volatility prediction models are inspired of the results of Bergsli et al. (2022) and Dudek et al. (2024) who show that various GARCH type of models can successfully be used for long term volatility estimation in cryptocurrency markets, whereas realized volatility models and machine learning models help to predict volatility more accurately in the short run.

The range selection algorithm is a function of volatility estimation to determine a suitable width of the range, at the same time considering the cost of rebalancing as a function of gas fees, pool fee tier and allocated capital amount. In addition to volatility estimation, the range selection algorithm considers the state of the market regime, as for example Li et al. (2023) show that range management in trending markets is more challenging, however our algorithm can suggest more frequent adjustment of ranges in such an environment, if the cost function does not restrict such position rebalancing.

Depending on the prediction of market movement, LPs may prefer different risk profiles. We offer a choice of strategies without or with included hedging components. Thus, users can decide based on their expected (or our model suggested) market direction the degree or direction of hedging liquidity position loss or impermanent loss. Such choice is warrantied as all hedging strategies come with a cost and our default hedging approach may not correspond to the risk appetite of every user.

4. Backtesting results

The following section provides backtesting results of our strategy algorithm on Linea chain. The algorithm is trained on hourly data. Volatility models as well as market prediction models use granular data from 1-minute to daily frequency. The algorithms are calibrated on the Linea chain using data from Pancakeswap. The results are based on a proprietary algorithm as outlined in the previous section. Comparative results are provided for unconcentrated liquidity providers as well as for parameters which are commonly used by other platforms (e.g. +/-20% from the current market price).

The backtesting period covers October 2023 to January 2024 as swap activity on Linea was too low before that period. The period coincides with the bull market as ETH price appreciated about 36% (from approx. 1650 to 2250 USD) during that period.

Our dynamic asymmetric system (DAS) for liquidity management can be characterized as choosing an asymmetric range dynamically based on utilizing various machine learning models. During the backtesting period, the range asymmetry was chosen based on an identified positive market trend. Dynamic asymmetric ranges can provide relatively narrow ranges to capture more fees, but at the same time do not get penalized by large price swings. Higher fee returns can be expected during more stable periods.

Our DAS switches between bull market, neutral market and bear market algos based on identified market regime as outlined in the previous section. We also present results of neutral and bear market algos. Such a comparison gives a more in-depth view of the worst case scenarios of what might happen, if our market regime detection model does not do a proper job. However, it should be noted that the baseline scenario for the backtesting period is the asymmetric bull market algorithm.

Figure 5. Comparison of liquidity position value change during the backtesting period and comparison to HODL 50/50..

As can be seen from backtesting results (see Table 3 and Figure 5 and 6), all ClipFinance algos have done relatively well for the period. The detected algo (asymmetric bull market) produces APR from fees of 37.4%. Measured in USDC, asset price appreciation contributed an additional 32% annualized. The asset appreciation contribution is a metric that measures the liquidity position value change. For example, if ETH price increases, holding a liquidity position incurs a profit because of such price increase. The goodness (and the aggressiveness) of the range adjustment algos can be mostly evaluated based on Fee APR. However, if the LP position holder measures returns in USDC, the more appropriate measure would be Total APR as it captures both fee accrual and asset price changes during that time.

Table 3. Backtesting results and comparison (Linea mainnet), returns measured in USDC.

Algorithm

Fee APR

HODL LP assets (APR)

Total APR

Avg. rebalances per week

ClipFinance asymmetric bull market algo (detected for backtesting period)

37.4%

32.0%

76.8%

0.6

ClipFinance neutral market algo

46.3%

12.8%

62.8%

0.5

ClipFinance asymmetric bear market algo

35.3%

5.6%

42.1%

0.5

ClipFinance hedged dynamic range algo (showing unhedged results)

105.1%

-32.0%

51.7%

1.2

Concentrated liquidity (v3) range of +/- 20%

22.3%

17.8%

42.7%

0.2

Unconcentrated liquidity (V2)

5.9%

38.5%

44.4%

0

HODL 50% USDC and 50% ETH

0%

69.9%

69.9%

0

HODL 100% ETH

0%

167%

167%

0

All ClipFinance algos showed high Fee APRs and Total APR. HODL 50% of  ETH and 50% USDC was very high for the period as ETH price happened to increase by 167% annualized (or 36% for the period).

It would also been possible to achieve very impressive results by using a hedged dynamic range (DHS) algo. But in reality no suitable hedging options were available during the backtesting period on Linea. DHS algo can also be coupled with a leveraged perp position based on user risk preferences or market view.

Figure 6. Comparison of fee accumulation during the backtesting period.

Holding volatile assets has inherently more risks and is more vulnerable to adverse price movements compared to holding a LP position.  Thus, for a more accurate comparison which considers volatility over the backtesting period, we compute Sharpe ratios for the strategies (see Table 4). This indicates that ClipFinance algos provide better risk-adjusted return for the liquidity position than any comparable approach during the backtesting period.

Table 4. Comparison of Sharpe ratios.

Strategy

Annualized return

Annualized STD

Sharpe ratio

ClipFinance asymmetric algo

77%

30%

2.6

Enhanced 50/50% ETH/USDC benchmark

78%

34%

2.3

Concentrated liquidity (v3) range of +/- 20%

43%

22%

2.0

Conclusions

We have established the fundamental strategies for effective liquidity provision in concentrated liquidity pools. Our findings demonstrate that by dynamically managing liquidity ranges in response to market conditions and volatility, one can achieve superior returns compared to passive management approaches. Backtesting results from ClipFinance proprietary algorithms show consistent and superior performance on the Linea mainnet compared to other liquidity provider options.

References

  1. Ricky Li, R., Qian, C., Lalwani, S., 2023, Active Liquidity Management in Uniswap v3, Range protocol whitepaper
  2. Trading, C., Ottina, M., Steffensen, P. J., & Kristensen, J. 2023, Automated Market Makers. Springer, 293
  3. Volosnikov, V., Pimenov, A., 2024, The Impact of Market Conditions and Fee Algorithms on the Design of a Competitive AMM, Algebra protocol whitepaper
  4. Bergsli, L.Ø., Lind, A.F., Molnár, P. and Polasik, M., 2022. Forecasting volatility of Bitcoin. Research in International Business and Finance59, p.101540.
  5. Dudek, G., Fiszeder, P., Kobus, P. and Orzeszko, W., 2024. Forecasting cryptocurrencies volatility using statistical and machine learning methods: A comparative study. Applied Soft Computing151, p.111132.