Making a Prediction Market (for IPL Betting)

I am making a prediction market for IPL betting, which I’m calling gamBET (like gambit & bet, not gambling & betting, though I guess that works too). It’s a fun project that I’ve been working on, after I watched a video on Why Betting Markets Beat The Experts by Art of the Problem. Hopefully, I’ll be able to launch it before 22nd March, 2025, when the next IPL season starts. In this blog post, I’ll share some of the things I learned while building gamBET.

What is a Prediction Market?

A prediction market is a market where participants trade on the outcome of events. The price of a share in the market represents the probability of the event occurring. For example, if the price of a share in the market is ₹0.75, it means that the market believes there is a 75% chance of the event occurring. If the event occurs, the share is redeemed for ₹1, otherwise it is redeemed for ₹0.

Why Betting Markets Beat The Experts (some points from the video)

Collective Intelligence: The Power of Crowds

Prediction markets leverage the wisdom of crowds - the phenomenon where the collective judgment of a diverse group often proves more accurate than individual expert opinions. This works because:

  • Different participants bring unique perspectives and information
  • Averaging across many independent estimates tends to cancel out individual errors
  • People with more confidence in their knowledge tend to bet more, naturally weighting the market

This concept connects to the Law of Large Numbers in statistics, which states that as a sample size increases, results tend to approach the expected value. In prediction markets, as more people participate, the market price converges toward the true probability of an event.

Similar to Monte Carlo simulations (which run thousands of random scenarios to approximate solutions), prediction markets aggregate thousands of individual “bets” to arrive at remarkably accurate forecasts of complex events.

Here are some examples where prediction markets have outperformed experts:

The 1916 US Election: In the 1916 election between Wilson and Hughes, the New York Times declared Hughes the president, but the betting markets favored Wilson, who ultimately won.

The 2024 US Election: This one I observed myself as well, when CNN and Fox were calling the election “too close to call”, the Polymarket prediction market was already declaring a winner. As we can see in the graph below, Polymarket was predicting Trump more than a month before polling day.

Graph showing Polymarket's prediction of the 2024 US Election

How Algorithms Work in Prediction Markets

Traditional bookmaking relied on experienced oddsmakers who manually:

  • Set initial odds based on expertise
  • Adjusted prices as bets came in
  • Balanced their books to ensure profit

Nowadays, there are automated market-making algorithms like LMSR, which dynamically adjust prices based on trades.

Logarithmic Market Scoring Rule (LMSR)

Introduced by Robin Hanson in his 2002 paper, “Logarithmic Market Scoring Rules for Modular Combinatorial Information Aggregation”

One of the most common ways to run a prediction market is using the Logarithmic Market Scoring Rule (LMSR). This mechanism ensures that prices adjust dynamically based on trades, maintaining liquidity while keeping the market efficient.

Here’s how it works:

  • The cost function ensures that buying more shares increases the price non-linearly.
  • Traders buy shares in different outcomes, moving the prices based on demand.
  • The pricing function is given by: C(q1,q2,...,qn)=blogieqi/bC(q_1, q_2, ..., q_n) = b \log \sum_{i} e^{q_i/b} where qiq_i is the quantity of shares in each outcome and bb is a scaling factor that determines market liquidity.

A big reason to choose LMSR was that, as it ensures that the market is always liquid, as I don’t expect a lot of liquidity (also I did not wish to maintain an order book).

To illustrate how this works in practice, let’s look at a simple example:

  • For a match between Mumbai Indians and Chennai Super Kings
  • If the initial probabilities are 60% for Mumbai and 40% for Chennai
  • If someone buys 100 shares of Chennai winning, the price might adjust to 45% for Chennai and 55% for Mumbai
  • The more shares purchased, the more expensive subsequent shares become, creating a natural balancing mechanism

ELO Ratings for IPL Teams

To provide a starting probability for IPL matches, I’m using ELO ratings. This is a well-known system used in chess and esports, where each team has a rating that changes based on match results.

The rating update formula is: R=R+K(SE)R' = R + K (S - E)

where:

  • RR' is the new rating.
  • RR is the current rating.
  • KK is a constant determining sensitivity to changes.
  • SS is the actual result (1 for a win, 0 for a loss, 0.5 for a draw).
  • EE is the expected probability of winning.

Calculating the Expected Probability of Winning

The expected probability of winning for a team is derived from the ELO ratings of both competing teams using the following formula:

EA=11+10(RBRA)/400E_A = \frac{1}{1 + 10^{(R_B - R_A) / 400}}

EB=11+10(RARB)/400E_B = \frac{1}{1 + 10^{(R_A - R_B) / 400}}

where:

  • EAE_A is the expected probability of Team A winning.
  • EBE_B is the expected probability of Team B winning.
  • RAR_A and RBR_B are the ELO ratings of Team A and Team B, respectively.

This formula ensures that a higher-rated team has a higher probability of winning, but an upset is always possible. As teams win and lose matches, their ELO ratings adjust dynamically, refining the probabilities for future matches.

For example, if Mumbai Indians has an ELO rating of 1600 and Chennai Super Kings has 1500:

EMumbai=11+10(15001600)/400=11+100.25=11+0.56=0.64E_{Mumbai} = \frac{1}{1 + 10^{(1500 - 1600) / 400}} = \frac{1}{1 + 10^{-0.25}} = \frac{1}{1 + 0.56} = 0.64

This gives Mumbai a 64% chance of winning according to the ELO system, which becomes the initial market probability before any trades occur. I use this to determine the initial odds for the IPL matches, and then the LMSR mechanism takes over, allowing the market to do its thing.

gamBET Sneak Peek

Finally, here are some sneak peek images of the gamBET platform:

gamBET profile page gamBET market page gamBET market page

Stay tuned for more updates as I refine gamBET before the IPL season begins!