Suppose you've found a trading strategy with a positive expected return. You're ready to try it, but first you have to choose the size of the position. If you commit too much capital, a run of losses can leave little to invest when the next opportunity arrives. The Kelly criterion connects that sizing decision to how your wealth grows over many trades. Applying it means estimating the returns and risks that its calculation needs, and those estimates can be wrong.
The sizing simulation tests how estimation error affects wealth. Half the estimated exposure gives median wealth of 1.73 times the starting amount, against 1.48 times for full estimated Kelly. We implement the binary bet, reproduce the sizing comparison and use the GARCH tutorial to vary an allocation over time.
Returns are estimated from five years of data. The simulation then covers ten years at Sharpe ratio 0.5.
For a binary wager with win probability , loss probability and net odds , the formula is:
The Kelly criterion calculator gives the fraction directly. The code below examines the assumptions behind it and the consequences of errors in its inputs.
Quick Win
Consider an even-money wager with a 55% win probability. A win increases the amount staked by its own value; a loss removes the stake. The Kelly fraction is 10% of current wealth. A new wager uses the updated wealth, so the monetary stake grows or shrinks with the bankroll.
import numpy as np
import matplotlib.pyplot as plt
p, b = 0.55, 1.0
kelly = p - (1 - p) / b
fractions = np.linspace(0, 0.45, 301)
growth = p * np.log1p(b * fractions) + (1 - p) * np.log1p(-fractions)
print(f"Kelly fraction: {kelly:.1%}")
print(f"Growth at double Kelly: {p*np.log1p(2*b*kelly)+(1-p)*np.log1p(-2*kelly):.7f}")
plt.plot(fractions, growth)
plt.axvline(kelly, label="Kelly")
plt.axvline(2 * kelly, linestyle="--", label="Double Kelly")
plt.axhline(0, color="grey", linewidth=0.8)
plt.xlabel("Bet fraction")
plt.ylabel("Expected log growth per bet")
plt.legend()
plt.show()

The left panel shows the code's binary objective. At double Kelly the expected log growth is −0.0001377 per bet, already slightly negative. The right panel shows the continuous asset model, where the quadratic approximation has exactly zero excess log growth at twice the optimum. These are different models, so the zero-growth claim needs that distinction.
The log objective measures compounded growth. An arithmetic expected gain rewards exposure linearly and can favour a stake that repeatedly produces ruin. The logarithm assigns an increasingly large penalty as wealth approaches zero. That penalty appears directly in log1p(-fractions) as the losing outcome's wealth multiplier tends to zero.
Binary Growth
Suppose current wealth is and a fraction is staked. Wealth after a win is ; after a loss it is . Taking logs and subtracting the current log wealth leaves a quantity independent of :

Differentiating gives:
The second derivative is negative within the admissible domain. The stationary point is consequently the unique interior maximum. If the available position range excludes it, the constrained solution sits at a boundary. A long-only wager with a negative unconstrained fraction chooses zero stake.
Probability and odds play different roles. The probability describes the outcome distribution, while the odds describe the payoff. Decimal odds include return of the original stake, so decimal odds of two correspond to net odds of one. Confusing those conventions changes the optimal fraction.
The derivation assumes repeatable outcome probabilities and a sufficiently long sequence of opportunities. It also assumes the stake can be resized continuously and that the reported payoffs account for costs. Correlated wagers require their joint outcome distribution; calculating an independent fraction for every wager can produce a combined allocation with excessive risk.
Continuous Asset Exposure
For a risky asset with arithmetic drift , volatility and a cash rate , a continuously rebalanced fraction gives expected log growth:
The drift and variance must use the same time unit. Annual drift divided by daily variance multiplies exposure by roughly the number of trading days in a year. The notebook consistently annualises the simulation and uses a daily premium when applying daily GARCH variances.
For the simulation, the excess arithmetic drift is 10% a year and volatility is 20%, giving a Sharpe ratio of 0.5 and true Kelly exposure of 2.5 times wealth. This is leveraged exposure under a geometric Brownian motion model. It is separate from the binary stake fraction, whose admissible long-only range stops below one to avoid losing everything on a single loss.
Completing the square makes the cost of sizing error visible:
The continuous model penalises equal distances above and below the optimum equally. The binary growth curve is asymmetric near its boundaries, particularly near total loss. Calling every Kelly growth curve asymmetric would therefore conflate these cases.
Fractional Kelly multiplies the estimated optimum by a constant. Under known continuous-model inputs, half Kelly retains 75% of the optimum's excess log growth while halving exposure. Quarter Kelly retains 43.75%. These fractions follow by substituting into the quadratic, giving a growth ratio of .
That arithmetic explains the cost of taking less exposure when the inputs are known. The next experiment tests a separate question, where the optimum itself is uncertain because the mean return is estimated.
Wealth and Drawdown
We simulate 10,000 paths of 2,500 daily observations, with the known drift and volatility above. Wealth follows the continuously rebalanced diffusion exactly at the daily observation times. The median and the 10th to 90th percentile band are computed independently at each date.

