Methodology, reviewed Sep 13, 2026

The formulas behind every calculator.

Every result is reproducible from the equations and fixed test vectors below. The same vectors are imported by the automated unit tests; changing a formula without updating and explaining its reference result fails the suite.

Weighted impermanent loss

Used by the impermanent loss calculator. The weighted-pool result against the matching hold basket is:

ILw(k) = kʷ ÷ (w·k + 1 − w) − 1

Where:

  • w — token A’s entry weight.
  • k — relative price ratio, calculated as (A₁/A₀) ÷ (B₁/B₀).

At w = 0.5, the result reduces to the 50/50 formula. Assumptions: a two-token full-range constant-mean pool, aligned marginal price, no fees inside the IL term, and a hold basket with the same entry weights.

CaseInputsReference result
50/50 unchangedpriceA0=100; priceA1=100; priceB0=1; priceB1=1; capital=10000; weightA=0.5impermanentLoss=0; holdValue=10000
50/50 doublespriceA0=100; priceA1=200; priceB0=1; priceB1=1; capital=10000; weightA=0.5impermanentLoss=-0.05719095842; holdValue=15000
50/50 quadruplespriceA0=100; priceA1=400; priceB0=1; priceB1=1; capital=10000; weightA=0.5impermanentLoss=-0.2; holdValue=25000
80/20 doublespriceA0=100; priceA1=200; priceB0=1; priceB1=1; capital=10000; weightA=0.8impermanentLoss=-0.03272159634; holdValue=18000
95/5 halvespriceA0=100; priceA1=50; priceB0=1; priceB1=1; capital=10000; weightA=0.95impermanentLoss=-0.01403340587; holdValue=5250

Concentrated-liquidity range

Used by the Uniswap v3 and concentrated-liquidity calculator and by the range mode in the IL calculator. In-range token balances are:

x = L(1/√P − 1/√Pᵦ); y = L(√P − √Pₐ)

Where:

  • L — position liquidity.
  • P — current price.
  • Pₐ — lower price bound.
  • Pᵦ — upper price bound.
  • x and y — base and quote token amounts.

Price is clamped to the bounds for one-sided inventory. The entry inventory is the hold benchmark. Fee income multiplies volume, fee rate, position share, time in range, and days, then is added after divergence is shown.

CaseInputsReference result
No price moveentryPrice=3000; lowerPrice=2500; upperPrice=3600; exitPrice=3000; capital=10000positionValue=10000; holdValue=10000; impermanentLoss=0; rangeState=inside
Inside range at 3300entryPrice=3000; lowerPrice=2500; upperPrice=3600; exitPrice=3300; capital=10000positionValue=10363.28882; holdValue=10500; impermanentLoss=-0.01302011261; rangeState=inside
At lower boundentryPrice=3000; lowerPrice=2500; upperPrice=3600; exitPrice=2500; capital=10000positionValue=8731.021313; holdValue=9166.666667; impermanentLoss=-0.04752494772; rangeState=inside
Below rangeentryPrice=3000; lowerPrice=2500; upperPrice=3600; exitPrice=2000; capital=10000positionValue=6984.81705; holdValue=8333.333333; impermanentLoss=-0.161821954; rangeState=below
Above rangeentryPrice=3000; lowerPrice=2500; upperPrice=3600; exitPrice=4200; capital=10000positionValue=10477.22558; holdValue=12000; impermanentLoss=-0.1268978688; rangeState=above

Liquidity-pool fees and rewards

Used by the liquidity pool calculator. Net period income keeps fees and incentives separate before costs:

net = V·f·q·t·d + C·r·d/365 − gas

Where:

  • V — routed daily volume.
  • f — pool fee tier.
  • q — position share, C/(active liquidity + C).
  • t — time in range.
  • d — days held.
  • C — deployed capital.
  • r — incentive APR.
  • gas — entered transaction costs.

Volume and liquidity must describe the same pool and band. Reward APR is an input, not a prediction.

CaseInputsReference result
Fees onlyfeeTierPercent=0.05; capital=100000; dailyVolume=40000000; activeLiquidity=5000000; timeInRangePercent=100; days=30feeAprPercent=143.1372549; incentiveIncome=0; netIncome=11764.70588
Half time in rangefeeTierPercent=0.05; capital=100000; dailyVolume=40000000; activeLiquidity=5000000; timeInRangePercent=50; days=30feeAprPercent=71.56862745; incentiveIncome=0; netIncome=5882.352941
Separate 12% rewardsfeeTierPercent=0.01; capital=50000; dailyVolume=10000000; activeLiquidity=2000000; timeInRangePercent=80; days=90; incentiveAprPercent=12feeAprPercent=14.24390244; incentiveIncome=1479.452055; netIncome=3235.549616
Gas exceeds feesfeeTierPercent=0.01; capital=1000; dailyVolume=100000; activeLiquidity=1000000; timeInRangePercent=100; days=7; gasPerTransaction=25; transactionCount=4feeAprPercent=0.36463536; incentiveIncome=0; netIncome=-99.93006993
Zero routed volumefeeTierPercent=0.3; capital=25000; dailyVolume=0; activeLiquidity=1000000; timeInRangePercent=100; days=365; incentiveAprPercent=8feeAprPercent=0; incentiveIncome=2000; netIncome=2000

