Free lesson · DeFi models
Concentrated liquidity and range boundaries
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Concentrated liquidity deploys inventory only within a selected price interval. Narrow ranges create greater exposure changes and can become entirely one asset.
Symbols, units & horizon
- x: base units
- y: quote units
- L: liquidity scale with units sqrt(base×quote)
- p: quote/base price
- a,b: lower/upper quote/base bounds
- formulas valid inside the range
- fees excluded
When and why to use this
Compare range width, inventory concentration and the cash cost of moving a range after price changes.
Concentrated liquidity deploys inventory only within a selected price interval. Narrow ranges create greater exposure changes and can become entirely one asset.
Define quote-per-base price p and bounds a The formulas here describe one idealized range position using liquidity L and continuous prices. Actual token decimals, discrete ticks and rounding must be applied for a protocol implementation. L=100, a=1, p=4, b=9: base=100×(.5−1/3)=16.6667; quote=100×(2−1)=100. Build and explain a concentrated liquidity and range boundaries worksheet. Compare range width, inventory concentration and the cash cost of moving a range after price changes. Evidence boundary: Synthetic arithmetic and scenarios illustrate mechanics. They are not historical returns, a paper replication, or evidence of an executable edge. Research sources and their access limitations are recorded at the end of this module. Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment. Quantitative finance and development glossary · Python resources and libraries · Research sources and limitationsConcentrated liquidity and range boundaries
Apply it in a strategy
Research deliverable
Python implementation
# Python 3.10+; standard library unless NumPy is imported below.
# Inputs and outputs use the units defined in this lesson. Synthetic teaching example.
from math import sqrt
def range_inventory(liquidity,price,lower,upper):
if liquidity<0 or not 0<lower<upper or price<=0: raise ValueError("Invalid range")
p=min(upper,max(lower,price))
return liquidity*(1/sqrt(p)-1/sqrt(upper)),liquidity*(sqrt(p)-sqrt(lower))
print(range_inventory(100,4,1,9))Continue learning
DeFi: AMMs, Liquidity Provision and Lending — all lessons