Constant Depth Curve: mathematical proof

Deriving the CDC bonding curve from first principles: the uniform-depth constraint reduces to a finite-difference equation with a log-affine solution, closed-form reserves, and an invariant.

By DAMM Capital · cdc · market-making · bonding-curve · mathematics

Companion to PNK/USD market maker: model & path-independence validation.

Setup

Consider a bonding curve on a CLOB with token holdings x(P)x(P) and USD holdings y(P)y(P) as functions of price PP, operating over a bounded range [Pa,Pb][P_a, P_b].

Uniform depth constraint: Define depth over a symmetric log-price band of half-width h>0h > 0. At any price PP such that both PehPe^{-h} and PehPe^{h} lie within [Pa,Pb][P_a, P_b], the USD available on each side must equal a constant DD:

y(P)y(Peh)=D(bid depth)y(P) - y(Pe^{-h}) = D \quad \text{(bid depth)} y(Peh)y(P)=D(ask depth)y(Pe^{h}) - y(P) = D \quad \text{(ask depth)}

The effective domain for the constraint is P[Paeh,Pbeh]P \in [P_a e^{h}, P_b e^{-h}]. Outside this interior band, the full symmetric log-band is no longer contained in [Pa,Pb][P_a, P_b], so the available depth on the truncated side is strictly less than DD.

Note: if the band is instead defined arithmetically as P(1±f)P(1\pm f), the bid and ask sides involve different log-widths (ln(1/(1f))ln(1+f)\ln(1/(1-f)) \neq \ln(1+f)), making exact two-sided uniformity impossible with a single curve. The log-price formulation avoids this asymmetry.

1. The functional equation

Substituting u=lnPu = \ln P and Y(u)=y(eu)Y(u) = y(e^u), both constraints reduce to:

Y(u)Y(uh)=Du[lnPa+h,  lnPbh]Y(u) - Y(u - h) = D \quad \forall\, u \in [\ln P_a + h,\; \ln P_b - h]

This is a finite-difference equation: YY has constant increments over equal steps hh in log-price space.

2. Solving the functional equation

The general smooth solution is:

Y(u)=Dhu+ϕ(u)Y(u) = \frac{D}{h} \cdot u + \phi(u)

where ϕ\phi is any smooth hh-periodic function (ϕ(u)=ϕ(uh)\phi(u) = \phi(u - h)), since:

Y(u)Y(uh)=Dhh+ϕ(u)ϕ(uh)=DY(u) - Y(u-h) = \frac{D}{h} \cdot h + \phi(u) - \phi(u-h) = D

To obtain a homogeneous curve with no oscillatory structure in log-price, we select the canonical non-oscillatory solution ϕ=const\phi = \text{const}. This is the scale-invariant choice: the curve has constant USD depth per unit log-price, with no oscillatory structure or preferred frequencies in log-price space.

Note: monotonicity of y(P)y(P) alone is insufficient to force ϕ=const\phi = \text{const}. A small-amplitude periodic ϕ\phi (e.g., ϕ(u)=εsin(2πu/h)\phi(u) = \varepsilon \sin(2\pi u / h) with ε<D/2π\varepsilon < D/2\pi) preserves Y(u)>0Y'(u) > 0 everywhere while introducing oscillatory microstructure. Such solutions are mathematically valid but economically unnatural — they would create a curve where the marginal selling rate oscillates with price, with no economic justification for the preferred frequency. We exclude them by construction.

Thus:

Y(u)=Dhu+constY(u) = \frac{D}{h} \cdot u + \text{const}

Substituting back and setting y(Pa)=0y(P_a) = 0 (boundary condition: all capital is in tokens at the lower bound):

y(P)=Cln(P/Pa)\boxed{\,y(P) = C \cdot \ln(P / P_a)\,}

where:

C=DhC = \frac{D}{h}

3. Deriving x(P)

Along a differentiable bonding curve with marginal price PP, trade accounting gives:

dy=Pdxdy = -P \cdot dx

(When price rises by dPdP, the curve sells dxdx tokens at price PP, receiving PdxP \cdot dx in USD.)

From y(P)=Cln(P/Pa)y(P) = C \ln(P/P_a):

