Skip to content
项目

关于

An all-in-one platform for Uniswap liquidity providers (prev Uniswap Calculator)

商业与金融

这些数字如何统计

可以做什么

  • Fee calculation: select pair and pool, input deposit amount (USD), and adjust your lower and upper price
  • Liquidity position histogram and correlation chart to help you plan your strategy better
  • It's 100% open source! hope that Uniswap community will bring a lot more ideas and features to this project

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

🦄 UniswapCalculator

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

Features

  • Fee calculation: select pair and pool, input deposit amount (USD), and adjust your lower and upper price
  • Liquidity position histogram and correlation chart to help you plan your strategy better
  • It's 100% open source! hope that Uniswap community will bring a lot more ideas and features to this project

Calculation Breakdown

1. Calculate deposit amount of token0 and token1

  • Refer to Uniswap V3 Whitepaper (Formula: 6.29, 6.30, P.8), we can calculate total amount of each token by using these formulas: (if 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))
  • For estimation of the amount of token0 (deltaX) and token1 (deltaY) we need to know deltaL that make:
    • deltaY * priceUSDY + deltaX * priceUSDX = depositAmountUSD
  • So we can write a equation like this:
    • deltaL * (sqrt(P) - sqrt(Pl)) * priceUSDY + deltaL * (1 / sqrt(P) - 1 / sqrt(Pu)) * priceUSDX = depositAmountUSD
    • Then: deltaL = depositAmountUSD / ((sqrt(P) - sqrt(Pl)) * priceUSDY + (1 / sqrt(P) - 1 / sqrt(Pu)) * priceUSDX)
  • After we've calculated 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)

2. Calculate estimated fee

  • Estimated fee (daily) can be calculated by this equation:
    • 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))
        • if ic < il; deltaL = liquidityAmount0
        • if ic > iu; deltaL = liquidityAmount1
        • if ic >= il && ic <= iu; deltaL = min(liquidityAmount0, liquidityAmount1)

See more on how the Uniswap Calculator works.

Crafted with 🧡 by @noahwbragg. Previously @chunrapeepat.

探索相关项目

加载中…