Trading Dev AcademyFree quant education

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.

x=L(1p−1b),y=L(p−a),a≤p≤b
Model assumptions, derivation and arithmetic

Concentrated liquidity and range boundaries

  1. Base inventory equals L times the reciprocal-square-root distance from p to upper bound b.
  2. Quote inventory equals L times square-root distance from lower bound a to p.
  3. At a, quote is zero; at b, base is zero. Clamp price to bounds when computing frozen outside-range inventory.
Work it by hand

L=100, a=1, p=4, b=9: base=100×(.5−1/3)=16.6667; quote=100×(2−1)=100.

Apply it in a strategy

  • Compare range width, inventory concentration and the cash cost of moving a range after price changes.
  • Record the input timestamp, executable quantity, currency and horizon. Reconcile the result with a cash-flow or state table.
  • Stress this failure condition: Leaving the range can stop fee participation while retaining a one-sided asset exposure.

Research deliverable

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.

Python implementation

Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.

# 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
  1. Constant-product swaps with an input fee
  2. LP inventory after price changes
  3. LP value versus holding the original tokens
  4. Concentrated liquidity and range boundaries
  5. LVR and the price of stale inventory
  6. Lending utilization and rate response
  7. Collateral health factor and correlated shocks
  8. Liquidation incentives after execution costs

Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations