Volatility-based Swap Fee
Bunni v2 implements a volatility-based dynamic swap fee mechanism that adjusts fees based on the deviation of the spot price from the Time-Weighted Average Price (TWAP). This feature is designed to optimize fee revenue and protect liquidity providers (LPs) during periods of high volatility.
Overview
The volatility-based swap fee is used in the absence of an am-AMM manager. It increases the swap fee quadratically as the pool's spot price deviates from the TWAP value, providing a simple yet effective way to adjust fees based on market conditions.
Fee Calculation
The swap fee is calculated using the following formula:
Where:
- is the fee percentage charged for a swap
- is the spot price of the pool after the swap
- is the TWAP of the pool
- is the minimum fee
- is the maximum fee
- is a scaling factor
All parameters (, , ) are non-negative, and .
Key Features
Quadratic Scaling: The fee increases quadratically with the deviation from TWAP, providing a rapid response to volatility.
Bounded Range: The fee is bounded between and , ensuring it remains within a reasonable range.
Directional Sensitivity: Higher fees are charged for swaps that push the spot price away from the TWAP, and lower fees for swaps that bring the price closer to TWAP.
Rapid Volatility Response: Large swaps that significantly deviate from TWAP immediately incur higher fees, protecting LPs during sudden price movements.
Benefits
Protection Against Volatility: Higher fees during volatile periods help compensate LPs for increased risk.
Improved Capital Efficiency: Lower fees during stable periods can attract more volume and improve capital utilization.
Automatic Adjustment: The fee adjusts automatically based on market conditions without requiring manual intervention.
Simplicity: The mechanism is straightforward to implement and understand, requiring only the current price and TWAP as inputs.
Considerations
TWAP Window: The effectiveness of this mechanism depends on choosing an appropriate TWAP window. A shorter window makes the fee more responsive to recent price changes, while a longer window provides more stability.
Parameter Tuning: The values of , , and need to be carefully chosen to balance fee revenue, LP protection, and competitiveness with other exchanges.
Market Impact: Very high fees during extreme volatility might deter some traders, potentially reducing volume during these periods.
Complex Market Dynamics: While this model provides a reasonable approximation of volatility, it may not capture all nuances of market behavior.
Interaction with Other Bunni v2 Features
am-AMM: The volatility-based swap fee is used only when an am-AMM manager is not present. If an am-AMM manager is active, they have full control over fee setting.
Autonomous Rebalancing: The volatility-based fee can help protect the pool during rebalancing operations that occur during high volatility periods.
While the volatility-based swap fee provides a solid default mechanism for fee adjustment, it's worth noting that an am-AMM manager using sophisticated off-chain models could potentially achieve even better results. The volatility-based fee serves as a robust fallback when am-AMM is not in use.