# Dynamic Fee

Besides the programmable pricing curve model, we also introduce a dynamic LP fee model that adjusts the AMM LP fee based on market conditions. Most existing AMMs have a simple LP fee model (e.g. a fixed percentage of the trade value). This does not reflect what is happening in traditional capital markets, in which market makers adjust the trading spread based on market conditions to either protect themselves (when market is fast-moving) or attract more trades to incentivize more trades.

We wanted to bring this important fee/market volatility correlation to AMMs.

Particularly, in our dynamic fee model, the LP fee is increased when the market is moving fast (i.e. becoming volatile), and is reduced when the market is stable (less volatile). In a 'quiet' market, the dynamic fee model encourages the user to trade more by offering tighter spreads through the reduction of LP fees. The increased volume attracted by the lower spread will arguably make up for the revenue loss due to the reduction of the LP fees. On the other hand, spreads are increased by charging higher LP fees when the market is volatile. Traders or users who trade in such volatile markets will receive fewer tokens than average, as the profit is kept in the pool to reduce potential impermanent loss for LPs. Thus, this dynamic fee model encourages market stability in Defi through spread adjustments.

There are several ways to implement this dynamic fee adjustment mechanism deterministically. The DMM's approach is based on the on-chain volume of each pool. To determine the fluctuation of the DMMโs volume, the AMM compares its volume between the short window and long window using methodologies such as Simple Moving Average (SMA) or Exponential Moving Average (EMA).

### #

Dynamic Fee Adjustment based on VolumeBased on this bonding function, when users want to sell $\Delta x$, the formula for $\Delta y$ they get in the Dynamic Fee model is:

where:

- $x, y$ are the current inventories of 2 assets $X, Y$
- $fee$ is the base fee, pre-defined by AMM
- $z$ is the variant factor, dependent on the average volume of AMM during a time period. It must satisfy the condition $0 < 1 โ fee โ z \leq 1$, alternatively written as $โfee \leq z < 1 โ fee$