Trade Sizing I of IV

Kelly sizing and maximizing long-term capital growth

“What would you do if you were invited to play a game where you were given $25 and allowed to place bets for 30 minutes on a coin that you were told was biased to come up heads 60% of the time?”

Edge is not enough

Investing and strategic games of chance have much in common. Both require using statistics to model outcomes and act accordingly, and, both require intelligent bet sizing.

It’s not a coincidence that trading firms are full of poker players — the overlap is substantial. In gambling, because the odds are known and fixed, choosing not only when to bet, but also, how much, is critical. Trading strategies, particularly quantitative strategies, are equally sensitive to sizing decisions. Your fancy, temporal, convolutional, recursive, ninety-factor algorithm may achieve high win ratios (high accuracy), however if you ignore sizing, you may very likely still lose money.

Imagine that you have engineered a predictive model for an algorithmic trading strategy with a win rate of 60%. The strategy trades 1000 times a day. After each winning trade, you increase the bet size to 20% of your current bankroll. What are the odds of finishing the year bankrupt?

The answer, despite the high amount of edge (+10%) and reasonably small bet sizing, is that the strategy almost always goes bankrupt. Zero in ten thousand simulations end without bankruptcy.

This (and, confusingly, other similar phenomena) is Gambler’s Ruin.

“A gambler who raises his bet to a fixed fraction of bankroll when he wins, but does not reduce it when he loses, will eventually and inevitably go broke, even if he has a positive expected value on each bet.”

Even if the odds of losing are low, eventually a string of losses will wipe you out if you don’t scale your wagers off of your bankroll (capital).

The Kelly Criterion

The discussion to follow, as it pertains to the Kelly Criterion, will use language most familiar to gambling. A decision to deploy capital follows identical logic whether we call it an investment, a bet, or a wager.

Derived over six decades ago, the Kelly Criterion solves the challenge of how a gambler with edge should act to maximize bankroll growth.

Notation

p and q represent probability of win and probability of loss, respectively

Lowercase w and l represent reward for winning a bet and penalty for losing a bet, respectively

Lowercase b is net odds or w/l

Capital W is your total wealth (bankroll)

Lowercase m and t represent number of wins and total number of plays, respectively

Kelly proved that the optimal wager in a repeated game

In literature, this often takes one of the following forms where b is substituted for w/l and/or q is swapped for 1 — p

A simple numerical example where the game is a coin toss but the reward for winning is doubled

0.5 - 0.5/(2/1) = 0.5 - 0.25 = 0.25

Flipping a fair coin where your reward for winning is double what you lose for losing is obviously an attractive game to play; by Kelly, betting 25% of your bankroll per play will maximize the long-term expected value of said game.

Using the Kelly Criterion, we can calculate the ideal wager given any combination of net odds (win to loss ratio) and probability of winning.

The Kelly ratio need not be positive. In unfavorable games, Kelly advises us to pay to not play the game. The negative Kelly value represents how much we should pay to avoid the wager (assuming we can’t just say no).

The Kelly Criterion provides some nice assurances. One, as we only bet a fraction of our total capital per round, we can never go bankrupt (and thus keep playing the game that is, presumably, for edge). The strategy is guaranteed to outperform any other strategy given the Kelly assumptions of known and fixed probabilities as well as infinite number of plays.

Derivation

The derivation is quite straightforward. We’ll simplify our problem to a game with binary outcomes (win or lose) with even-odds (the reward for winning is the same as the penalty for losing).

In our game, we wager fraction f of our wealth at each step. After t steps, with m wins, starting with initial wealth W0 our terminal wealth Wt is

The exponential growth rate, r, of asset is defined as the rate that satisfies

Plugging it back into our previous equation, we can express the growth rate g for our binary game

We can substitute p for m/t and q for (t — m)/t

To maximize the growth rate g, we derive and set to zero

Optimal growth rate is maximized by betting f = p - q (the Kelly ratio) at each step.

Assuming we play at the Kelly fraction, we can plug the Kelly Criterion back into (7) to solve for the long-term capital growth rate of a game

A similar derivation for games of uneven odds can be performed

Betting other amounts

How suboptimal is betting other fractions of wealth? Generally, overbetting is significantly worse than underbetting the Kelly ratio. What’s perhaps most counterintuitive is that significantly overbetting the Kelly ratio will drive our growth rate negative.

Below we plot curves with varying winning probabilities and varying W/L ratios

Overbetting drives our growth rate negative — even in games with positive expected value.

Generally, in games of even-odds, betting at twice the Kelly ratio drives the long-term growth negative.

The original question

“What would you do if you were invited to play a game where you were given $25 and allowed to place bets for 30 minutes on a coin that you were told was biased to come up heads 60% of the time?”

Armed with Kelly, we can posit a guess for the opening question. We should bet p - q or 20% of our bankroll per round. While this isn’t truly optimal, given that we’re violating one of the key Kelly assumptions (the game cannot be played ad infinitum), it isn’t a bad place to start.

See the code snippet at the end of this section for a simulator of the game.

The game, as discussed in “Rational Decision-Making Under Uncertainty: Observed Betting Patterns on a Biased Coin”, by Haghani & Dewey 2016, also contains a hidden winnings cap at $250. In our analysis, our player bets nothing once he hits the cap. Generally, it’s ill-advised to bet money when you cannot win.

Playing the game using the Kelly strategy yields a ~$237 payoff. In the paper, which is a must read, the authors recruited 61 participants, 14 of which were finance professionals from leading asset management firms. The average payout of the humans: only $91. The human players, who, given their backgrounds, should be quite familiar with the Kelly Criterion, underperformed simple Kelly betting by >60%.

The problem, despite being a trivial game (and thus a very simplified proxy for strategic investing), reveals how badly intuition fares when determining optimal risk allocations. Kelly is clearly suboptimal here; the paper details this underperformance extensively, and if anything, is overly generous with respect to human performance on this game. Other algorithms perform stronger, achieving scores much closer to the $250 winnings cap.

from numba import jit import numpy as np @jit def game(F): flips = np.random.binomial(1, .6 , 300) wealth = 25 for flip in flips: bet = F * wealth if wealth < 249.99 else 0 wealth += bet if flip == 1 else -bet wealth = min(wealth, 250) if wealth < 0.01: return wealth return wealth def sim_game(F, N=1e5): return np.mean([game(F) for x in range(int(N))]) sim_game(.2) #237.41

Conclusion

Obviously, making good trades is critical. However, to maximize long-term capital growth, sizing these trades is both surprisingly important and, empirically, challenging. Kelly sizing is no panacea but does provide a reasonable framework to operate within. Armed with a solid understand of Kelly, as it pertains to simple games, the logic can be extended to markets where the outcomes are continuous distributions.