Adaptive Fee
Overview
In order to calculate the fee value, information about the price change for the last 24 hours from oracle is used. Based on dynamic fee configuration and poolâs volatility data from the oracle, the fee value is calculated and applied to the swaps. DEX owners can configure different behaviors for the dynamic fee: set the minimum and maximum value of the fee and control volatilityâs impact on the fee.
How to set up specific formula behaviour
How to make a fixed fee?
set alpha1
and alpha2
as 0, set baseFee
as you want
How to increase/decrease max fee?
change alpha1
and/or alpha2
How to increase/decrease min fee?
change baseFee
Adaptive fee is overreacting
Increase beta1
and/or beta2
. Also it's better to change the gamma
accordingly
Adaptive fee is weakly responsive to volatility
Decrease beta1
and/or beta2
. Also it's better to change the gamma
accordingly
When will adaptive fee âcalm downâ?
Formulas take into account volatility and volume over the last 24 hours
How to tweak formula behaviour
Sigmoid coefficients Fee calculation can be tuned by the following parameters:
Adaptive fee function is a combination of several sigmoids. The plot of the standard sigmoid function looks like this:
We use a more flexible formula for sigmoids:
So additional params (alpha, gamma, beta) allow us to shift, stretch and modify sigmoids. By changing the coefficients, it is possible to provide a wide range of different options:
Default params:
So
max fee value is: baseFee
+ alpha1
+ alpha2
min fee value is: baseFee
midpoint of the first sigmoid: beta1
midpoint of the second sigmoid: beta2
sigmoid âjumpâ âstartsâ around beta - 6 * gamma
, ends around beta + 6 * gamma
alpha1
, alpha2
, beta1
, beta2
, gamma1
, gamma2
â coefficients for volatility sigmoids.
Contract Interaction
To change the adaptive fee configuration of a specific pool, it is necessary to call the corresponding function of the plugin connected to the pool.
plugin.changeFeeConfiguration(AlgebraFeeConfiguration calldata _config)
To change the default adaptive fee config that will be applied to the new pools, it is necessary to call the corresponding function of the pluginFactory.
pluginFactory.setDefaultFeeConfiguration(AlgebraFeeConfiguration calldata newConfig)
Additional materials
Learn more about Adaptive Fee in our Tech Paper
Last updated