spd.kelly_criterion(odds, true_probability, odds_type, bank_roll=100.0, kelly_percentage=1.0)
Calculate the amount to bet on a positive expected value (EV) bet according to the Kelly Criterion formula.
Parameters:
odds(float,int, orpandas.Series): Scalar or Series of odds inodds_typeformat. Must match the type oftrue_probability.true_probability(floatorpandas.Series): Scalar or Series of estimated true probabilities of events.odds_type(str): Type of odds provided. Supported values are'decimal','fractional', and'american'.bank_roll(float, optional): Total bankroll available for betting. Default is100.0.kelly_percentage(float, optional): Kelly fraction as a decimal for fractional Kelly sizing. Default is1.0(full Kelly).
Returns:
float: Amount to wager according to the Kelly Criterion, orpandas.Series: Series of Kelly wager values with the same length astrue_probabilityandodds.
A returned value of 0.0 means the bet has no positive edge and should not be placed.
Example (no edge):
import pandas as pd
import stakepd as spd
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)
0 0.0
1 0.0
dtype: float64
Example (positive edge):
import pandas as pd
import stakepd as spd
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)
0 200.0
1 100.0
2 100.0
dtype: float64