An all-in-one platform for Uniswap liquidity providers (prev Uniswap Calculator)
Uniswap V3 Fee Calculator, Visit: Poolfish, @poolfish_xyz
Disclaimer: please do your own research, this website is intended to be used and must be used for informational purpose only. It is very important to do your own analysis before making any investment based on your personal circumstances.
Report a bug or request a feature
il <= ic < iu
; where il
= lowerTickId, ic
= currentTickId, iu
= upperTickId, Pl
= lower price, Pu
= upper price)
deltaY = deltaL * (sqrt(P) - sqrt(Pl))
deltaX = deltaL * (1 / sqrt(P) - 1 / sqrt(Pu))
deltaX
) and token1 (deltaY
) we need to know deltaL
that make:
deltaY * priceUSDY + deltaX * priceUSDX = depositAmountUSD
deltaL * (sqrt(P) - sqrt(Pl)) * priceUSDY + deltaL * (1 / sqrt(P) - 1 / sqrt(Pu)) * priceUSDX = depositAmountUSD
deltaL = depositAmountUSD / ((sqrt(P) - sqrt(Pl)) * priceUSDY + (1 / sqrt(P) - 1 / sqrt(Pu)) * priceUSDX)
deltaL
, we can calculate deltaX
and deltaY
using these formulas mentioned in Uniswap v3 Whitepaper
deltaY = deltaL * (sqrt(P) - sqrt(Pl))
(Formula: 6.29, P.8)deltaX = deltaL * (1 / sqrt(P) - 1 / sqrt(Pu))
(Formula: 6.30, P.8)fee = feeTier * volume24H * (deltaL / (L + deltaL))
where:
volume24H
= average of 24h volume from [currentDay - 7, currentDay - 1]
L
= total liquidity (cumulative of liquidityNet
from all ticks that il <= ic
)deltaL
= delta liquidity, can be calculated from:
liquidityAmount0 = amount0 * (sqrt(pu) * sqrt(pl)) / (sqrt(pu) - sqrt(pl))
liquidityAmount1 = amount1 / (sqrt(pu) - sqrt(pl))
ic < il
; deltaL = liquidityAmount0
ic > iu
; deltaL = liquidityAmount1
ic >= il && ic <= iu
; deltaL = min(liquidityAmount0, liquidityAmount1)
See more on how the Uniswap Calculator works.
Crafted with 🧡 by @noahwbragg. Previously @chunrapeepat.