Dynamic LP Fees
LP Fees that vary based on real-time volatility
Overview
We have designed and implemented a novel "dynamic swap fee" mechanism that adjusts the swap fees received by the LPs based on the real-time volatility of the underlying asset. The rationale is simple: higher volatility typically means higher impermanent loss for LPs so to compensate them, the swap fees rise when volatility increases and scale down when volatility subsides. The swap fees are calculated dynamically based on real-time market volatility. The fees range from a base fee of 40 bps to a maximum of 150 bps during high volatility periods and are adjusted every 1 min. Fees are automatically calculated and applied to each swap transaction.
The below details the analysis we did to design the fee mechanism, the overall design, the rationale for design and the implementation results simulated historically.
1. Data Foundation and Volatility Calculation
We looked at 6 years of historical data (as of July 2025) at a frequency of 1 minute intervals amounting to approximately 3.15 million minute-level observations
The volatility calculation employs a 60-minute rolling window approach. The last 60 minutes of price data (1-minute sampling) are used to calculate 1-minute log returns. The volatility calculated is the annualized 1-hour realized volatility (computed from 1-minute returns with a 60-minute rolling window):
annualized_volatility = log_returns.rolling(window=60).std() * sqrt(365 * 24 * 60)
Key Components:
Log Returns: Natural logarithm of price ratios for continuous compounding
Rolling Window: 60-minute (1-hour) lookback period
Annualization Factor: √(365 × 24 × 60) = √525,600 ≈ 724.68
This approach captures short-term volatility patterns while providing sufficient data points for statistical significance.
2. Volatility Distribution Analysis
The below chart shows the distribution of the hourly volatility over the last 6 years :

Minimum Volatility: 0.0217 (2.17% annualized)
Maximum Volatility: 13.9931 (1399.3% annualized)
Median: 0.40 (40% annualized)
Mean: 0.50 (50% annualized)
95th Percentile: 1.19 (119% annualized)
The volatility distribution exhibits:
Right-skewed distribution: Most observations cluster around low volatility levels
Heavy right tail: Occasional extreme volatility spikes during market stress
Concentration: Approximately 50% of observations below 40% annualized volatility
3. Fee Structure Design
The fee structure operates within defined bounds:
Minimum Fee: 0.004 (40 basis points)
Maximum Fee: 0.015 (150 basis points)
Transition Start: 0.40 (median volatility)
Transition End: 1.19 (95th percentile volatility)
Minimum swap fees of 40 bps applies for measured volatility levels of 40% and below. Maximum swap fees of 150 bps applies for measured volatility levels of 40% and above. Between these ranges swap fees are interpolated based on a smoothstep mapping function as detailed below:
def smooth_fee(volatility, min_fee, max_fee, v_min, v_max):
t = (volatility - v_min) / (v_max - v_min)
t = np.clip(t, 0, 1)
return min_fee + (max_fee - min_fee) * (3*t² - 2*t³)
This results in a fee mechanism with the following mathematical properties:
Smooth Transitions: First and second derivatives are continuous
Bounded Output: Fees constrained between min_fee and max_fee
Non-linear Mapping: Gentle acceleration in fee increases during moderate volatility
Plateau Behavior: Minimal fee changes at volatility extremes

Design Rationale
Lower Bound (v_min = 0.40):
Represents median market conditions
Ensures 50% of trading occurs at or near minimum fees
Provides competitive pricing during normal market conditions
Upper Bound (v_max = 1.19):
Captures 95% of historical volatility observations
Prevents excessive fee spikes during extreme events
Balances risk compensation with market accessibility
4. Implementation Results
We applied the fee design to the last 6 years of historical data. The below chart shows the distribution outcomes of the hourly fees.

The implemented fee structure produces:
Median of fee distribution: 0.41% (41 basis points)
Mean of fee distribution: 0.58% (58 basis points)
95th Percentile Fee: 1.42% (142 basis points)
Fee Range: 0.40% - 1.50%
The below charts show the 1-hour and and 1-day average fees in 2024 and 2025


This fee mechanism protects liquidity providers during volatile market conditions while offering competitive rates during stable periods, promoting efficient price discovery and fair value exchange.
Last updated
