## 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

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.

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

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

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.

(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.

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

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