Position Sizing with the Kelly Criterion: A Developer's Guide
The Kelly criterion gives a mathematically optimal bet size, but applied naively to trading it will ruin you. Here's the intuition, the formula, and why almost everyone uses a fraction of it.
Most retail traders blow up not because their signal was wrong but because they bet too much on it. Position sizing is the part of trading that quietly decides whether a decent edge compounds or detonates, and the Kelly criterion is the cleanest formal answer to “how much should I bet?” It’s also routinely misapplied. This is the developer’s-eye view: the intuition, the formula, and the reason nobody sane uses it at full strength. None of this is investment advice.
What Kelly is actually optimizing
The Kelly criterion answers a specific question: given a bet with a known edge, what fraction of your capital should you wager to maximize the long-run growth rate of that capital? Crucially, it maximizes geometric growth, not expected value. That distinction is the whole point.
You could maximize expected value by betting everything on any positive-edge bet. Do that repeatedly and a single loss wipes you out — and over many bets, ruin becomes near-certain. Kelly instead maximizes the compound growth rate, which inherently penalizes the risk of catastrophic drawdown. It finds the bet size that grows your bankroll fastest without betting so much that variance eats the compounding.
The formula
For a simple bet with a probability p of winning, a probability q = 1 - p of losing, and odds b (you win b times your stake on a win, lose your stake on a loss), the optimal fraction of capital to bet is:
f* = (b * p - q) / b
A few sanity checks make the formula intuitive. If your edge is zero (the bet is fair), f* comes out to zero — Kelly tells you not to bet. As your edge grows, f* grows. If the expected value is negative, f* goes negative, meaning the only “optimal” move is to take the other side or not play.
For trading, where outcomes aren’t a single binary payoff, there’s a continuous version expressed in terms of expected return and variance: roughly, the optimal fraction is your expected excess return divided by the variance of returns. The shape is the same — more edge means more size, more uncertainty means less.
Why full Kelly will hurt you
Here’s the part the formula won’t tell you: full Kelly is brutally volatile, and in real trading it’s usually wrong because its inputs are wrong.
Kelly assumes you know your edge and odds. In trading you don’t — you estimate them from noisy historical data, and those estimates are biased upward by the same overfitting and survivorship issues that plague backtests. Plug an overestimated edge into Kelly and it tells you to bet far too much. The formula is only as trustworthy as your probability estimate, and your probability estimate is a guess wearing a number’s clothing.
Even with perfect inputs, full Kelly produces drawdowns most people can’t psychologically or financially tolerate — routine 50%+ peak-to-trough swings. That’s why the standard practice is fractional Kelly: bet some fraction (commonly half or a quarter) of the Kelly amount. Half-Kelly captures roughly three-quarters of the growth rate with dramatically lower volatility, and it builds in a margin for the fact that your edge estimate is probably too optimistic.
Using it without getting hurt
If you’re building position sizing into a strategy, the responsible pattern is: estimate your edge conservatively, compute the Kelly fraction, then scale it down by a safety factor (half or quarter), and cap any single position regardless of what the formula says. Recompute as your edge estimate updates, and never let the math override basic risk limits like maximum portfolio concentration.
Kelly is best understood as a discipline, not a dial. It forces you to be explicit about your edge and your odds, and the moment you do that honestly, you usually realize your edge is smaller and noisier than you’d assumed — which is exactly the realization that keeps you solvent.
FAQ
Should I ever bet full Kelly?
How do I estimate the inputs for trading?
Does Kelly work for a portfolio of positions?
The Kelly criterion is one of the few pieces of trading math that’s both elegant and genuinely useful. Just remember what it optimizes, and that its honest answer to “how much should I bet?” is almost always “less than you think, and less than the formula says.”
Related reading
2026-06-22
Position Sizing and Risk per Trade: The Math Retail Investors Skip in 2026
How to size a trade from risk instead of conviction: the fixed-fractional formula, fractional Kelly, R-multiples, and the drawdown math that decides whether a losing streak is survivable.
2026-06-22
Dollar-Cost Averaging vs Lump Sum: What the Math Really Says
A measured look at why lump-sum investing usually beats dollar-cost averaging on expected return, when DCA still makes sense, and how to decide for your own cash.
2026-06-22
What the Sharpe Ratio Actually Tells You (and Where It Misleads)
The Sharpe ratio measures excess return per unit of volatility. Here is exactly what the number captures, the four assumptions that break it, and when to trust it.
2026-06-22
Tiingo vs Polygon.io: Market Data APIs for Indie Quant Projects in 2026
A practical comparison of Tiingo and Polygon.io for solo quant builders in 2026 — pricing, rate limits, data coverage, and which one fits a weekend backtester.
2026-06-22
Building a Portfolio Rebalancing Script in Python: From Drift to Trades
A practical walkthrough of writing a Python rebalancing script: measuring allocation drift, generating a self-funding trade list, and using threshold bands to avoid over-trading.
Get the best tools, weekly
One email every Friday. No spam, unsubscribe anytime.