LP profit against holding

Used by the LP profit and return calculator. The complete benchmark ledger is:

net vs hold = pool value − hold value + fees + rewards − costs

Where:

  • pool value — rebalanced position value at exit.
  • hold value — original inventory marked at exit prices.
  • fees and rewards — observed income.
  • costs — entered operating expenses.

Net return divides this result by entry capital. Annualization describes the entered period; it does not forecast a repeat.

CaseInputsReference result
Fees cover 2x ILpriceA0=100; priceA1=200; priceB0=1; priceB1=1; capital=10000; feesEarned=1000; days=30netVsHold=142.135624; netReturnPercent=1.42135624
No fees, no movepriceA0=100; priceA1=100; priceB0=1; priceB1=1; capital=10000; days=30netVsHold=0; netReturnPercent=0
Rewards shown separatelypriceA0=100; priceA1=100; priceB0=1; priceB1=1; capital=10000; rewardsEarned=250; days=30netVsHold=250; netReturnPercent=2.5
Costs exceed revenuepriceA0=100; priceA1=100; priceB0=1; priceB1=1; capital=5000; feesEarned=20; costs=75; days=7netVsHold=-55; netReturnPercent=-1.1
Weighted 80/20 movepriceA0=100; priceA1=200; priceB0=1; priceB1=1; capital=10000; weightA=0.8; feesEarned=300; days=30netVsHold=-288.9887341; netReturnPercent=-2.889887341

Meteora DLMM discrete bins

Used by the Meteora DLMM calculator. Each bin has a geometric price and constant-sum liquidity:

Pᵢ = P₀(1+s/10,000)ⁱ; Lᵢ = Pᵢxᵢ + yᵢ

Where:

  • i — relative bin ID.
  • s — bin step in basis points.
  • Pᵢ — fixed price of bin i.
  • Lᵢ — constant-sum liquidity value.
  • xᵢ and yᵢ — token reserves in that bin.

Spot is uniform. Curve uses a Gaussian with standard deviation equal to one quarter of the bin span; Bid-Ask uses inverse density. Token X and Y allocations are normalized separately on their respective sides, matching the SDK helper before integer rounding.

Meteora DLMM fee rates

The calculator keeps program-precision base and variable rates separate:

fee = min(B·s·10·10ᵖ + ceil(A·(v·s)²/10¹¹), 10%)

Where:

  • B — base factor.
  • s — bin step.
  • p — base-fee power factor.
  • A — variable-fee control.
  • v — volatility accumulator.
  • 10% — maximum total fee.

Raw rates use 1e9 precision. Fee income uses entered volume and competing liquidity for the modeled active bin, then applies time in range and LP share. An out-of-range endpoint earns zero in the endpoint scenario.

CaseInputsReference result
Spot, no moveanchorPrice=20; binStepBps=25; binsBelow=2; binsAbove=2; shape=spot; capital=10000; endBin=0; baseFactor=10000lowerPrice=19.90037375; upperPrice=20.100125; totalFeePercent=0.25; positionValue=10000; rangeState=inside
Curve, two bins upanchorPrice=20; binStepBps=25; binsBelow=4; binsAbove=4; shape=curve; capital=10000; endBin=2; baseFactor=10000lowerPrice=19.80124378; upperPrice=20.20075125; totalFeePercent=0.25; positionValue=10015.40517; rangeState=inside
Bid-Ask, below rangeanchorPrice=20; binStepBps=50; binsBelow=3; binsAbove=3; shape=bidAsk; capital=10000; endBin=-5; baseFactor=10000lowerPrice=19.70297519; upperPrice=20.3015025; totalFeePercent=0.5; positionValue=9813.567718; rangeState=below
One-bin spotanchorPrice=1; binStepBps=1; binsBelow=0; binsAbove=0; shape=spot; capital=5000; endBin=0; baseFactor=10000lowerPrice=1; upperPrice=1; totalFeePercent=0.01; positionValue=5000; rangeState=inside
Dynamic fee cappedanchorPrice=100; binStepBps=100; binsBelow=2; binsAbove=2; shape=curve; capital=20000; endBin=3; baseFactor=10000; variableFeeControl=1000000000; volatilityAccumulator=1000000lowerPrice=98.02960494; upperPrice=102.01; totalFeePercent=10; positionValue=20070.74472; rangeState=above

Shared exclusions and verification

All calculators run locally and make no wallet or external API calls. They exclude contract risk, token transfer taxes, approval or signing risk, slippage, MEV, tax, liquidation, oracle failure, and any price path not represented by the inputs. Endpoint IL also excludes loss-versus-rebalancing accumulated along the route. Results are educational scenarios, not financial advice.

The source implementation and tests are public in the calculator library on GitHub. Primary references are the Uniswap v2 whitepaper, the Uniswap v3 whitepaper, Balancer weighted-pool documentation, and Meteora’s official DLMM formulas and strategy definitions.

Calculator explanations and guide content follow the same editorial policy: drafts may use AI assistance, material claims are checked against cited primary sources, and the SudoAI team reviews the work before publication. Corrections are handled through the contact route published there.