Ahzam Email
← Research

Impermanent loss in a DLMM

A derivation of inventory value across discrete liquidity bins

A discrete liquidity market maker does not move along one continuous reserve curve. It trades through fixed price bins, converting inventory one bin at a time. Its impermanent loss therefore comes from the prices at which those bins sell relative to the final market price.

Discrete liquidity

In a constant product AMM, reserves and price change continuously along one curve. A DLMM divides liquidity across discrete bins. Each bin trades at its own fixed price, and the active bin changes only after the available inventory at the current price has been consumed.

For a bin with base reserve xi, quote reserve yi, price Pi, and base denominated liquidity Li, the constant sum invariant is:

xi+yiPi=Li

Multiplying through by the bin price expresses the same invariant in quote value:

Pixi+yi=PiLi

Within a bin, exchanging base for quote does not change the position's value at that bin's price. What matters is the difference between each execution price and the price at which the final inventory is marked.

Setup

Take an upward price move through a one sided position. Number its bins j=0,1,,N, beginning at price P0. Adjacent bins are separated by the fractional step Δ:

Pj=P0(1+Δ)j

Write r=1+Δ, so Pj=P0rj. Each bin begins with Lj units of base and no quote. The initial position value is:

V0=P0j=0NLj

Suppose price crosses k complete bins and stops in bin k. The final market price is:

Pf=Pk=P0rk

What happens as bins are crossed

Every fully crossed bin j<k sells all its base inventory at its own price. Its final reserves are:

xj=0yj=PjLj

In the active bin k, let α be the fraction of base sold. Its reserves become:

xk=(1α)Lkyk=αPkLk

Bins above it remain entirely in base. When the active bin is marked at Pk, its value is independent of the fill fraction:

Pkxk+yk=PkLk

Partial execution changes inventory composition, but not marked value while the market remains at that bin price.

Final LP value

The crossed bins now hold quote received at their individual execution prices. The active and untouched bins still have value equal to their base liquidity marked at the final price. The full position is therefore worth:

VLP(k)=j=0k1PjLj+Pkj=kNLj

The first sum is inventory already sold below the final price. The second is inventory still marked at the final price. This separation is the source of divergence from holding.

The holding benchmark

The correct benchmark keeps the exact starting inventory instead of placing it in the market maker. Because the initial position is entirely base, its value at the final price is:

Vhold(k)=Pkj=0NLj

Impermanent loss is the relative difference:

IL(k)=VLP(k)Vhold(k)1

Substituting the two values gives a compact expression for any liquidity distribution:

IL(k)=j=0k1(1rjk)Ljj=0NLj

Only crossed liquidity contributes to the loss. A bin crossed earlier sold at a lower price and therefore contributes more. Liquidity above the active bin has not traded and matches the holding benchmark.

Uniform liquidity

If every bin contains the same base liquidity Lj=L, the geometric sum produces an exact closed form:

VLP(k)=P0L[rk1Δ+rk(Nk+1)]

The holding value is P0rk(N+1)L, so:

IL(k)=rk1Δkrkrk(N+1)

An equivalent form makes the dependence on crossed bins easier to see:

IL(k)=1rkΔkN+1

For k>0, this expression is negative. Each crossed bin has sold base below the final price, while holding would retain all base through the move.

Small bin approximation

For a small bin step and a fixed number of crossed bins:

rk=(1+Δ)k=1kΔ+k(k+1)2Δ2+O(Δ3)

Substituting into the exact uniform result gives:

IL(k)=k(k+1)Δ2(N+1)+O(Δ2)

Near the starting bin, loss grows approximately quadratically with the number of bins crossed, linearly with the bin step, and inversely with the total number of funded bins. The approximation assumes k is fixed as Δ becomes small. It should not be extrapolated to an arbitrarily large price move.

Exact result and approximation

The example below uses 101 uniformly funded bins with a 0.5% step. It compares the exact loss with the first order approximation above.

Exact and approximate impermanent loss Impermanent loss as more bins are crossed for 101 uniformly funded bins with a 0.5 percent bin step Exact First order approximation 0% -5% -10% -15% -20% -25% 0 20 40 60 80 100 Bins crossed Impermanent loss
The approximation is useful near the starting bin. The exact expression should be used as the move grows.

Extensions

For a nonuniform distribution, the general weighted expression remains valid. Liquidity placed in bins that are crossed early contributes more divergence because it sells further below the final price. Gaussian, exponential, and strategy specific shapes can be evaluated by changing the weights Lj.

Downward moves follow the same inventory accounting with base and quote reversed. A two sided position can be decomposed into the bins consumed in each direction and the bins that remain untouched.

Fees are excluded here. Static and dynamic trading fees add to final LP value and may offset some divergence, but the amount depends on volume, path, fee rules, and the LP's share of active liquidity. Impermanent loss and fee income should therefore be modelled separately before being combined into strategy returns.

The derivation also assumes the final mark price equals the active bin price. Oracle price differences, arbitrage latency, discrete jumps across empty bins, and rebalancing costs introduce additional effects in a live market.

Conclusion

In a DLMM, divergence from holding is the value left behind when inventory sells across bins below the final market price. The exact loss depends on the bin step, how many bins are crossed, and where liquidity is distributed.

For uniform one sided liquidity and small bin steps, the leading term is k(k+1)Δ2(N+1). That approximation gives a useful local intuition, while the weighted sum provides the exact answer for arbitrary bin allocations.