Cost-function market makers
A whole family of automated market makers collapses into a single object: a convex potential $C(q)$ over the vector of outstanding shares. Abernethy, Chen & Wortman Vaughan (2013) showed that to build a market maker you need only pick such a potential: prices are its gradient, the no-arbitrage condition is exactly convexity, and the worst-case subsidy is exactly the spread of the conjugate. LMSR is one instance (the entropic one); Uniswap-style CFMMs are the same object seen from the reserves side.
A convex potential is a market maker
Fix $n$ outcomes (or share types) and a convex function $C:\mathbb{R}^n \to \mathbb{R}$, the cost function. The maker tracks the vector $q$ of shares it has sold. A trader who moves the book from $q$ to $q+\delta$ pays the increment in potential, $C(q+\delta)-C(q)$, and the instantaneous price vector is the gradient:
That single choice determines everything else. There is no order book and no
counterparty quoting a spread; the price of outcome $i$ is just
$\partial C/\partial q_i$, read off the current inventory. This is exactly
what CostFunctionMarketMaker does in
mechanisms/cmm.py:
it takes a callable cost (and optional analytic grad),
and exposes prices() $=\nabla C(q)$, cost_to_trade(delta),
and buy(outcome, shares). When no gradient is supplied it falls
back to a central finite difference, underscoring that the potential alone
defines the mechanism.
Convexity is no-arbitrage
Why must $C$ be convex? Because convexity is precisely the condition that no sequence of trades can be a sure-profit cycle. The cost of a round trip $q \to q+\delta \to q$ is zero, and more generally the path cost of moving between two inventories is path-independent; it depends only on the endpoints, since it telescopes to $C(q') - C(q)$. Convexity makes the price $\nabla C$ monotone in $q$: buying an outcome can only raise its price, never lower it, so a trader can never buy back more cheaply than they sold. A non-convex $C$ would create a dip the arbitrageur could ride for free. Thus:
Worst-case loss is the range of the conjugate
The maker is a subsidized device: it may pay out more than it took in. Its worst-case loss over every trading path and final state is bounded, and the bound is the spread of the potential's values over the price-feasible region. Equivalently, it is the range of the convex conjugate $C^\ast(p) = \sup_q \langle p, q\rangle - C(q)$, which plays the role of the generating proper scoring rule: a larger conjugate domain means a deeper, more responsive market and a larger guaranteed subsidy. Informally,
taken over $\mathcal{Q}$, the reachable inventories. This is the budget a sponsoring institution knowingly puts up in exchange for the information the market aggregates, finite, and fixed by the choice of $C$ before any trade occurs.
LMSR: the entropic special case
Hanson's logarithmic market scoring rule is the instance where $C$ is the scaled log-partition function, with liquidity parameter $b \gt 0$:
The gradient is the softmax, so prices are automatically non-negative and
sum to one, a genuine probability estimate. Here the conjugate is negative
entropy (LMSR is the entropic regularizer of online learning's
Follow-the-Regularized-Leader, with $b$ the learning rate), and the
worst-case-loss bound evaluates to the clean $b \log n$. In code,
lmsr_potential(b) returns exactly this (cost, grad)
pair, computed with a max-subtraction for numerical stability.
A quadratic potential: a bounded-budget, non-probability maker
Softmax is one choice of potential among many. Take instead a simple quadratic,
This is convex (so still arbitrage-free), but its prices $\alpha q$ are not
normalized to the probability simplex; they can be negative and need not sum
to one. So it is a bounded-budget liquidity maker rather
than a probability market: a useful illustration that the cost-function
recipe is far more general than belief elicitation. It is provided as
quadratic_potential(alpha) in
mechanisms/cmm.py,
sitting behind the same CostFunctionMarketMaker interface as
LMSR.
The dual: cost-function makers and CFMMs
The DeFi constant-function market makers, Uniswap, Balancer, Curve, are the same theory through convex duality. A cost-function maker is a convex potential $C(q)$ priced by $\nabla C(q)$; a CFMM is a concave trading function $\varphi(R)$ over reserves $R$, with spot prices read off the ratio of its partials. Up to sign conventions and a change of variables, the trading function is the convex conjugate of the cost function:
Under this correspondence, convexity of $C$ maps to no-arbitrage of the pool, and a bounded conjugate domain maps to bounded loss. So the prediction-market side (bounded-loss information elicitation) and the DeFi side (fees, impermanent loss, capital efficiency) are two readings of one convex object, see CFMMs for the reserves-side picture.
Try it
Any convex potential $C$ defines a maker, with prices $\nabla C$. Here a quadratic potential $C(q)=\tfrac{\alpha}{2}\lVert q\rVert^2$ gives the linear price $\alpha q$, a bounded-budget maker whose price is not a probability, showing LMSR's softmax is just one choice of potential.
Code: mechanisms/cmm.py · Demo: examples/sim_cmm.py · Related: LMSR, CFMMs · Research: market-scoring-rules-and-amms.md