Module path
The source directory is named
Betting and Parlay Engine (with spaces). When importing directly after adding the directory to sys.path, use:OddsConverter
A stateless utility class. All methods are @staticmethod — no instantiation required.
OddsConverter.american_to_decimal()
Converts American (moneyline) odds to decimal odds.
Signature
Parameters
American odds value. Positive values represent the profit on a 100 (e.g.,
-110). Must not be 0.float — decimal odds equivalent.
Raises: ValueError if american == 0.
Formula
- Positive:
(american / 100) + 1 - Negative:
(100 / abs(american)) + 1
Example
Source
betting_math.py
OddsConverter.american_to_probability()
Converts American odds to an implied win probability.
Signature
Parameters
American odds value. Must not be
0.float — implied probability in the range (0.0, 1.0).
Raises: ValueError if american == 0.
Formula
- Positive:
100 / (american + 100) - Negative:
abs(american) / (abs(american) + 100)
Example
Source
betting_math.py
OddsConverter.decimal_to_american()
Converts decimal odds to American (moneyline) odds.
Signature
Parameters
Decimal odds value. Must be greater than
1.float — American odds equivalent. Positive for underdogs (decimal >= 2.0), negative for favourites (decimal < 2.0).
Raises: ValueError if decimal <= 1.
Formula
decimal >= 2.0:(decimal - 1) * 100decimal < 2.0:-100 / (decimal - 1)
Example
Source
betting_math.py
OddsConverter.decimal_to_probability()
Converts decimal odds to an implied win probability.
Signature
Parameters
Decimal odds value. Must be greater than
1.float — implied probability in the range (0.0, 1.0).
Raises: ValueError if decimal <= 1.
Formula
1 / decimal
Example
Source
betting_math.py