Programming with betting odds, made simple
Project description
Degen
pronounced "dee-gen"
Programming with betting odds, made simple
Easy to initialize Odds
objects.
from degen import AmericanOdds
odds = AmericanOdds(-110)
print(odds.value)
# >>> -110
Easily convert to and from each type of odds. AmericanOdds
DecimalOdds
and ImpliedProbability
are all Odds
types, and support .to_american_odds()
.to_decimal_odds()
and .to_implied_probability()
methods for easily switching between odds types.
odds = AmericanOdds(-110)
decimal_odds: DecimalOdds = odds.to_decimal_odds()
print(decimal_odds.value)
# >>> 1.909090909090909090909090909
implied_probability: ImpliedProbability = odds.to_implied_probability()
print(implied_probability.value)
# >>> 0.5238095238095238095238095238
Easily compute Parlay odds
odds1 = AmericanOdds(-110)
odds2 = AmericanOdds(-110)
parlay_odds: AmericanOdds = odds1 & odds2
print(parlay_odds.value)
# >>> 264.4628099173553719008264463
Easily compute Juice
juice = AmericanOdds(-110) | AmericanOdds(-110)
# Juice can't be represented by american odds, so the type of the juice
# variable will be "ImpliedProbability" after the computation, which is still an Odds type.
print(type(juice))
# >>> <class 'degen.odds_models.ImpliedProbability'>
# ImpliedProb > 1.0 provides a measure of "juiced" odds, or the book "vig"
print(juice.value)
# >>> 1.047619047619047619047619048
# You can ask all odds objects if they're "juiced"
print(juice.is_juiced)
# >>> True
Features
- Everythign done with Decimals for numerical precision
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
degen-0.1.4.tar.gz
(4.1 kB
view hashes)