artiebits.com

Optimal Betting Strategy with Kelly Criterion

After creating a Poisson model to predict football match results, I started wondering how to manage my bankroll.

Fixed Percentages

Betting a flat amount, like $20 out of a $100 bankroll, is simple yet risky. Four losses in a row will take you down to $20, one bet away from 0.

A more cautious approach is to cap each bet at a small percentage of your bankroll, like 5%. In that case, $5 per bet means that even after four straight losses, you’d still have $80. Better, yet still not optimal.

Kelly Criterion

When your model gives a high probability of winning, you might want to bet more. And this is where the Kelly Criterion comes into play. Introduced in 1956 by Bell Labs scientist John L. Kelly, this formula is designed to maximise long-term growth while minimising the risk of bankruptcy. It’s the closest thing to mathematically “correct” bet sizing we know.

f=pqbf = p - \frac{q}{b}

Where:

To make this formula work, your model’s probability must be greater than the implied probability from the bookmaker’s odds.

Kelly Criterion Example 1

If your model predicts a 60% chance of success (p=0.60p = 0.60) and the bookmaker offers odds of 1.70 (b=0.70b = 0.70), Kelly suggests betting 2.86% of your bankroll:

f=0.60(10.60)0.70=0.0286f = \frac{0.60 - (1 - 0.60)}{0.70}=0.0286

Kelly Criterion Example 2

If you estimate a 50% chance of success at odds of 2.0 (b=1.0b = 1.0), Kelly will recommend betting 0%:

f=0.50(10.50)1=0f = \frac{0.50 - (1 - 0.50)}{1} = 0

This is because with a 50% chance of winning, you will lose half the time and win the other half and not make any money in a long run.

Implementation in Python

Let’s implement the Kelly Criterion:

def kelly_criterion(prob_win, odds, bankroll):
    """
    Calculate the optimal betting amount using Kelly Criterion.
    
    :param prob_win: Probability of winning (decimal between 0 and 1)
    :param odds: European odds (decimal odds, e.g., 2.0 for 1:1 odds)
    :param bankroll: We add this param to return the actual amount to bet.
    :return: Optimal amount of money to bet (decimal)
    """
    # Convert European odds to the b value in the Kelly formula (b to 1)
    b = odds - 1
    prob_lose = 1 - prob_win
    kelly_fraction = prob_win - (prob_lose / b)
    # Make sure the fraction is not negative; if it is, set to 0
    kelly_fraction = max(kelly_fraction, 0)
    return kelly_fraction * bankroll

# Example usage
bet_amount = kelly_criterion(0.6, 2.0, 100)
print(f"You should bet ${bet_amount:.2f} from your bankroll.")

Kelly Criterion can be “aggressive” when the chance of winning is high.

If your model estimates an 88% chance of both teams scoring and the odds are 1.70, Kelly would suggest risking 70% of your bankroll, which is unrealistically high.

Your model should never be overconfident because football is full of randomness that can change the course of a match. But if your model is off, Kelly can lead to significant loss.

Fractional Kelly

Many professional gamblers bet only 20–30% of the full Kelly because in sports odds and true probabilities are never known with certainty. It’s called fractional Kelly and it sacrifices a tiny bit of theoretical growth for a huge reduction in risk.

Fractional Kelly formula:

ffractional=k×(pqb)f_{\text{fractional}} = k \times \left(p - \frac{q}{b} \right)

Where kk is a fixed fraction that you are comfortable with.

Here is implementation in Python:

def fractional_kelly_criterion(prob_win, odds, bankroll, fraction=0.5):
    b = odds - 1
    prob_lose = 1 - prob_win
    kelly_fraction = prob_win - (prob_lose / b)
    kelly_fraction = max(kelly_fraction, 0)
    return kelly_fraction * fraction * bankroll

# Example usage:
bet_amount = fractional_kelly_criterion(0.6, 2.0, 100, fraction=0.5)
print(f"You should bet ${bet_amount:.2f} from your bankroll.")

Conclusion

Kelly only works when your prediction is better than the bookmaker’s odds. For that, you need a solid model—and the occasional mispriced odds, which I’ll cover in my next post. Until then, manage your bankroll wisely and stay in the game.