A python script to remove the overround from bookmaker odds

In his Wisdom Of The Crowd article Joseph Buchdahl describes three different methods to remove the overround (also called ‘margin’ in the UK or ‘vig’ in the US) from bookmaker odds.

In many papers the logarithmic function is considered most accurate.

You can download a python script here oddsmath.py

Usage:

print(get_no_vig_odds(odds1=1.5, odds0=None, odds2=2.3))

Output: 1.606 - 2.648
print(get_no_vig_odds(odds1=1.33, odds0=3.5, odds2=6.0))

Output: 1.438 - 4.934 - 9.805

 

 

The Real Kelly – a #python implementation for independent concurrent outcomes

This is the accompanying article to my previous post covering a python implementation of The Real Kelly Criterion for independent concurrent outcomes.

In detail the algorithm will find optimal bet sizes for a set of concurrent singles and/or ’round robin’ combinations of parlays or teasers.

I recommend reading carefully through @Pinnacle ‘s article covering the basic concept of the generalised Kelly The Real Kelly

The code is available for download on my github repository real_kelly-independent_concurrent_outcomes-

USAGE

(1) Selections need to be passed in as a list of dictionaries called ‘selections’. The template near the bottom is there to be modified.

Screenshot 2020-03-19 at 18.39.10

(2) Pass in the bankroll as a parameter of the function call at the very bottom.

Screenshot 2020-03-19 at 18.40.07

(3) Pass in the maximum number of teams you wish to have in the multiples as ‘max_multiple’.

Screenshot 2020-03-19 at 18.40.07

Say you have 5 selections, but don’t want to include any trebles, 4-folds, 5-folds. ‘max_multiple=2’ will then calculate optimal bet sizes only for singles & doubles.

If you only want to have singles pass in ‘max_multiple=1’.

If you pass in ‘max_multiple=5’ the algorithm will find all possible combinations (singles, doubles, trebles, 4-folds and the 5-fold) and the according optimal stakes sizes.

Obviously ‘max_multiple’ must not be greater than the number of selections.

The code works out of the box, but runtime is an issue! Since the number of combinations grow quadratically, the runtime explodes with an additional ‘max_multiple’ as variable.

Update: Thanx to @SmoLurks the python code now runs 30x faster!!!

The Real Kelly – a #python implementation for mutually exclusive outcomes

In my recent article The Real Kelly – an #excel implementation for mutually exclusive outcomes I described how to use excel to find optimal bet sizes for a set of mutually exclusive outcomes applying the generalised Kelly Criterion (a.k.a. The Real Kelly).

The basic concept of Real Kelly is discussed here The Real Kelly

In this article I will follow up on the excel implementation and show how to use python in order to derive the same results.

Excel is great if you have an idea and want to quickly test different scenarios. However as your dataset grows you will inevitable reach excel’s limits and/or have runtime issues.

Python is then your preferred choice!

The python implementation is available for download on my github repository real_kelly-mutually_exclusive_outcomes-

The code will work out of the box, but you will still need to know what you are doing!

That is,

(1) Outcomes must be mutually exclusive (= EXACTLY one outcome will happen). The optimization will work for markets like ‘Liverpool To Win The EPL’, but will not work for markets like ‘Liverpool Top-4’.

(2) Probabilities need to add up to 1 (or very close to it).

USAGE

(1) Selections need to be passed in as a list of dictionaries called ‘selections’. The template near the bottom is there to be modified.

Screenshot 2020-03-17 at 22.40.29

(2) Any existing bets you might have need to be passed in as a list of dictionaries called ‘existing_bets’. The template near the bottom is there to be modified.

Screenshot 2020-03-17 at 22.42.15

(3) Also pass in the bankroll as a parameter of the function call at the very bottom.

Screenshot 2020-03-17 at 22.42.21

Thanx to @SmoLurks the python code now runs faster by a factor of 35!!!