# 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. BlueLotusDAO's approach is based on the on-chain volume of each pool. To determine the fluctuation of BlueLotusDAO'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 Volume <a href="#dynamic-fee-adjustment-based-on-volume" id="dynamic-fee-adjustment-based-on-volume"></a>

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

$$
\Delta y = f(x) - f(x + \Delta x \cdot (1 - fee - z))
$$

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$$


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://genesyblockchain.gitbook.io/genesys-blockchain/bluelotusdao/bluelotusdao-products/bluelotusdao-protocol/dynamic-fee.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
