in

How to calculate Uniswap V3 curve for a position.

I’ve been trying to calculate my position in Uniswap V3, but when I do the math it doesn’t work out.

The formula is in the white paper, in formula 2.2.
https://uniswap.org/whitepaper-v3.pdf

But if I run a hypothetical example the curve intercepts are 1/8 what I would expect.

Here’s my math, assuming 1 ETH is 1000 usd, with range of 750-250

Min = 750 USD/ETH

Max = 1250 USD/ETH

StartETH = 1

StartUSD = 1,000

k = 1 * 1,000 = 1,000

L = sqrt(k) = sqrt(1000) = 31.62

Formula 2.2:
(x + L/sqrt(pb)) * (y + L * sqrt(pa) = L^2

Plug-in and solve for y:

(x + 31.62 / sqrt(1250)) * (y + 31.62 * sqrt(750) = 31.62^2

y = 31.62^2 / (x + 31.62 / sqrt(1250)) – 31.62 * sqrt(750)

If you plot this graph the intercepts are at ~250 and 0.25, but I would expect near 2ETH and $2000.

What am I doing wrong?

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

3 Comments

  1. I’m currently staking eth/usdc 1400-2400 range. at current price my lp is about 65% usdc and 35% eth.

    Your position in eth decreases as eth price rises. Once you get to 1251 eth price, you will have 0 eth and all usdc in your model.

  2. Not looking at this in detail, but if 1 eth = 1000 usd, and your range is 750-1250, you won’t be putting in 1 eth and 1000 usd. To have an equal 50-50 split, the geometric (not linear) distance from current price needs to be the same. So, if your lower range is 750, for 50-50 split your upper range needs to be 1000×1000/750 = 1333.

Welcome To Locklet $LKT A Real Use Token Coming To Revolutionize The Crypto Space!

OpenASK – Freely Claim BNB Rewards! Marketing is going strong! Anti-whale, anti-dump, automatically accumulate BNB rewards!| $0 Marketcap