0/5
### Uniswap V3 - Amounts of Tokens Between Price Ranges In this lesson, we're going to be looking at how to calculate the amount of tokens between different price ranges using Uniswap V3. We'll be using the following equations to help us: ``` L / sqrt(P) = x L * sqrt(P) = y ``` Where L is liquidity and P is price. Using these equations, we will answer two questions: First, given liquidity L and price P, what is the amount of token x between P and P_b. On a graph, this is the amount of token x needed to move the current price, P, all the way up to P_b. Using the equations above, we can express x as: ``` x = L / sqrt(P) ``` Where L is the liquidity and P is the price. Then, when the price is P_b, x becomes: ``` L / sqrt(P_b) ``` And finally, taking the difference between these to find the length of the line we get: ``` x = L / sqrt(P) - L / sqrt(P_b) ``` Secondly, what is the amount of token y between P and P_a. On a graph, this is the amount of token y needed to move the current price, P, all the way down to P_a. Using the equations above, we can express y as: ``` y = L * sqrt(P) ``` Where L is the liquidity and P is the price. Then, when the price is P_a, y becomes: ``` L * sqrt(P_a) ``` And finally, taking the difference between these to find the length of the line we get: ``` y = L * sqrt(P) - L * sqrt(P_a) ``` So, to generalize these equations, we'll rewrite P, P_b, and P_a as: ``` x = L / sqrt(P_lower) - L / sqrt(P_upper) y = L * sqrt(P_upper) - L * sqrt(P_lower) ``` Where P_lower indicates the lower price, and P_upper indicates the upper price. For x we're considering the lower price, P, and for y we're considering the upper price, P. These equations will allow us to calculate the amounts of token x and token y between price ranges.
A simple introduction to Uniswap V3's liquidity provision. This lesson covers how to calculate the amounts of tokens held in liquidity between price ranges. You'll learn how to utilize two key equations for liquidity provision in Uniswap V3.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Concentrated liquidity and derive its equations
Uniswap V3 math
How to calculate the spot price of tokens
Single and multi position swapping
Factory contract architecture
How to calculate liquidity requirements
Uniswap V3 fee algorithm
Flash loans
TWAP price oracle
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on May 15, 2025
DeFi Developer
Uniswap V3Duration: 3min
Duration: 35min
Duration: 25min
Duration: 22min
Duration: 1h 43min
Duration: 11min
Duration: 1h 03min
Duration: 12min
Duration: 51min
Duration: 41min
Duration: 10min
Duration: 7min
Course Overview
About the course
Concentrated liquidity and derive its equations
Uniswap V3 math
How to calculate the spot price of tokens
Single and multi position swapping
Factory contract architecture
How to calculate liquidity requirements
Uniswap V3 fee algorithm
Flash loans
TWAP price oracle
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on May 15, 2025