Published on

Optimizing Bet Sizing in Trading with ML Predictions

Authors
Table of Contents

In trading, bet sizing plays a crucial role. Inconsistent or improperly sized bets can lead to losses even when predictions are accurate. This blog discusses various strategies to optimize bet sizes.

Bet Size: Denoted as m_i,tm\_{i, t}, it's the amount of money put into a trade by a strategy ii at time tt. Values range from -1 to 1, with -1 and 1 indicating a full short and long position, respectively.

Market Price: Denoted as ptp_t, it's the price of the instrument at time tt.

Strategy Overview

Consider two strategies that predict the price of a financial instrument to increase. One strategy gains money, while the other loses, depending on the bet size allocated during the trading sequence.

Methods for Optimizing Bet Sizing

Method 1: Bet Concurrency

This approach computes a series ctc_t derived from the number of concurrent long and short bets at any given time. The bet size mtm_t is then calculated as:

mt={F[ct]F[0]1F[0] if ct0F[ct]F[0]F[0] if ct<0m_{t}= \begin{cases} \frac{F[c_{t}]-F[0]}{1-F[0]} & \text { if } c_{t} \geq 0 \\ \frac{F[c_{t}]-F[0]}{F[0]} & \text { if } c_{t}<0 \end{cases}

Here, F[x]F[x] represents the CDF of a fitted mixture of two Gaussians for a given value xx.

PythonJulia
def calculate_bet_size(F, c_t: float) -> float:
function calculate_bet_size(F, c_t::Float64)::Float64

View More: Python | Julia

Method 2: Budgeting Approach

Another way is to size the bet based on the maximum number of concurrent long and short bets. The formula used is:

mt=ct,l1maxi(ci,l)ct,s1maxi(ci,s)m_{t}=c_{t, l} \frac{1}{\max _{i}\left(c_{i, l}\right)}-c_{t, s} \frac{1}{\max _{i}\left(c_{i, s}\right)}
PythonJulia
def budget_bet_size(c_t_l: float, c_t_s: float, max_c_l: float, max_c_s: float) -> float:
function budget_bet_size(c_t_l::Float64, c_t_s::Float64, max_c_l::Float64, max_c_s::Float64)::Float64

View More: Python | Julia

Method 3: Meta-Labeling

This employs classifiers like SVC or RF to determine the probability of misclassification and uses that to size the bet. This is especially useful in avoiding false positives.

PythonJulia
def meta_labeling_bet_size(probability: float) -> float:
function meta_labeling_bet_size(probability::Float64)::Float64

View More: Python | Julia

References

  1. De Prado, M. L. (2018). Advances in financial machine learning. John Wiley & Sons.
  2. De Prado, M. M. L. (2020). Machine learning for asset managers. Cambridge University Press.