# How to Find the Optimal Betting Amount

After creating a Poisson model to predict football match results, I started wondering how much money I should bet.

If you bet too much and lose, it could hurt your bankroll. But if you bet too little, you might not make as much as you could have.

One simple way to decide how much to bet is to use a fixed percentage of your bankroll, like 2-3%.

Suppose you start with $100. If you bet $20 on each game and lose four games in a row, you are suddenly down to $20. That is a bad spot to be in because you could lose your remaining money in the next bet. But if you bet only 3% of your bankroll, which would be $3, even after losing four times, you’d still have enough money left to continue betting and recover.

By betting only a small portion of our bankroll we withstand losses over a long period of time without losing all our money.

But this method has its limitation - if you have a high probability of an event happening, you might want to bet more.

This is where the Kelly Criterion comes into play. Introduced in 1956 by John L. Kelly, a scientist at Bell Labs, this formula is designed to maximize returns while minimizing the risk of bankruptcy.

The Kelly Criterion formula is:

$f = p - \frac{q}{b}$Where:

- $f$ is fraction of the bankroll to bet
- $p$ is probability of winning
- $q$ is probability of losing, which is $1-p$
- $b$ is the odds of the bet

For example, if you believe there’s a 50% chance of winning (p=0.5) at odds of 2.0 (b=1), the formula suggests betting $0 because the Expected Value (EV) of the bet is zero:

$f = \frac{0.5 - (1 - 0.5)}{1}=0$Expected Value is a fundamental principle in statistics used to determine the average outcome of a decision. If it’s zero or negative, then it’s better to search for a better opportunity.

The Kelly Criterion uses the concept of Expected Value to find the best amount to bet, aiming to maximize the growth rate of your bankroll.

Let’s finally implement the Kelly Criterion formula using Python.

```
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.")
```

This formula is simple yet elegant and widely used to find the right amount to bet on sports.

There is one more thing. Some might find the Kelly Criterion “aggressive” because it suggests betting a large part of your bankroll when EV is high.

Even though it’s designed to not completely wipe your bankroll, it can still lead to big losses in the short term, which might not be comfortable for everyone.

To make the Kelly Criterion less aggressive many gamblers use a fractional Kelly. I am one of them. You can go with one-half (0.5), one-quarter (0.25), three-quarters (0.75), or any other fraction that suits you best. This approach lowers the risk and reduces big swings in your bankroll while still aiming for good growth.

Fractional Kelly Criterion formula:

$f_{\text{fractional}} = k \times \left( p - \frac{q}{b} \right)$Where $k$ is a fixed fraction that you are comfortable with.

Here is the 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.")
```

That’s it folks, using proportional betting will helps you manage your money wisely and increase your returns. Good luck!

*If you have any questions or feedback about this post, please don’t hesitate to DM me on X or LinkedIn. I’d be happy to hear from you!*