Live model · Prediction markets

How Prediction Markets Actually Work

A prediction market trades contracts that pay $1 if something happens and nothing if it doesn't. Buyers of YES and buyers of NO post bids in an order book; when a YES price and a NO price add up to $1, they trade. The price of YES, in cents, reads as the market's odds.

A YES/NO order book, one order at a time

The book holds only bids. The best YES bid is 51¢; the best NO bid, 47¢, is a YES ask at 100 − 47 = 53¢, because a contract pays $1 to one side or the other.
StopOrder book
Max buysAt up to (¢)Side
Best YES bid51¢Best YES ask53¢Last tradenoneShown as52%

Order arriving

YES bids: buyers of YES

PriceQtyWho
51¢200Ana
51¢150Eve
50¢300Cal
48¢500Gus

NO bids = YES asks

NO bidQtyWhoYES ask
47¢150Ben53¢
46¢250Dee54¢
44¢300Fay56¢
40¢300Hal60¢
35¢400Ivy65¢
28¢900Jon72¢

Last trade, cents per YES

spread40506070800123456trades¢
  • CH1 last trade

Watch the Python behind this model run, line by line

How to read the stage

Kalshi's API lists only bids, because a YES bid at p cents is a NO ask at 100 − p. Here the best YES bid is 51¢, and the best NO bid, 47¢, makes a YES ask of 53¢. Kim's NO order fills Ana's 51¢ bid before Eve's, which came later at the same price. Then Max buys 1,000 YES at up to 75¢ and walks the book from 53¢ to 65¢.

What the odds on the page mean

Polymarket shows the midpoint of the best bid and ask, or the last trade if the spread is wider than 10¢. Before Max's order that's 52%, halfway between 51¢ and 53¢. After it the book is 51¢ bid and 65¢ asked, a 14¢ spread, so the page would show the last trade: 65%. One trader moved the odds 13 points, and nothing about the event changed.

Where the $1 comes from

Every trade pairs a YES buyer with a NO buyer whose prices add to $1: Max's 54¢ meets Dee's 46¢. Polymarket's docs describe this match creating a complete set, one YES and one NO, from $1 of collateral. When the event resolves, each winning contract pays $1. Kalshi runs as a designated contract market, regulated by the CFTC.

Drill the mechanism

Each side of the book is a priority queue: a heap keyed by price, then by arrival, so the best bid is always on top and a match pops it. Kth Largest Element in an Array keeps the same kind of heap, and Find Median from Data Stream balances two of them, one for each half, like a book's two sides.

What the model leaves out

The model only places buy orders with a price limit. Real exchanges also take sales of contracts you hold, market orders, cancellations and fees, and Polymarket matches off-chain and settles on-chain. The book here is hand-made and thin, so one order moves it far; a busy market holds more contracts at each price, and the same order would move it less.

Questions

How does Kalshi work?
Kalshi lists yes-or-no contracts on events, each worth $1 if you're right. Traders post bids for YES or NO, and Kalshi matches them by price, then by time. Its API returns only bids, since a YES bid at X¢ is the same as a NO ask at 100 − X¢. The CFTC designated it a contract market in November 2020.
Are Polymarket odds a probability?
They're a price. Polymarket shows the midpoint of the best bid and ask, or the last trade when the spread is wider than 10¢, and reads a 37¢ price as 37%. A price is what traders were willing to pay, so a thin market can jump on one order, as it does on the stage.
Who is on the other side of my bet?
Another trader. On the stage every trade pairs a YES buyer with a NO bid resting in the book, or the reverse, at prices that add to $1. Polymarket's docs describe that pair of orders creating a new YES and a new NO from $1 of collateral.
How much has been bet on the 2026 midterms?
Reuters reported on October 14, 2026 that traders had bet more than $220 million on congressional midterm markets across Kalshi and Polymarket through September 30, according to the Anti-Corruption Data Collective, against $92 million for the whole 2024 cycle.
What happens if nobody takes my order?
It rests in the book as a bid, behind any earlier bid at the same price, until an order crosses it. Try A limit too low to trade under Break it: Max's bid at 50¢ waits behind Cal's.

Drill the mechanism

Each side of the book is a priority queue: a heap keyed by price, then by arrival, so the best bid is always on top and a match pops it. Kth Largest Element in an Array keeps the same kind of heap, and Find Median from Data Stream balances two of them, one for each half, like a book's two sides.

More of how it works