Published on

Optimizing Bet Sizing in Trading with ML Predictions

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 mi,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.

from scipy.stats import norm
import numpy as np

def probability_bet_size(
    probabilities: np.ndarray,
    sides: np.ndarray
) -> np.ndarray:
    return sides * (2 * norm.cdf(probabilities) - 1)

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)}

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.

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.