Cointime

Download App
iOS & Android

Distribution Markets

Cointime Official

From Paradigm by Dave White

Overview

This paper introduces distribution markets, a new kind of prediction market for events whose outcomes aren't just "yes" or "no" but could be any number.Instead of betting on a particular outcome or range, traders can express how likely they think each different possibility is across the whole infinite range of outcomes.

The gray curve represents the AMM's initial belief, the blue curve represents a new trader's belief, and the green and red curve represents the trader's potential profit and loss if they were to move the market to their belief. Each curve is denominated in dollars, and the blue and gray curves are scalar multiples of their underlying probability distributions.

Intuition

Take the question "When will GPT-5 be released?" In a traditional prediction market, traders might have to choose between preset options like "Q2 2025" or "2026."Prediction competitions like Metaculus instead let traders express their predictions as a curves showing exactly how likely they think each possible date is. However, Metaculus is a competition, not a market, and has no way for participants to trade on their beliefs and put skin in the game by trading on their beliefs.Like Metaculus, Distribution Markets allow participants to come to consensus on the full probability distribution over all outcomes, but like traditional prediction markets they allow traders to profit by moving the shared view in the right direction.

Mechanics

The underlying mechanism is a constant function AMM over functions, with the invariant (analogous to Uniswap's xy=k) being a constant 

l2l2​norm. When restricted to specific distributions (such as the Normal, lognormal, and so on), the math is surprisingly simple, and the resulting AMMs can be implemented efficiently onchain.

Motivation

Prediction markets have entered popular consciousness in the wake of the 2024 US Presidential elections, but the technology is likely still in its infancy. Further development could be of benefit both to developers and to the public at large.More specifically, today's prediction markets generally allow participants to express probability distributions over discrete outcomes, but many questions of relevance to the real world involve continuous outcomes.It's true that a perp market could elicit the expected value of a continuous variable from the market, but sometimes we would like to know more -- for example, do we know for sure a given project will take 10 years exactly, or could it perhaps be anywhere between 2 and 20?

Mechanism

Discrete Case

This section is provided as an aid to understanding the continuous case, which is the main contribution of this paper.

We already have many options for prediction market AMMs in the discrete case, where the outcome is one of a finite set of options. So, the discrete case distribution market mechanism presented in this section isn't particularly useful.

However, the math in the discrete case mirrors the continuous case exactly, so this section may be helpful as an aid to intuition.

Outcome Tokens

Consider some event with 

NNoutcomes.We createoutcome tokensX1,...,XNX1​,...,XN​such that if the outcome is e.g. outcomeii, tokenxixi​will be worth$1$1, and the other tokens will be worth$0$0. (Note: we're using dollars as the payout currency for accessibility to a broader audience, but this could be any asset.)We can at any time mint or redeem a full set of these tokens for $1, because at expiry exactly one token will be worth $1 and the rest worth $0.

AMM Invariant

We’re going to create our AMM as a standard Constant Function Market Maker (CFMM), of which the most famous example is probably Uniswap, which has constant function 

xy=k.xy=k.We initialize the AMM withkkdollars, which we split intokkeach of the outcome tokens, so that the market can then sell up tokk of any of the outcome tokens in total.We denote the AMM’s vector of holdingshhash=k−x=(k−x1,…,k−xn)h=k−x=(k−x1​,…,k−xn​)

so that the 

xxvector represents how much of each outcome token the AMM has sold.We define our AMM’s constant function to be∣∣x∣∣2=∑i=1Nxi2=k∣∣x∣∣2​=i=1∑N​xi2​​=k

Since 

x=k−hx=k−h, we could also write∣∣k−h∣∣2=∑i=1N(hi−k)2=k∣∣k−h∣∣2​=i=1∑N​(hi​−k)2​=k

which means the AMM's holdings are a a translated hypersphere with radius 

kkaround the point(k,…,k)(k,…,k)inRNRN.Note that the minimum coordinate of this translated hypersphere along any dimension is00. From this, we can see that the AMM will always sell at mostkkof any given outcome token, which is fortunate, since it doesn’t have any more than that to sell.

Trading Behavior

Say the true probability distribution of 

XiXi​isp=(p1,…,pn)p=(p1​,…,pn​). At the time of resolution, the correct outcome token will be worth11. So the expected value of the AMM’s holdings is the probability-weighted sum of its outcome token holdings,∑ipihi=p⋅h=p⋅(k−x)=k−p⋅x∑i​pi​hi​=p⋅h=p⋅(k−x)=k−p⋅x, where we sayp⋅k=kp⋅k=kbecausepp, as a probability distribution, sums to 1.

If we assume the market is efficient, arbitrageurs will act to maximize the expected value of their own holdings 

xx, which will minimize the value of the AMM's holdingshh. In other words, they are solving the optimization problemmin⁡xk−p⋅x s.t. ∣∣x∣∣2=kxmin​k−p⋅x s.t. ∣∣x∣∣2​=k

Since traders can’t affect 

kk, this simplifies tomax⁡xp⋅x s.t. ∣∣x∣∣2=kxmax​p⋅x s.t. ∣∣x∣∣2​=k

By the Cauchy-Schwarz inequality, the vector that maximizes this dot product given the fixed norm must be linearly dependent with 

pp.This great 3b1b video on the dot product.This means we must havex=kp∣∣p∣∣2x=k∣∣p∣∣p​2​

In other words, 

xx, the vector of positions collectively held by the market, is directly proportional to the true probability distributionpp, scaled so that itsl2l2​norm iskk.

By our definition above, the AMM’s holdings 

hhare determined byh=k−x=k(1−p∣∣p∣∣2)h=k−x=k(1−∣∣p∣∣2​p​)

which has the nice side effect that we can read the market’s estimated distribution directly from the AMM’s reserves.

In this way, the distribution market is an example of a market scoring rule.

Continuous Case

The continuous case is the main contribution of this paper, because it unlocks a new behavior: prediction-market-like trading over continuous probability distributions.

The mechanism follows nearly identical logic to the discrete case, but with some additional constraints to ensure the market stays solvent.

This is a general construction, but by specializing the types of distribution allowed — to, say, uniform or Gaussian distributions — the resulting AMM can be made computationally efficient to run on, for example, Ethereum mainnet. We discuss this in more detail below.

Outcome Function Tokens

Consider some event with outcomes over a continuous space, say 

RR.We can imagine creating one outcome tokenXXfor every pointx∈Rx∈Rsuch that, if the outcome isxx, that outcome token will be exchangeable for $1, and the others will be worth $0.The simplest way to express holdings of these tokens is asfunctionsf:R→R+f:R→R+where(x)(x)is the number of tokens the owner offfholds for outcomexx. In other words, the holder offfwill receivef(x)f(x)if the outcome isxx.Formally, all positions in the context of continuous prediction markets are functions. Depending on context, it may be most helpful to think of these functions either as infinite collections of outcome tokens, as curves, or just as abstract members of function-space.

Minting and Redeeming

Consider the constant function 

f(x)=bf(x)=b. Regardless of the outcomex0x0​, the holder of this function will receivef(x0)=bf(x0​)=bat the time of resolution. So, we at any time allow this function to be minted or redeemed forbbdollars.

AMM Invariant

As in the discrete case, we will initialize our AMM with a fixed amount of dollars, 

bb.

We denote the AMM’s holding outcome function 

hhash(x)=b−f(x)h(x)=b−f(x)

The AMM can then sell up to 

f(x0)=bf(x0​)=bat any given pointx0x0​, since it will be able to pay outbbonce the outcome is determined. We would then haveh(x0)=b−b=0h(x0​)=b−b=0at that point, indicating the AMM cannot sell any more of that outcome.

If traders have, in aggregate, bought outcome function f(x) from the AMM…

...the AMM’s holdings h(x) are b-f(x).

We restrict 

ffto lie inL2L2, the space of square-integrable functions (i.e. functions whose square has a finite integral). This is an inner product space with inner productf⋅g=∫Rf(x)g(x)dxf⋅g=∫R​f(x)g(x)dx

Just as in the discrete case, we will choose a constant 

l2l2norm as our constant function. In this space, that constant is expressed as∣∣f∣∣2=∫Rf(x)2dx=k∣∣f∣∣2​=∫R​f(x)2dx​=k

Note that we’ve limited the 

l2l2norm here to a new constantkk, notbb, the amount of money with which we initialized our AMM. In the finite-dimensional case, no element of a vectorxxwithl2l2​normkkcan have a value of greater thankk, so ourl2l2​norm constraint was enough to ensure the AMM's solvency. In the infinite-dimensional case, this is no longer true. So we separate out the backing amount,bb, from thel2l2norm constraint,kk, and we add an additional constraint to the AMM, namelymax⁡f≤bmaxf≤b

Trading Behavior

At its simplest, the AMM starts by holding some function 

h(x)=b−f(x)h(x)=b−f(x). A trader who wants to move the market tog(x)g(x), so that the AMM now holdsb−g(x)b−g(x), will end up holdingg(x)−f(x)g(x)−f(x), the difference of the two functions.

The gray curve is the starting f(x), the position initially held in aggregate by all traders and a scalar multiple of the market's starting estimate of the true distribution. The blue curve is g(x), the scakar multiple of the distribution the trader is moving the market to that leads to the appropriate l_2 norm. The green and red curve is g(x)-f(x), representing the trader's position after the trade. They will make money if the outcome is in the green region and lose money in the red region. We can see they have shifted the mean down slightly and increased the variance, so that they in general make money if the outcome is outside the peaked area of the original f(x).

More formally, say the true probability distribution of the outcome in question is described by a probability density function 

p(x)p(x)so that the expected value of the AMM’s holdings isE(b−f(x))=b−E(f(x))=b−∫Rf(x)p(x)dx=b−f⋅pE(b−f(x))=b−E(f(x))=b−∫R​f(x)p(x)dx=b−f⋅p

where the last equality comes from our definition of inner product on this space.If the market is efficient, arbitrageurs will act to minimize the AMM’s expected value. In other words, they are solving the optimization problem

min⁡fb−f⋅p s.t. ∣∣f∣∣2=k and max⁡f≤bfmin​b−f⋅p s.t. ∣∣f∣∣2​=k and maxf≤b

Since the trader can’t affect 

bb, this simplifies tomax⁡ff⋅p s.t. ∣∣f∣∣2=k and max⁡f≤bfmax​f⋅p s.t. ∣∣f∣∣2​=k and maxf≤b

For a moment, assume the AMM has effectively infinite backing, so that the second constraint doesn’t matter and we simply have

max⁡ff⋅p s.t. ∣∣f∣∣2=kfmax​f⋅p s.t. ∣∣f∣∣2​=k

Then, just as in the discrete case, the Cauchy-Schwarz inequality tells us that the vector that maximizes this dot product given a fixed norm must be linearly dependent with 

pp— in other words, we know we must havef=kp∣∣p∣∣2f=k∣∣p∣∣p​2​

In other words, 

ff, the outcome function collectively held by traders, is directly proportional to the true probability distribution!This means that the AMM’s holdingshhare determined byh=b−f=k(1−p∣∣p∣∣2)h=b−f=k(1−∣∣p∣∣2​p​)

and we can again read traders' aggregate estimated distribution directly from the AMM’s reserves.

If the true distribution p(x) looks like this…

In an efficient market, traders’ holdings f(x) will, in aggregate, be shaped proportionally…

…and the AMM’s holdings h(x) will be the mirror image

Handling the Backing Constraint

We assumed above for convenience that the AMM’s backing 

bbwould be essentially infinite, but, of course, this will often not be the case.

When there are backing constraints, we have two options:

The first, and simplest, is to simply not permit traders to move 

f(x)f(x)to situations where we have∣∣f∣∣2=k∣∣f∣∣2​=kbutmax⁡f>bmaxf>b. In the normal case, as we will discuss below, this simply means forbidding traders to estimate standard deviations which are too narrow, which may be appropriate to help the market avoid getting wiped out by traders with inside information.

Alternately, we can simply enforce the constraint that 

f(x)≤bf(x)≤b. Let’s say a trader believes the true probability distribution isp(x)p(x). We leave it as an exercise to the reader to show that the trader’s optimal position will bef(x)=min⁡(λp(x),b)f(x)=min(λp(x),b)

for whatever 

λλmakes it such that∣∣min⁡(λp(x),b)∣∣2=k∣∣min(λp(x),b)∣∣2​=k. We can findλλnumerically offchain and then easily verify this property onchain for many distributions.

Liquidity Provision

The AMM allows permissionless adding of liquidity, with liquidity providers (LPs) receiving fungible LP shares, just like in Uniswap V2.Imagine for a moment we had a uniswap V2 pool containing 10,000 USDC and 1 ETH, with 10,000 LP shares outstanding. If a market participant wanted to add liquidity to this pool, they would have to add tokens that are a scalar multiple of the AMM's position, and would get a proportional share of the pool in return. So, for example, if a new liquidity provider were to double the liquidity in the pool, they could add 10,000 USDC and 1 ETH, and would receive 10,000 LP shares.Liquidity provision works just the same for the distribution AMM. A prospective liquidity provider needs to add assets proportional to the AMM's current position, and receives LP shares in return.The AMM's position is 

h=b−fh=b−f. So an LP wanting to add some proportionyyof current liquidity needs to contribute a positionyh=yb−yfyh=yb−yf. In return they will receiveylylLP shares, wherellis the current number of LP shares outstanding.In order to create the positionyhyh, we will require the LP to mint it usingybybcollateral. This means they will be left with a positionyb−yh=yb−(yb−yf)=yfyb−yh=yb−(yb−yf)=yfthat they can keep. This represents the market's position at the time they minted their LP shares.

Collateralization

The initial source of collateral to the AMM is the the first LP. If they initialize the pool with backing 

bb, they need to submitbbcollateral. They will also specify some initialfffor the pool, so that the pool's position ish=b−fh=b−fand the initial LP keeps the positionff. The AMM's position and the position of all traders then sums tobb, and there isbbcollateral, so the system is fully collateralized.Similarly, when a new LP adds liquidity, they are addingyb−yfyb−yfto the pool and keepingyfyffor themselves. They are then addingybybto total outstanding holdings, so as long as they provideybyb collateral, the system will remain fully collateralized. Furthermore, if the AMM's position and all traders' positions summed to the backing amount before they added liquidity, that equality will still hold afterwards.Finally, let's assume the system is fully collateralized when a trade takes place, and that the AMM's position and the position of all traders sums tobb. The market currently holdsh=b−fh=b−fand a trader moves the market toh2=b−gh2​=b−g, so that this trader should now holdg−fg−f. If this were the case, then because we know all other traders holdffin aggregate, then all traders together would holdf+(g−f)=gf+(g−f)=gin aggregate, which means that all traders and the market together holdb−g+g=bb−g+g=b in aggregate, and the market would still be fully collateralized.However, in order to say the trader holdsg−fg−f, they must actually lose money if the outcome isx0x0​and we haveg(x0)−f(x0)<0g(x0​)−f(x0​)<0. So the trader must collateralize this position with−min⁡xg(x)−f(x)−minx​g(x)−f(x)in collateral. We discuss how to verify this for the Normal case in that section below.

The Normal CaseOverview

The normal distribution is in some ways the canonical example of a continuous probability distribution.In this section, we discuss how we can use distribution markets to create a prediction market over normal outcomes in an efficient manner onchain.

l2l2​ Norm

The Normal distribution with mean 

μμand standard deviationσσhas probability distribution functionp(x)=12πσ2e−(x−μ)22σ2p(x)=2πσ2​1​e−2σ2(x−μ)2​

with 

l2l2norm∫R12πσ2e−(x−μ)2σ2dx=12σπ∫R​2πσ21​e−σ2(x−μ)2​dx​=2σπ​1​​

where the latter equality comes from the closed form solution to the Gaussian Integral.

AMM Behavior

We can see that the 

l2l2norm is agnostic to the mean of the distribution, so our AMM is indifferent between distributions with the same standard deviation but different mean -- traders can move the market to any mean they like while keeping the same standard deviation, and will only have to provide the appropriate collateral. In later work we may explore the ability to give our AMM apriorwhich might prefer some means over others.However, distributions with lower variance have higherl2l2norms. This means that if the market’s estimated normal distribution has standard deviationσσ, we havek=∣∣f∣∣2=∣∣λp∣∣2=λ∣∣p∣∣2=λ12σπk=∣∣f∣∣2​=∣∣λp∣∣2​=λ∣∣p∣∣2​=λ2σπ​1​​

and therefore

λ=k2σπλ=k2σπ​​

In other words, the more peaked a trader's proposed distribution is, the less total probability mass the market will be willing to sell to them. Again, this might help the market avoid getting wiped out by traders with inside information about a specific outcome.

Backing Constraints

Remember we have 

f=λpf=λp, withppbeing a Normal PDF. At its peak,pphas value12πσ22πσ2​1​. As a multiple ofpp, f has maximum valuemax⁡f=λ2πσ2=k2σπ12πσ2=k1σπmaxf=2πσ2​λ​=k2σπ​​2πσ2​1​=kσπ​1​​

Since we can never have 

f(x)>bf(x)>b, this means we must havemax⁡f=k1σπ≤bmaxf=kσπ​1​​≤b

so that

σ≥k2b2πσ≥b2π​k2​

As discussed in the general continuous case section above, we can simply restrict traders in the AMM from choosing standard deviations less than this.Alternately, we could allow traders to trade a capped Gaussian with any standard deviation they like, so that we would have 

f(x)=min⁡(b,λϕ(x))f(x)=min(b,λϕ(x))for whateverλλsatisfied thel2l2​norm constraint.

We can cap the trader's payout to b...

...so that the AMM's payout is 0 at minimum.

For the remainder of this paper, however, we'll just assume we're enforcing the lower bound on 

σσfor simplicity.

Collateralization

As discussed above in the collateralization section for the general continuous case, traders need to collateralize their trades with 

−min⁡xg(x)−f(x)−minx​g(x)−f(x)when moving the AMM fromh=b−fh=b−ftoh2=b−gh2​=b−g.Unfortunately, there is no apparent closed-form solution tomin⁡xap−bqminx​ap−bq, whereppandqqare Normal PDFs. However, we can compute this minimum numerically. Although there may be several local minima, it turns out that the only local minimum on the opposite side ofqq's mean frompp's mean will be the global minimum (the proof that there can be only one such point is a very interesting exercise). We can then verify that the trader has provided this point onchain by checking first and second derivatives (and also ensure that the total max loss is at least some "dust" amount to avoid numerical attacks) and require they provide the corresponding collateral amount.m=λ′2σqπ−λ2π(σp2+σq2)e−(μp−μq)22(σq2+σp2)m=2σq​π​λ′​−2π(σp2​+σq2​)​λ​e−2(σq2​+σp2​)(μp​−μq​)2​

Multiple Distributions

Note that we could have a single distribution AMM capable of trading multiple distributions -- as long as the 

l2l2​norm constraints and max loss constraints are obeyed, there is no reason not to let a trader switch from, say, a normal distribution to a uniform distribution in a single trade. The main point of practical difficulty would be in computing trade collateralization.This is relatively straightforward in the case of Normal -> Uniform and Uniform -> Normal distributions. We leave the calculations as an exercise to the reader.

Conclusion

We hope Distribution Markets help to spark ideas for builders and researchers on the cutting edge of information finance.If that's you, we'd love to hear from you.

Acknowledgements

Dan RobinsonYang YouAchal SrinivasanBhargav Annem5/9Sofiane LarbiCiamac MoallemiTom Deanandnasnd0xTomoyoPia ParkQiaochu YuanConnor LurringGrant StengerSantiago Lisa

Comments

All Comments

Recommended for you