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 – an #excel implementation for independent concurrent outcomes

In my previous articles we have already seen how the generalised Kelly Criterion can produce completely different results than the simplified Kelly formula that most bettors will use when there are multiple edges in the same game.

There are, of course, occasions when you might have multiple edges on different games, all taking place at the same time. The example below is one such situation:

This article will explain usage of an excel implementation applying the Real Kelly Criterion to concurrent events.

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 excel template can be downloaded here real_kelly-independent_concurrent_outcomes-

Please note that the worksheet supports singles & parlays up to 6 selections. In my next article I will publish a python implementation using the same algorithm for an unlimited number of selections.

USAGE

  • Make sure to open both GlobalMinimize and the Real Kelly worksheet.
  • Fill out the yellow fields in the ‘selections’ sheet. You can rename ‘Bet 1’, ‘Bet 2’, to whatever you like, e.g. ‘Manchester United +0.5’. ‘MY_ODDS’ is what you consider to be the fair odds. Say you have a total of 4 selections, then you can skip the respective fields in row 6 and 7. Those selections will be ignored.

Screenshot 2020-03-22 at 21.33.45

  • Switch over to the corresponding acca sheet. If you have 4 selections then select acca-4.

Screenshot 2020-03-22 at 21.21.06

  • Fill out the yellow fields with all combinations you want to have bets for (1…include selection / 0…exclude selection). The template is pre-populated with all singles and doubles. Say you also want to have the 4-fold included then add an additional row 1-1-1-1 and drag-fill columns E to L. You can cherry-pick ANY combination you like to have included from a possible 2^N-1 combinations.
  • Set all stakes to 0.
  • Press CTRL+M to open GlobalMinimize settings.
  • Adjust the stake range/constraints according to your needs.
  • Select Differential-Evolution (DE) followed by Nelder-Mean (NM) and hit ‘Minimize’.

Differential-Evolution (DE) followed by Nelder-Mean (NM) should be your default option, as it increases the likehood of finding the global maximum, and NM ‘polishes off’ the optimum with a high degree of accuracy.

Depending on the field size the algorithm can now take several minutes until excel populates the optimal set in the stakes column.

Have fun!

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

 

The Real Kelly – an #excel implementation for mutually exclusive outcomes

Twitter user @optibrebs recently made me aware of the generalised Kelly Criterion (a.k.a. The Real Kelly) discussed in this @Pinnacle article The Real Kelly

To be honest I have been successfully using the simple/naïve Kelly Criterion for years and haven’t bothered looking anywhere else.

This is how the simplified Kelly looks

s = b * (o / f – 1) / (o – 1)

where

s…Kelly Stake
b…Bankroll
o…Odds offered
f…Odds fair

The simplified Kelly Criterion has some potential flaws and can give some head-scratching results which are explained in the article above.

I therefore recommend using the more sophisticated generalised Kelly Criterion wherever possible as it is superior to the simplified Kelly Criterion. The Real KC is very useful for outright betting as shown below.

In this article I will explain how to use the real KC in order to find optimal bet sizes for a set of futures bets on several different teams to win the same division or championship. However please note that the algorithm can be applied to ANY market with mutually exclusive outcomes (e.g. it could also be applied to a 3-way betting market as explained in example #1 in the @Pinnacle article).

Let’s dive in.

The excel template can be downloaded here real_kelly-mutually_exclusive_outcomes-

Please note

(1) Outcomes must be mutually exclusive (= EXACTLY one outcome will happen). The algorithm 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).

(3) You can adapt the number of outcomes to your needs, but be aware to also update the variable cells within the solver.

(4) You can use excel’s built-in solver using method ‘GRG Nonlinear’, but be advised that it might not give you the best set of results. I recommend using the GlobalMinimize macro instead which can be downloaded here GlobalMinimize Excel Macro.
The algorithm will very likely find a global maximum (instead of just a local maximum) for the objective and will yield the optimal solution.

The drawback is that GlobalMinimize is limited to 30 variable cells. Excel’s solver has a limit of 250 variable cells.

INSTRUCTIONS

  • Make sure to open both GlobalMinimize and the Real Kelly worksheet.
  • Fill out the fields in the yellow columns (‘BET’, ‘BOOK_ODDS’, ‘MY_ODDS’) as shown below. ‘MY_ODDS’ is what you consider to be the fair odds.

Screenshot 2020-03-21 at 15.27.27

  • Set all stakes to 0.
  • Enter your bankroll in the yellow cell ‘START BANKROLL’
  • If you have any existing bets on this tournament enter those in columns (O, P, Q). Note that any strings in column O must exactly match those in column A.
  • Press CTRL+M to open GlobalMinimize settings.
  • Adjust the stake range/constraints according to your needs.
  • Select Differential-Evolution (DE) followed by Nelder-Mean (NM) and hit ‘Minimize’.

Differential-Evolution (DE) followed by Nelder-Mean (NM) should be your default option, as it increases the likehood of finding the global maximum, and NM ‘polishes off’ the optimum with a high degree of accuracy.

Depending on the field size the algorithm can now take several minutes until excel populates the optimal set in the stakes column.

What I like about this application is that you could potentially use it from week to week as the season progresses. The algorithm will find optimal bets and/or (partial) hedges whenever the sheet is updated with new prices.

Have fun!