logo

Cost Function in Prediction Markets: How Prices Move

Cost Function in Prediction Markets: How Prices Move
8,963

In an automated prediction market, price does not move randomly. It follows a rule. That rule may come from an order book, where traders post bids and asks, or from an automated market maker formula. When a market uses a formula, one of the central pieces is the cost function.

A cost function connects the displayed price before an order, the average execution price during the order, and the new marginal price after the order. If a large trade pushes a market from 50% to 60%, the cost function is one way to explain that movement mathematically.

This guide explains the concept in the context of prediction market microstructure, with a focus on AMMs, LMSR, liquidity, slippage, and differences from CLOBs such as those documented by Polymarket and Kalshi. This is educational content, not investment or trading advice.

What is a cost function in prediction markets?

A cost function is the mathematical rule that calculates how much it costs to buy contracts and move the implied probability in a prediction market. In AMMs such as LMSR, the price does not come from a direct counterparty. It comes from the difference between the market cost before and after the order.

In simple terms, the function looks at the current market state, calculates the cost of adding more contracts to one outcome, and turns that change into price. It is not a platform fee, an operational expense, or a fixed trading charge. It is the mechanism that determines how price changes when someone trades.

In a binary market, there may be two outcomes: Yes and No. If many traders buy Yes, the cost curve makes the marginal price of Yes rise. The implied probability rises with it. If traders buy No, the movement goes the other way.

The key point: a cost function turns order flow into market probability.

How a cost function turns orders into prices

The easiest way to understand the mechanism is to compare two states: before and after the order.

A market can be represented by a vector of quantities, usually written as q. This vector tracks how many contracts of each outcome have been bought inside the mechanism. The cost function, written as C(q), assigns a cost to the current state. When a trader buys more contracts, the vector moves from q to q'. The order cost is:

