Bet Sizing in ML


“There are fascinating parallels between strategy games and investing. Some of the best portfolio managers I have worked with are excellent poker players, perhaps more so than chess players. One reason is bet sizing, for which Texas Hold’em provides a great analogue and training ground. Your ML algorithm can achieve high accuracy, but if you do not size your bets properly, your investment strategy will inevitably lose money. In this chapter we will review a few approaches to size bets from ML predictions.” Advances in Financial Machine Learning, Chapter 10: Bet Sizing, pg 141.

The code in this directory falls under 3 submodules:

  1. Bet Sizing: We have extended the code from the book in an easy to use format for practitioners to use going forward.

  2. EF3M: An implementation of the EF3M algorithm.

  3. Chapter10_Snippets: Documented and adjusted snippets from the book for users to experiment with.

../_images/bet_sizing.png

Note

Underlying Literature

The following sources describe this method in more detail:


Bet Sizing Methods

Functions for bet sizing are implemented based on the approaches described in chapter 10.

Bet Sizing From Predicted Probability

Assuming a machine learning algorithm has predicted a series of investment positions, one can use the probabilities of each of these predictions to derive the size of that specific bet.

Code implementation demo

Dynamic Bet Sizes

Assuming one has a series of forecasted prices for a given investment product, that forecast and the current market price and position can be used to dynamically calculate the bet size.

Code implementation demo

Strategy-Independent Bet Sizing Approaches

These approaches consider the number of concurrent active bets and their sides, and sets the bet size is such a way that reserves some cash for the possibility that the trading signal strengthens before it weakens.

Code implementation demo
Code implementation demo

Additional Utility Functions For Bet Sizing

Code implementation demo
Code implementation demo
Code implementation demo

Chapter 10 Code Snippets

Chapter 10 of Advances in Financial Machine Learning contains a number of Python code snippets, many of which are used to create the top level bet sizing functions. These functions can be found in mlfinlab.bet_sizing.ch10_snippets.py.

Snippets For Bet Sizing From Probabilities

Code implementation demo
Code implementation demo
Code implementation demo

Snippets for Dynamic Bet Sizing

Code implementation demo
Code implementation demo
Code implementation demo
Code implementation demo
Code implementation demo
Code implementation demo

Research Notebook

The following research notebooks can be used to better understand bet sizing.

Notebook demo
Notebook demo

Presentation Slides

../_images/lecture51.png

Note

  • pg 1-9: Bet Sizing