dydP=CP\frac{dy}{dP} = \frac{C}{P}

Therefore:

dxdP=1PdydP=CP2\frac{dx}{dP} = -\frac{1}{P}\frac{dy}{dP} = -\frac{C}{P^2}

Integrating with boundary condition x(Pb)=0x(P_b) = 0 (all capital is in USD at the upper bound):

x(P)=C(1P1Pb)\boxed{\,x(P) = C\left(\frac{1}{P} - \frac{1}{P_b}\right)\,}

4. The invariant

From x(P)x(P) and y(P)y(P):

x+CPb=CPP=Cx+C/Pbx + \frac{C}{P_b} = \frac{C}{P} \quad \Rightarrow \quad P = \frac{C}{x + C/P_b}

And:

ey/C=PPae^{y/C} = \frac{P}{P_a}

Combining:

(x+CPb)ey/C=CPa\boxed{\,\left(x + \frac{C}{P_b}\right) \cdot e^{y/C} = \frac{C}{P_a}\,}

This defines the state manifold of the curve. Infinitesimal trades respecting dy=Pdxdy = -P \cdot dx preserve this invariant.

5. Verification of uniform depth

Bid depth at price PP (USD spent as price falls from PP to PehPe^{-h}):

Dbid(P)=y(P)y(Peh)=ClnPPaClnPehPa=Ch=D  D_{bid}(P) = y(P) - y(Pe^{-h}) = C\ln\frac{P}{P_a} - C\ln\frac{Pe^{-h}}{P_a} = C \cdot h = D \;\checkmark

Ask depth at price PP (USD received as price rises from PP to PehPe^{h}):

Dask(P)=y(Peh)y(P)=ClnPehPaClnPPa=Ch=D  D_{ask}(P) = y(Pe^{h}) - y(P) = C\ln\frac{Pe^{h}}{P_a} - C\ln\frac{P}{P_a} = C \cdot h = D \;\checkmark

Both sides are exactly DD, for all PP in the effective domain [Paeh,Pbeh][P_a e^{h}, P_b e^{-h}].

6. Derived properties

Portfolio value:

V(P)=x(P)P+y(P)=C(1PPb+lnPPa)V(P) = x(P) \cdot P + y(P) = C\left(1 - \frac{P}{P_b} + \ln\frac{P}{P_a}\right)

Range boundaries from capital. Given XX tokens and YY USD at current price P0P_0, with CC held fixed (i.e., target depth DD and band half-width hh fixed):

  • USD sets the downside: Pa=P0exp(Y/C)P_a = P_0 \cdot \exp(-Y/C), which is always positive.
  • Tokens set the upside: Pb=CP0/(CXP0)P_b = C \cdot P_0 / (C - X \cdot P_0). This requires XP0<CX \cdot P_0 < C for a finite positive PbP_b. If XP0=CX \cdot P_0 = C, then Pb=P_b = \infty. If XP0>CX \cdot P_0 > C, no finite or infinite positive upper bound exists within this curve family for that CC.

These are independent — adding USD extends the downside without affecting the upside, and vice versa.

CLOB grid order size. On a log-uniform grid with spacing δ\delta, each order is approximately CδC \cdot \delta USD, uniform at every price level.

7. Relationship to arithmetic percentage bands

If the depth band is defined arithmetically as [P(1f),P(1+f)][P(1-f), P(1+f)] instead of [Peh,Peh][Pe^{-h}, Pe^{h}], the bid and ask log-widths differ:

  • Bid: hbid=ln(1/(1f))h_{bid} = \ln(1/(1-f))
  • Ask: hask=ln(1+f)h_{ask} = \ln(1+f)

No single log-affine curve can produce exact constant depth on both sides simultaneously. The relative excess of bid depth over ask depth is:

DbidDask1=ln(1/(1f))ln(1+f)1=f+O(f2)\frac{D_{bid}}{D_{ask}} - 1 = \frac{\ln(1/(1-f))}{\ln(1+f)} - 1 = f + O(f^2)

At f=0.02f = 0.02, bid depth exceeds ask depth by ~2%, which is negligible in practice. But exact two-sided uniformity under arithmetic bands is impossible with this curve family.