order cost = C(q') - C(q)

That difference is what the trader pays to move the market from the initial state to the new state. It is not simply current price multiplied by quantity, because the price can change during the order itself.

Marginal price vs. average execution price

Two prices matter:

  • Marginal price: the price of the next tiny unit of exposure at the current market state. This is the displayed probability at that instant.
  • Average execution price: the total order cost divided by the number of contracts bought. This is the average price actually paid across the order.

When the order is small, the average price stays close to the initial marginal price. When the order is large, it moves across the price curve. For a large Yes buy, the average price will be above the initial price and below the final marginal price. That difference is a form of slippage.

This is why a trader should not read “the market is at 50%” as “I can buy any size at 50%.” Size matters.

Practical example: a central bank decision market

Imagine a hypothetical market: “Will the central bank hold rates at the next meeting?” The market starts balanced at 50% Yes and 50% No.

A trader believes the probability should be higher and buys Yes contracts. The order is large enough to move the final marginal probability from 50% to 60%. What happened?

The trader did not simply “buy at 60%.” The order started when the marginal price was 50% and ended when the marginal price reached 60%. The average price was likely somewhere between 50% and 60%, depending on the curve.

Step Marginal Yes probability Interpretation
Before the order 50% Balanced market
During the order 52%, 55%, 58% Each additional contract costs more
After the order 60% New marginal price for the next contract
Average price paid between 50% and 60% Result of the path across the curve

This is a hypothetical example. It does not describe live prices or a real central bank meeting. It shows the mechanics: the order moves the curve, and the cost function determines the cost of that movement.

LMSR: the best-known cost function for prediction markets

The best-known family of cost functions in prediction markets comes from market scoring rules, especially LMSR, or Logarithmic Market Scoring Rule. Robin Hanson’s work on market scoring rules is a classic technical reference for this mechanism.

A common LMSR cost function is:

C(q) = b · ln(Σ exp(qᵢ / b))

Where:

  • qᵢ is the quantity of contracts associated with outcome i;
  • b is the liquidity parameter;
  • ln is the natural logarithm;
  • Σ exp(qᵢ / b) sums the exponential terms across outcomes.

The formula looks technical, but the intuition is simple. It creates a smooth curve where buying more of one outcome raises its marginal price. The price adjusts continuously as the market state changes.

The liquidity parameter b

The parameter b controls market depth. A higher b means more contracts are needed to move price. A lower b makes the market more sensitive to each order.

That creates a design trade-off. Higher b improves execution quality and reduces slippage, but requires more subsidy or capital. Lower b reduces the market maker’s exposure, but makes prices move faster.

Bounded loss

One advantage of LMSR is that it can limit the market maker’s maximum loss under the model. This is known as bounded loss. It does not remove trader risk or guarantee efficient prices. It means the mechanism can define a calculable exposure limit for the operator.

Cost curves, liquidity, and slippage

For traders, the cost function appears as liquidity, depth, and slippage. A flatter curve absorbs larger orders with less price impact. A steeper curve moves quickly.

Three practical concepts matter:

  1. Displayed probability: the marginal price of the next contract.
  2. Executable price: the average price for the intended order size.
  3. Real depth: how much size the market can absorb before price moves materially.

A market may show 55%, but a large order may execute at a very different average price. The cost curve explains the gap.

Slippage is not the same as a fee. A fee is explicit. Slippage is the cost of trading size against a curve or against limited book depth.

Cost function vs. order book: Polymarket and Kalshi

Not every prediction market uses a cost function as the main pricing engine. Many modern markets use a CLOB, or central limit order book.

In a CLOB, prices come from limit orders posted by participants: bids, asks, available sizes, and execution priority. Polymarket’s public documentation describes CLOB trading with offchain matching and onchain settlement. Kalshi’s documentation exposes order books with Yes and No bids; in binary markets, a Yes bid at X cents is economically equivalent to a No ask at 100-X cents.

Aspect AMM with cost function CLOB / order book
Source of price Mathematical formula Bids and asks from participants
Liquidity Parameterized curve Available orders in the book
Slippage Comes from curve slope Comes from depth at price levels
Best use case Early or thin markets Active markets with competing liquidity

Neither model is always better. AMMs can give a new market an immediate price. CLOBs can be efficient when enough traders provide liquidity. Some designs can combine elements of both.

Why traders should understand cost functions

Understanding cost functions helps traders estimate price impact before trading, compare markets with similar displayed probabilities but different depth, and avoid confusing displayed probability with executable price.

Prediction market prices aggregate information, incentives, and liquidity. They are useful signals, but they are not guarantees. A 60% probability still means the event may not happen.

A practical way to use this concept is to separate signal from execution. The signal is the probability you think is wrong. Execution is the price path you must travel to express that view. A shallow market can make a correct view expensive to trade if the order itself moves the price too far.

This also matters for market observers who do not trade. A displayed probability can look precise, but its reliability depends partly on how expensive it is to move. A market with thin liquidity may react strongly to one motivated trader. A deeper market usually requires broader conviction or more capital to shift the same number of percentage points.

For analysts, the cost function is therefore not just a formula. It is part of the information environment. It shapes how quickly prices react, how much noise a single order can create, and how much confidence readers should place in a probability at a given moment.

Common mistakes

Confusing AI cost functions with AMM cost functions

In machine learning, a cost or loss function measures error during model training. In AMMs, a cost function prices contracts and moves market probabilities. Same phrase, different economic role.

Treating final price as average price

If an order moves a market from 50% to 60%, the 60% is the final marginal price. It is not necessarily the average price paid.

Ignoring fees, spreads, and depth

Real execution can involve platform fees, market rules, order limits, delays, or competing traders. Good analysis separates each component.

FAQ

What is the cost function formula?

The general form is C(q). In LMSR, a common version is C(q)=b·ln(Σ exp(qᵢ/b)). The order price is C(q') - C(q).

Is a cost function the same as a loss function?

Not necessarily. In AI, it measures prediction error. In prediction market AMMs, it defines the cost of buying contracts and moving prices.

Does Polymarket use AMM or CLOB?

Polymarket’s public documentation describes CLOB trading. Always check current platform documentation before making implementation claims.

Does Kalshi use an order book?

Kalshi’s documentation exposes market order books with Yes and No bids, illustrating order-book logic in binary markets.

Does a cost function eliminate slippage?

No. It defines how slippage occurs. More liquidity reduces price impact; a steeper curve increases it.

Conclusion

A cost function connects orders, prices, liquidity, slippage, and market-maker risk in AMM-based prediction markets. It explains why marginal price changes, why large orders have an average price different from the displayed price, and why liquidity should be read as a curve rather than a single number.

For more context, return to the prediction market microstructure glossary and study LMSR, CLOB, market depth, and slippage together.

Sources

Disclaimer: educational content only. Not investment, trading, or platform-use advice.

Author
Dale Hanson
Dale HansonCommunity Manager. X @InHansonWeTrust