The bands describe variation across paths, rather than the possible range for every individual path. A single path can cross different quantile bands over time. Doubling the true optimum gives zero expected excess log growth in this model, alongside large dispersion.
Maximum drawdown measures the largest peak-to-trough proportional loss. The initial wealth of one is included as a possible peak, so a path that falls immediately still records a drawdown. Daily observations miss any larger intraday decline between those observation times.

The full-growth optimum does not constrain drawdown. An investor with a maximum tolerable loss needs an additional constraint or a different utility function. The drawdown calculator helps inspect that distinction for a supplied equity curve.
Our simulation assumes Gaussian diffusion increments and continuous rebalancing. It has no jumps, execution delays or liquidation threshold. A leveraged real position can fail because of those features even when its modelled long-run growth is positive.
Estimated Inputs
For independent diffusion observations over years, the sample arithmetic drift has standard deviation . With five years and 20% volatility, that uncertainty is about 8.94 percentage points a year, close to the assumed true drift of 10%. Estimating variance more precisely cannot remove that uncertainty in the numerator.
The simulation draws 10,000 mean estimates from this sampling distribution. It converts each estimate into a Kelly exposure, clips that estimate to the range zero to ten, and then evaluates a separate ten-year future. Every fractional strategy uses the same estimated mean and future shock for a trial, so comparisons use paired randomness.
rng = np.random.default_rng(109)
mu, sigma = 0.10, 0.20
mu_hat = mu + sigma / np.sqrt(5) * rng.normal(size=10_000)
f_hat = np.clip(mu_hat / sigma**2, 0, 10)
future_z = rng.normal(size=10_000)
for alpha in [0.25, 0.5, 1.0, 2.0]:
f = alpha * f_hat
log_wealth = (f*mu - 0.5*f*f*sigma**2)*10 + f*sigma*np.sqrt(10)*future_z
print(alpha, np.exp(np.median(log_wealth)))
| Fraction of estimated Kelly | Median terminal wealth | Mean terminal log wealth |
|---|---|---|
| Quarter | 1.458 | 0.529 |
| Half | 1.732 | 0.782 |
| Full | 1.484 | 0.467 |
| Double | 0.993 | −3.460 |

Half Kelly wins this specified comparison, but the result does not establish one universally optimal fraction. The clipping rule, estimation window, true Sharpe ratio and horizon all affect the answer. Fractional scaling can still allow high leverage: doubling a clipped exposure of ten permits exposure of twenty in this experiment.
A Bayesian alternative would integrate over uncertainty in the return distribution before choosing the stake. That changes the optimisation problem itself, rather than multiplying a point estimate afterwards. Maximum likelihood estimation provides the corresponding point-estimation background, and the notebook exercises vary the amount of information available about the mean.
GARCH Allocation
The GARCH post saves forecasts made from rolling windows. At each origin, the forecast uses past returns and predicts the next day's variance. Here we apply it to the subsequent observed price return, preserving that timing distinction. Using the variance fitted to the same realised return would give an allocation information unavailable when the position was set.
We assume a constant annual premium of 5%. This assumption is an input to the allocation and is not estimated or forecast by GARCH. The daily exposure rule is:
The forecast file expresses variance in squared percentage returns. Dividing by 10,000 converts it to squared decimal-return units. Omitting that conversion would reduce the allocation by four orders of magnitude.
The constant benchmark uses variance from the 1,260 returns available at the first forecast origin. That gives fixed exposure of 1.226 times wealth. Both strategies pay five basis points per unit of exposure turnover, including the initial entry, and 2% annual financing on exposure above one. Unallocated cash earns zero in this illustration.

