DEV Community

Cutting Binary Prediction Market LVR by 42.4% with Paradigm's Dynamic Gaussian pm-AMM (Zero-Dependency Node.js)

Standard constant-product AMMs (x * y = k) work well for perpetual spot tokens, but they break down badly on expiring binary prediction markets.

As a binary market approaches expiry (t -> T), the outcome probability snaps toward 0 or 1. A static CPMM or LMSR pool keeps liquidity parked across the curve and bleeds 85%-90% of initial LP capital to Loss-Versus-Rebalancing (LVR).

While building PerpPulse pm-AMM - a funding-rate binary hedge engine for SOL-PERP, BTC-PERP, and ETH-PERP - we implemented Paradigm's Dynamic Gaussian pm-AMM in zero-dependency Node.js ESM and benchmarked it head-to-head against CPMM, LMSR, and Static pm-AMM.

The Gaussian pm-AMM Invariant

Instead of x * y = k, the pool holds x YES shares and y NO shares constrained by:

F(x, y; L) = (y - x) * Phi((y - x) / L) + L * phi((y - x) / L) - y = 0

Three clean analytical identities fall straight out of this curve:

  • Marginal YES price: P_YES = Phi((y - x) / L)
  • Exact pool value: V(P) = P*x + (1-P)*y = L * phi(Phi^-1(P))
  • Dynamic liquidity decay: L(t) = L_0 * sqrt(T - t) so surplus reserves are returned to LPs smoothly before settlement, keeping LVR/V uniform across all probabilities.

An O(1) Closed-Form Sell Identity

Buying YES/NO shares uses damped Newton-Raphson (converging to < 1e-12 residual in ~5 iterations using the exact derivative dF/dx = -Phi(z)).

Even better: selling YES or NO shares back to USDC needs zero iteration. When a trader sells sharesIn YES tokens for u USDC (x_new = x + sharesIn - u, y_new = y - u), the difference d = y_new - x_new = (y - x) - sharesIn cancels u completely. Plugging d into F = 0 yields y_new in closed form:

const d = this.y - this.x - sharesIn;
const zNew = d / this.L;
const yNew = d * normCdf(zNew) + this.L * normPdf(zNew);
const grossUsdOut = this.y - yNew;

Reproducible 200-Path Monte Carlo LVR Benchmark

Running npm run benchmark (V_0 = $10,000, 96 expiry steps, 200 paths, seed = 20261201):

AMM Mechanism Mean LP LVR % of Initial Capital vs CPMM
Dynamic pm-AMM (L0*sqrt(T-t)) $4,902.25 49.02% -42.41%
CPMM (x * y = k) $8,512.70 85.13% baseline
LMSR $8,942.87 89.43% +5.05%
Static pm-AMM $8,994.89 89.95% +5.66%

Across starting probabilities from 15% to 85% (npm run sensitivity), Dynamic pm-AMM stays between 46.9% and 50.8% (a 3.90% spread), whereas CPMM swings from 79.5% to 95.8% (16.32% spread).

Try the Interactive Simulator & Source Code

If you self-host Node/Python bots or monitoring scripts on a small VPS, we also publish lightweight zero-dependency ops utilities - start with our free $0+ VPS Ops Check CLI or grab the complete 3-in-1 Self-Hosted Python Ops Bundle ($5.99).

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.