Volatility Related
To make fees truly responsive to market conditions, Cetus DLMM tracks both recent trading activity and price movements across bins. This section explains how the Volatility Accumulator (va), Volatility Reference (vr), and Index Reference (ir) work together to adjust variable fees dynamically, ensuring fair pricing and protecting against manipulation.
Volatility Accumulator (va)
The Volatility Accumulator measures cumulative price movements across bins during swaps. Each bin crossed represents a fixed price step, and Va adds up these crossings to reflect volatility beyond a single trade. For bin n, va is calculated as:
Where:
activeBinID is the ID of the currently active bin before the swap
vrprev is the volatility reference from previous trades
ir is the index reference used to stabilize va during rapid trades
Volatility Reference (vr)
vr updates according to the elapsed time telapsed since the last swap:
Filter period (tf): If telapsed < tf , vr remains unchanged to account for high-frequency trading.
Decay period (td): If telapsed ≥ td , vr resets to zero due to inactivity.
Intermediate decay: For tf ≤ telapsed < td , vr decays proportionally with a decay factor ρ : vr = ρ⋅va prev
This approach ensures that frequent trading increases accumulated volatility, while inactivity gradually reduces it.
Index Reference (ir)
A variable called Index Reference (ir) is also introduced to stabilize the calculation of volatility and prevent fee manipulation through rapid, repeated small trades. By keeping track of a reference bin, ir ensures that high-frequency trading does not artificially inflate the Volatility Accumulator (va), helping variable fees reflect real market activity rather than strategic splitting of swaps.
If telapsed ≥ tf (normal activity), then ir = activeBinID
If telapsed < tf (high-frequency trades), then ir = ir prev
Example
activeBinID = 200
tf = 2 s, td = 6 s, ρ = 0.6
vr at start = 0
Swap 1: crosses +2 bins (200 → 202)
ir = 200
va progression:
va(0) = 0 + |200 − (200+0)| = 0
va(1) = 0 + |200 − (200+1)| = 1
va(2) = 0 + |200 − (200+2)| = 2
va at end = 2
Swap 2: occurs 3 seconds later, crosses +5 bins (202 → 207)
vr decays: vr = 0.6 * 2 = 1.2
ir = 202
va progression:
va (0) = 1.2 + |202 − (202+0)| = 1.2
va (1) = 1.2 + |202 − (202+1)| = 2.2
va (2) = 1.2 + |202 − (202+2)| = 3.2
va (3) = 1.2 + |202 − (202+3)| = 4.2
va (4) = 1.2 + |202 − (202+4)| = 5.2
va (5) = 1.2 + |202 − (202+5)| = 6.2
va at end = 6.2
Swap 3: occurs 1 second later, crosses -3 bins (207 → 204)
vr = 1.2, ir = 202 (remain unchanged)
va progression:
va (0) = 1.2 + |202 − (207+0)| = 6.2
va (-1) = 1.2 + |202 − (207-1)| = 5.2
va (-2) = 1.2 + |202 − (207-2)| = 4.2
va (-3) = 1.2 + |202 − (207-3)| = 3.2
va at end = 3.2
Last updated