| Allocation | Annualised growth | Maximum drawdown | Mean exposure |
|---|---|---|---|
| Constant | 10.11% | 65.48% | 1.226 |
| GARCH-scaled | 12.94% | 52.50% | 1.708 |
These numbers describe S&P 500 price-index returns over the saved forecast origins, beginning in January 2005. They exclude dividends and use simplified financing. The dynamic strategy also holds substantially more average exposure than the benchmark. Its higher return therefore cannot isolate the benefit of volatility timing.
An exposure-matched comparison, multiple market periods and a sensitivity analysis of costs would strengthen that test. The result here establishes the mechanics of using a variance forecast in an allocation, and records the outcomes under the stated assumptions. It does not supply an expected-return signal.
Volatility targeting follows from a different assumption. If expected excess return is proportional to volatility, corresponding to a constant Sharpe ratio , then Kelly exposure becomes . A constant expected premium instead gives the inverse-variance allocation used above. Both resize positions with risk, but they encode different return assumptions.
Foundations
Kelly's 1956 paper, “A New Interpretation of Information Rate”, connects a gambler's information about outcomes with the exponential growth rate of capital. The paper defines growth through the long-run log ratio of final and initial wealth. That quantity leads directly to our binary objective when repeated outcomes have fixed probabilities.
The distinction between expected wealth and expected log wealth is essential to that formulation. Repeatedly staking everything can maximise an arithmetic expectation while producing eventual bankruptcy. Kelly's objective instead selects a fraction whose realised long-run growth reflects the outcome frequencies.
Kelly names the quantity:
“the exponential rate of growth”
The paper's definition takes a limit over repeated bets. The finite-horizon simulations here examine how widely outcomes can spread before such a limiting argument applies.
The original notation uses logarithms to base two, appropriate to its information-theory setting. Our implementation uses natural logarithms. Multiplying an objective by a positive constant changes its numerical scale without changing the maximising fraction. This lets the same stake rule appear in both conventions.
For the diffusion model, the wealth equation under fixed exposure gives a second-order variance penalty when taking its logarithm. Differentiating the resulting quadratic produces the inverse-variance rule. The model's assumptions are stronger than the binary accounting identity: continuous rebalancing, a diffusion return process and a specified financing rate determine the expression.
Breiman's “Optimal Gambling Systems for Favorable Games” studies long-run properties of growth-optimal systems. Those asymptotic comparisons do not ensure that the selected strategy wins over a finite investment horizon. A finite sequence can contain large losses even when the model's growth criterion is optimal.
Thorp's discussion of the Kelly criterion connects the sizing rule with gambling and securities. The operational issue remains the quality of the edge estimate. Costs, limits and uncertain probabilities belong inside the decision problem, since a calculated optimum inherits every error in its inputs.
Our paired Monte Carlo experiment makes one such input error measurable. It gives each strategy a noisy estimate of the same true drift and exposes them to the same future shock. The outcome supports fractional scaling in that regime, while the exact growth derivation explains why scaling known inputs sacrifices some optimum growth.
Portfolio Kelly also requires cross-asset dependence. In a multivariate diffusion, the unconstrained allocation uses the inverse covariance matrix applied to expected excess returns. Correlated assets cannot each receive their standalone Kelly fraction without considering the combined variance. Modern portfolio theory develops the covariance geometry needed for that extension.
We can recover the repeated-wager argument directly from the accounting. If a sequence of n bets contains w wins, terminal wealth is initial wealth multiplied by (1 + b*f)**w * (1 - f)**(n - w). Taking its logarithm turns multiplication into addition. Dividing by n leaves the win frequency multiplying the winning log return and the loss frequency multiplying the losing log return. Independent repetitions with a fixed win probability let those frequencies approach the probabilities in our objective.
The fraction must keep both wealth factors positive. For a long-only binary wager, that requires a fraction below one; a fraction of one makes the first loss terminal. With a non-positive edge, the unconstrained stationary point can be negative, and a restriction to long-only wagers selects zero. These domain restrictions are part of the optimisation problem. A formula copied without its admissible domain can prescribe a position that the original wager cannot support.
The continuous model gives a compact way to quantify estimation sensitivity. Let an exposure differ from the true optimum by delta. Completing the square in the growth quadratic gives:
Exposure errors in either direction incur this model's quadratic growth loss. An unbiased estimate of the optimum can therefore lose expected log growth through its variance alone. Scaling it down introduces a deliberate bias but can reduce the overall squared exposure error. That calculation explains the mechanism tested by the paired simulations. It does not make half Kelly the optimum under every estimation distribution.
For the GARCH allocation, forecast timing adds another condition. The variance supplied at an origin must be available before the return it sizes. Using a variance fitted with that future return would change the information set and contaminate the comparison. The notebook shifts each origin's exposure to the next observed daily return and keeps the separately assumed premium visible throughout.
Interactive Tools
- Kelly Criterion Calculator: Evaluate the binary fraction and fractional stakes from supplied probabilities and odds.
- Drawdown Calculator: Compare growth objectives with the peak-to-trough losses they can permit.
Related Posts
- GARCH Model in Python: Generate the rolling variance forecasts reused here.
- Modern Portfolio Theory: Add covariance when allocating across multiple assets.
- Cointegration and Pairs Trading: Separate a trading signal from its position-sizing rule.
- Maximum Likelihood Estimation: Examine the uncertainty in estimated model inputs.




