Template: fair odds and bookmaker margin calculator (sports data)

I built a small public template that turns bookmaker odds into fair probabilities. It’s a nice example of multi-line Python formulas handling an optional column, so I thought it might be useful here.

Template (view, then “Save copy” to use it): Fair Odds & Bookmaker Margin Calculator - Grist

What it does

Type the decimal odds for each outcome (leave the draw blank for two-way markets) and the formula columns work out:

  • Book: the sum of 1/odds across every outcome. A fair market sums to exactly 1.
  • Margin: Book minus 1, the bookmaker’s cut.
  • Fair odds: each price multiplied by the Book (the simple “proportional” method).
  • Fair chance: the implied probability once the margin is removed.
  • Average cost per $100: 100 × margin / (1 + margin).

The formula that handles the optional draw column

if not ($Odds_1 and $Odds_2):
  return None
t = 1/$Odds_1 + 1/$Odds_2
if $Odds_X:
  t += 1/$Odds_X
return t

Every other column starts with if not $Book: return None, so a half-filled row stays blank instead of showing errors.

Example rows included

Match Odds Margin Fair odds
Tennis, two-way 1.80 / 2.05 4.34% 1.88 / 2.14
Soccer, three-way 2.30 / 3.30 / 3.10 6.04% 2.44 / 3.50 / 3.29
Coin flip at -110 1.909 / 1.909 4.77% 2.00 / 2.00

A second table, Study_Averages, holds average margins by market type (two-way 4.8%, totals 6.4%, three-way 7.5%, player stats 7.6%), measured across 69.6 million markets in the State of the Vig 2026 study, with the cost-per-$100 formula next to each.

Ideas I’d welcome: a cleaner way to support the “power” and “Shin” de-margining methods (both need an iterative solve; I’m wondering whether a small bisection loop inside a formula is reasonable in Grist or better as a custom widget).