- 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 $m_{i, t}$, it's the amount of money put into a trade by a strategy $i$ at time $t$. Values range from -1 to 1, with -1 and 1 indicating a full short and long position, respectively.

**Market Price**: Denoted as $p_t$, it's the price of the instrument at time $t$.

## 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 $c_t$ derived from the number of concurrent long and short bets at any given time. The bet size $m_t$ is then calculated as:

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

```
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:

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

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