Lab · Demo 01 · Range
Concentrated-liquidity range demo
My re-creation of the concentrated-liquidity math behind a position simulator. Pick a range, a deposit and an ending price, and the PnL curve redraws.
Orca’s pools use concentrated liquidity. A liquidity provider picks a price range, and the deposit only works while the price stays inside it. Capital goes further that way, and the outcome gets harder to picture. The same deposit can end up all SOL, all USDC or anywhere between, depending on where the price goes.
As a freelancer I built the Position Simulator in Orca’s pools UI, so providers can see that before they deposit. This demo is my own version of the math behind it, written for this site. Inside the range a position holds x = L(1/√P − 1/√Pb) SOL and y = L(√P − √Pa) USDC. Outside it, it’s all one token. I test the math against Orca’s open-source Whirlpools core on the same inputs, and the demo plays your position against SOL’s real daily price.
- Math
- lib/clmm.ts, tested against @orca-so/whirlpools-core at 1e-9
- Not modeled
- Fees and rewards
- Case study
- Read the case study →
Position PnL across a price range
Set a deposit and a price range, then move the ending price.
If you deposited between and , and SOL ended at after …
you’d hold $959.87: +$169.37 on the deposit, −$146.29 against simply holding. In range 165 of 180 days.
- Deposit
- $790.49at $79.05: 7.887 SOL + 166.99 USDC
- Position value
- $959.87+$169.37 (+21.43%)
- Versus holding
- −$146.29−13.22% impermanent loss
- Ending mix
- 1.254 SOL+ 810.58 USDC; price inside your range
Fees and rewards aren’t modeled, so this only shows the part of PnL that comes from the price and your range. The path is SOL’s real daily price over the last 180 days, tilted smoothly to finish at your ending price. Price data: CoinGecko, 2026-04-03 to 2026-09-29 (USDC taken as $1), fetched 2026-09-29.
This is my own re-creation of the math, not Orca’s code.
Example result
With the defaults, 10 SOL goes in at $79.05 on April 3, 2026, worth $790.49, between $70 and $130. SOL’s real path then spends 165 of 180 days inside that range and finishes at $119.07 on September 29, 2026.
The position ends worth $959.87: +$169.37 on the deposit, and −$146.29 against simply holding the starting mix of SOL and USDC. That gap is the impermanent loss. Providing liquidity only beats holding if the fees earned while in range cover it.