# Weighted Moving Average (WMA) LP Strategy

## Introduction

The Teahouse Weighted Moving Average (WMA) LP strategy is built upon our single sided LP strategy, and generally has a more stable performance. The WMA modification implements two mechanisms that periodically allocate weights to position ranges and readjust them based on a specified rebalancing schedule and ROI ratio.

Before listing the backtesting results, let us delve into the logic behind the strategy.

## TL;DR

The WMA strategy covers a larger price range, with varying weights within the range.

The WMA strategy enforces additional hyperparameters to limit the rebalance amount and frequency.

This results in fewer rebalances (and therefore saves on IL and swap fees), but with the trade-off that the LP range is less-concentrated (and therefore has a lower earning potential).

## Concept of Teahouse WMA LP Strategy

A typical LP position aims to optimize liquidity efficiency and maximize trading fees earned by covering the spot price and moving the position with it. However, constant rebalancing and position movement often result in high operating costs. To mitigate this, our WMA LP strategy uses multiple positions with assigned weights to cover a larger spread while reducing impermanent/divergence loss (IL). Furthermore, it uses a self-adjusting and ROI-driven weight-management algorithm that dynamically optimizes the rebalancing schedule. See below for a visualization to better understand the concept.

### Common methods of liquidity provision

The left diagram shows a narrow LP position, concentrating the liquidity near the spot price. It should earn the highest fees but also incur the highest rebalancing costs and divergence loss.

The middle diagram shows a “long range” position that covers a greater spread with higher liquidity at the ends further from the spot price to reduce divergence loss, but at a reduced concentration.

The right diagram shows the WMA strategy which also covers a wider range of positions with adjusted weights based on the previous performance of each position.

In addition to the shape (allocation of assets) of the different LP strategies, most LPs will rebalance as soon as the spot price moves out of range and often when liquidity is added or withdrawn. The WMA strategy is designed to be time-adaptive in its rebalancing. The dynamic rebalancing frequency is constantly being tuned which allows for the examination of market conditions including current trading volume. Most importantly, it avoids unnecessary losses caused by extreme short-term price volatility during sudden market frenzies.

## How the Teahouse WMA strategy operates under different circumstances

To understand how the Teahouse WMA strategy works in detail, imagine that the liquidity is allocated into three positions: X, Y, and Z. Initially, Position Z, which holds a mixture of token A and B to cover the spot price at P, should have the highest weight because as long as the price stays within the Z range, the position will have the highest capital efficiency. After the price moves to Pa or Pb, at the next rebalancing time, the strategy should increase the weight of the position that has the highest ROI during the previous rebalancing period and reduce weights on the lower ROI ranges. An example is illustrated in Case 1 and 2 in the diagrams below:

## Back-testing Design and Findings

### Hyperparameters

There are three main control parameters:

**Maximum rebalance ratio each cycle:**{0.05, 0.1,…,0.75}. For example, if the rebalance ratio equals 0.2, then the maximum weight change will be 20%, or +/- 10%.**Rebalance schedule:**(every) 1 hour, 6 hours, 12 hours, 1 day, and 2 days.**Testing period:**60-days and 90-days with 30-days moving window of training data.

### Pairs tested

**Arbitrum:**DAI-USDC, USDs-USDC, WBTC-WETH, WETH-GMX, & wstETH-WETH**Optimism:**WETH-rETH & WETH-WBTC**Polygon:**WBTC-WETH & WMATIC-WETH

## Test findings

In most cases, the optimal rebalance time interval falls around 1 to 2 days.

For higher volatility pairs, the maximum rebalance ratio increases to 0.5 from the more common ~0.2.

For pairs with higher price volatility, there are times when the WMA strategy requires hourly rebalancing. Consequently, in the 60-day testing time frame, the performance of the WMA strategy is less favorable compared to the traditional concentrated LP strategy due to the high rebalance costs. However, when considering the 90-day time frame, the WMA strategy outperforms other methods.

All of the pairs tested, even the smallest-trading-volume pairs (with the lowest earning potential), are showing at least 2.5% return in the 90-day time frame using the WMA strategy.

### Sample backtesting results of the wstETH/WETH pair

## Conclusions and Future Directions

The Teahouse WMA LP Strategy offers several advantages in liquidity provision. First, it prioritizes profitability by dynamically adjusting weights based on performance. The strategy further incorporates regular rebalancing, ensuring optimal capital efficiency over time. Additionally, it provides flexible adjustment capabilities, allowing it to adapt to changing market conditions.

On the other hand, further improvements and optimizations are necessary for the strategy to be implemented more effectively, particularly when dealing with unstable pairs. Secondly, the strategy may not fully counteract divergence losses caused by extreme, long-term price movements that significantly deviate from the designated price ranges.

Despite its limitations, the Teahouse WMA LP strategy approach offers versatility through the ability to optimize for the desired metric(s). For instance, liquidity providers can shift the objective from ROI maximization to slippage reduction, leading to corresponding weight adjustments. This adaptability enables the LP strategy framework to be customizable and optimized based on specific goals and conditions.

Last updated