Skip to content
log(swap)

The log invariant

Fix a quote asset (the numéraire) and a base asset, write pp for the price of base in quote, and work throughout in x=log⁡px = \log p.

The relation

The primitive is the invariant — a relation between reserves alone. A pool holding base RR and quote QQ runs the log invariant if

R eQ/L  =  Lpmin⁡R\, e^{Q/L} \;=\; \frac{L}{p_{\min}}

for an exposure L>0L > 0 in quote units and a floor pmin⁡p_{\min}, with ξ=log⁡pmin⁡\xi = \log p_{\min}. That relation is the curve a swap moves along, and everything on these pages is either a consequence of it or a variant of it. A log position Λ(L,ξ)\Lambda(L, \xi) is a claim on holdings that satisfy it.

The holdings follow from the curve

Not the other way round. Take logs of the invariant, log⁡R+Q/L=log⁡(L/pmin⁡)\log R + Q/L = \log(L/p_{\min}), and differentiate along the curve:

dRR+dQL=0⟹dQdR=−LR.\frac{dR}{R} + \frac{dQ}{L} = 0 \qquad\Longrightarrow\qquad \frac{dQ}{dR} = -\frac{L}{R}.

The marginal price — quote given up per unit of base received — is therefore

p  =  −∂Q∂R  =  LR,p \;=\; -\frac{\partial Q}{\partial R} \;=\; \frac{L}{R},

and substituting back fixes the state at any point on the curve:

R=Lp,Q=L (x−ξ),V=Q+pR=L(1+x−ξ).R = \frac{L}{p}, \qquad Q = L\,(x - \xi), \qquad V = Q + pR = L\left(1 + x - \xi\right).

Two things about that pricing rule are structural rather than cosmetic.

QQ does not appear in it. The marginal price reads only the base reserve; the quote buffer is a state variable the price ignores. Contrast constant product, where p=y/xp = y/x carries both reserves, so every quote-side movement repositions the price.

The price is independent of the floor. pmin⁡p_{\min} enters the constant on the right of the invariant but not p=L/Rp = L/R. Two positions with the same LL and different floors quote the same price — which is exactly what makes aggregation work.

The floor, and dormancy

At p=pmin⁡p = p_{\min} the position is all base and Q=0Q = 0: the floor is where the quote buffer runs out. Below it the position is dormant — it holds L/pmin⁡L/p_{\min} base, frozen, earning nothing until price returns. Dormancy is the model's one nonlinearity.

Upward there is no matching boundary: R=L/p>0R = L/p > 0 at every finite price, so R=0R = 0 is an asymptote rather than a reachable state. The position is never fully converted to quote and never needs re-entry. Making that boundary real is what the cap is for.

The reserves are the state; the drawdown ℓ=x−ξ=Q/L≥0\ell = x - \xi = Q/L \ge 0 is read off them, and LL is the size.

The three identities

Everything downstream rests on these.

identityreading
I1pR≡LpR \equiv Lthe marginal-price relation read as a statement about value: the base leg is worth LL at every price, so LL is both the size parameter and the quote value of the base holdings
I2dQ=L dxdQ = L\,dxthe quote leg is linear in log-price
I3p2∣V′′(p)∣=Lp^2\lvert V''(p)\rvert = Ldollar gamma is constant, since V′′(p)=−L/p2V''(p) = -L/p^2

I1 is why an LP can be asked one question — how much base exposure do you want? — and have the answer be a dollar figure that does not drift with price. I2 is why fees are a path statistic. I3 is why LVR is constant.

Value composition

With ℓ=x−ξ\ell = x - \xi:

quantityvalue
QQLℓL\ell
pRpRLL
VVL(1+ℓ)L(1+\ell)
quote weight Q/VQ/Vℓ/(1+ℓ)\ell/(1+\ell)
base weight pR/VpR/V1/(1+ℓ)1/(1+\ell)
Γq/V\Gamma_q/V1/(1+ℓ)1/(1+\ell)

where Γq(p):=p2∣V′′(p)∣\Gamma_q(p) := p^2\lvert V''(p)\rvert is the quote gamma. Since Γq≡L\Gamma_q \equiv L, the gamma-to-value ratio equals the base weight — convexity density tracks base share, another face of the constant-LVR property.

Three points on the curve:

  • at p=pmin⁡p = p_{\min}: ℓ=0\ell = 0, the position is 100% base;
  • at p=pmin⁡⋅ep = p_{\min}\cdot e: ℓ=1\ell = 1, the position is value-balanced;
  • as p→∞p \to \infty: asymptotically all quote, with RR decaying as 1/p1/p.

All price-driven variation in the position's value lives in QQ. The base leg does not move.

Where the shape comes from

I3 read backwards is a differential equation. Self-financing rebalancing at the marginal price means dQ+p dR=0dQ + p\,dR = 0, hence dV=R dpdV = R\,dp and

R(p)=V′(p),Q(p)=V(p)−p V′(p).R(p) = V'(p), \qquad Q(p) = V(p) - p\,V'(p).

Imposing constant dollar gamma, p2V′′=−Lp^2 V'' = -L, has general solution

V(p)=Llog⁡p+b p+c.V(p) = L\log p + b\,p + c .

The invariant above is the b=0b = 0 member, with cc pinned by Q(pmin⁡)=0Q(p_{\min}) = 0: the floored form, and the simplest. The remaining freedom is one constant, bb — and the cap is what happens when it is spent.

Scale-covariance

V′′(p)=−L/p2V''(p) = -L/p^2 is homogeneous of degree −2-2, so under p↦λpp \mapsto \lambda p the form is preserved and the action on state space is

(Q,R)⟼(Q+Llog⁡λ,  R/λ),(Q, R) \longmapsto \big(Q + L\log\lambda,\; R/\lambda\big),

which leaves R eQ/LR\,e^{Q/L} invariant. Multiplicative rescaling of price is additive translation of QQ. So pmin⁡p_{\min} is not a fundamental parameter — it is a choice of origin for the QQ axis, and floors enter every formula only through the difference x−ξx - \xi.

The trader-facing corollary is that price impact is price-independent: Δx=ΔQ/L\Delta x = \Delta Q/L exactly, with no pp on either side. See Swaps.