Skip to main content
Sports Predictor includes OddsConverter, a static utility class in betting_math.py that converts between the three most common betting odds formats. No instantiation is needed — call each method directly on the class.
betting_math.py lives inside the Betting and Parlay Engine/ directory (directory name contains spaces). To import it, add the directory to your Python path first:
import sys
sys.path.append("Betting and Parlay Engine")
from betting_math import OddsConverter

Odds formats

FormatExampleDescription
American (moneyline)+150, -200Positive = underdog (profit per 100wagered);negative=favorite(amounttowagertoprofit100 wagered); negative = favorite (amount to wager to profit 100)
Decimal2.5, 1.5Total return per $1 wagered, including stake
Implied probability0.4, 0.667The bookmaker’s assessed likelihood of an outcome, expressed as a value between 0 and 1

Methods

Convert American (moneyline) odds to decimal odds.
american
int
required
American odds value. Positive for underdogs (e.g. +150), negative for favorites (e.g. -200). Cannot be 0.
Returns: float — decimal oddsFormula:
  • If american > 0: (american / 100) + 1
  • If american < 0: (100 / abs(american)) + 1
Raises: ValueError if american == 0
from betting_math import OddsConverter

OddsConverter.american_to_decimal(150)   # → 2.5
OddsConverter.american_to_decimal(-200)  # → 1.5

Complete example

from betting_math import OddsConverter

american_odds = -200

# Convert to all formats
decimal = OddsConverter.american_to_decimal(american_odds)
probability = OddsConverter.american_to_probability(american_odds)

print(f"American:    {american_odds}")
print(f"Decimal:     {decimal}")        # 1.5
print(f"Probability: {probability:.3f}") # 0.667

# Convert back from decimal
back_to_american = OddsConverter.decimal_to_american(decimal)
print(f"Back to American: {back_to_american}")  # -200.0

What implied probability means

Implied probability is the likelihood of an outcome as priced into the odds by a sportsbook. A line of -200 implies the bookmaker believes the favorite wins roughly 66.7% of the time.
Sportsbooks build a margin (the “vig” or “juice”) into their lines, so the sum of implied probabilities across all outcomes in a market typically exceeds 1.0. When comparing model probabilities against bookmaker odds, keep this overround in mind.
When your model’s predicted probability exceeds the implied probability from the odds, the bet may represent positive expected value. See Evaluating Bets for how to act on this.

Build docs developers (and LLMs) love