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