liquidity icon indicating copy to clipboard operation
liquidity copied to clipboard

dynamic swap fee mechanism

Open Hyung-bharvest opened this issue 5 years ago • 1 comments

There exists multiple generalization design space for swap fee.

  • liquidity pools with different swap fees
  • liquidity pools with dynamic swap fees
    • decided by governance
    • decided by predefined algorithm
  • swap fees sponsored by funds

Hyung-bharvest avatar Nov 04 '20 11:11 Hyung-bharvest

dynamic swap fee algorithm

  • based on volatility : higher volatility, higher fee
  • fee = 0.03 % + 0.4% * volatility
    • if volatility = 0%, then fee = 0.03%
    • if volatility = 60%, then fee = 0.27%
    • if volatility = 150%, then fee = 0.63%
    • volatility can be calculated from min/max price in a period image (https://www.eurexchange.com/resource/blob/43140/47ca53f0178cec31caeecdf94cc18f6e/data/volatility_and_its_measurements.pdf.pdf)
    • n = 30days, H,L for each 24 hours (1day high/low)

this algorithm automatically allocate 0.03% fee for stable pairs, higher fee for higher volatility pairs

Hyung-bharvest avatar Nov 25 '20 11:11 Hyung-bharvest