↓ Skip to main content
All methods

stakepd.kelly_criterion

Function → float or Series
Signature
spd.kelly_criterion(odds, true_probability, odds_type, bank_roll=100.0, kelly_percentage=1.0)

Calculate how much to stake on a positive-EV bet using the Kelly criterion.

The Kelly criterion sizes a bet from the odds on offer and your own estimate of the outcome’s true probability. A bet with no edge gets a stake of 0.0.

Parameters

odds:float, int or pandas.Series
Odds in odds_type format. Must be a scalar if true_probability is a scalar, or a Series of the same length if it is a Series.
true_probability:float or pandas.Series
Your estimated ’true’ probability of each outcome.
odds_type:{'decimal', 'fractional', 'american'}
Format of odds.
bank_roll:float, default 100.0
Bankroll available for betting.
kelly_percentage:float, default 1.0
Fraction of the full Kelly stake to bet, as a decimal. Use e.g. 0.5 for half-Kelly.

Returns

float
The amount to wager, if the inputs are scalars.
pandas.Series
Amounts to wager, if the inputs are Series. Same length as odds and true_probability.

See also

pandas.Series.devig
Estimate fair probabilities from a market’s prices.
stakepd.profit
Calculate the profit of a bet, or of a Series of bets.
stakepd.payout
Calculate the payout of a bet, or of a Series of bets.

Notes
#

With decimal odds d and true probability p, the full-Kelly fraction of the bankroll is

f* = (b·p − (1 − p)) / b,    where b = d − 1

The stake is f* × kelly_percentage × bank_roll. When f* is negative (the bet has negative expected value) the stake is 0.0.

Examples
#

import pandas as pd
import stakepd as spd

No edge:

bankroll = 100
odds = pd.Series([2.0, 3.0])
probabilities = pd.Series([0.4, 0.3])
wagers = spd.kelly_criterion(odds, probabilities, 'decimal', bankroll)
print(wagers)
Output:
result
0    0.0
1    0.0
dtype: float64

0.0 means that you shouldn’t make the bet.

Positive edge:

bankroll = 1000
odds = pd.Series([2.0, 3.0, 1.5])
probabilities = pd.Series([0.6, 0.4, 0.7])
wagers = spd.kelly_criterion(odds, probabilities, 'decimal', bankroll)
print(wagers)
Output:
0    200.0
1    100.0
2    100.0
dtype: float64

This method is also covered, alongside the rest of the module, in the overview guide.