$npx -y skills add agiprolabs/claude-trading-skills --skill kelly-criterionKelly criterion optimal sizing with fractional variants, edge estimation, and practical application for crypto trading
| 1 | # Kelly Criterion — Optimal Bet Sizing |
| 2 | |
| 3 | The Kelly criterion is the mathematically optimal bet size that maximizes long-term geometric growth of capital. Developed by John Kelly at Bell Labs in 1956, it answers a precise question: given a known edge, what fraction of your bankroll should you risk to maximize the compounding rate? |
| 4 | |
| 5 | **Core insight**: Betting too small leaves growth on the table. Betting too large increases ruin risk and actually *reduces* long-term growth. Kelly finds the exact optimum between these extremes. |
| 6 | |
| 7 | **Practical insight**: You should almost never use full Kelly. Estimation error in your edge means full Kelly will overbets in practice. Use fractional Kelly (0.25x to 0.5x) for real trading. |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | ## The Kelly Formula |
| 12 | |
| 13 | For a binary outcome (win or lose): |
| 14 | |
| 15 | ``` |
| 16 | f* = (p * b - q) / b |
| 17 | ``` |
| 18 | |
| 19 | Where: |
| 20 | - `f*` = optimal fraction of bankroll to bet |
| 21 | - `p` = probability of winning |
| 22 | - `q` = probability of losing (1 - p) |
| 23 | - `b` = payoff ratio (average win / average loss) |
| 24 | |
| 25 | **Equivalent forms**: |
| 26 | |
| 27 | ``` |
| 28 | f* = p - q / b |
| 29 | f* = p - (1 - p) / b |
| 30 | f* = (p * b - (1 - p)) / b |
| 31 | ``` |
| 32 | |
| 33 | **Edge** = `p * b - q` = expected value per unit risked. Kelly only makes sense when edge > 0. If edge is zero or negative, the optimal bet is zero — do not trade. |
| 34 | |
| 35 | ### Quick Reference |
| 36 | |
| 37 | | Win Rate | Payoff 1:1 | Payoff 1.5:1 | Payoff 2:1 | Payoff 3:1 | |
| 38 | |----------|-----------|-------------|-----------|-----------| |
| 39 | | 40% | -20% | -6.7% | 10% | 20% | |
| 40 | | 45% | -10% | 3.3% | 15% | 25% | |
| 41 | | 50% | 0% | 16.7% | 25% | 33.3% | |
| 42 | | 55% | 10% | 18.3% | 27.5% | 35% | |
| 43 | | 60% | 20% | 26.7% | 35% | 40% | |
| 44 | |
| 45 | *Values are full Kelly fraction. In practice, use 0.25x to 0.5x of these numbers.* |
| 46 | |
| 47 | --- |
| 48 | |
| 49 | ## Why Use Fractional Kelly |
| 50 | |
| 51 | Full Kelly assumes you know `p` and `b` exactly. You never do. Here is why fractional Kelly is essential: |
| 52 | |
| 53 | ### 1. Estimation Error |
| 54 | |
| 55 | Your win rate estimate from 100 trades has a standard error of roughly ±5%. If your true win rate is 55% but you estimate 60%, full Kelly will overbets by ~50%, which *reduces* long-term growth below what half Kelly would achieve. |
| 56 | |
| 57 | ### 2. Variance and Drawdowns |
| 58 | |
| 59 | Full Kelly has extremely high variance. Expected maximum drawdown for full Kelly is roughly 50-80% of account. This is psychologically devastating and practically dangerous (margin calls, inability to continue trading). |
| 60 | |
| 61 | | Kelly Fraction | Relative Growth Rate | Approximate Max Drawdown | |
| 62 | |---------------|---------------------|-------------------------| |
| 63 | | 1.0x (full) | 100% | 50-80% | |
| 64 | | 0.5x (half) | ~75% | 25-40% | |
| 65 | | 0.25x (quarter)| ~50% | 12-20% | |
| 66 | | 0.1x (tenth) | ~25% | 5-10% | |
| 67 | |
| 68 | ### 3. Asymmetry of Over vs. Under Betting |
| 69 | |
| 70 | Overbetting by 2x (betting at 2*f*) produces **zero** long-term growth — the same as not trading at all. Underbetting by 2x (betting at 0.5*f*) still captures ~75% of the optimal growth rate. The penalty for overbetting is catastrophically worse than for underbetting. |
| 71 | |
| 72 | ### Recommended Fractions |
| 73 | |
| 74 | | Fraction | When to Use | |
| 75 | |----------|------------| |
| 76 | | 0.10x Kelly | Very uncertain edge, new strategy, < 30 trades in sample | |
| 77 | | 0.25x Kelly | Moderate confidence, 30-100 trades, reasonable Sharpe | |
| 78 | | 0.50x Kelly | High confidence, 100+ trades, consistent performance | |
| 79 | | 1.00x Kelly | Never recommended in practice | |
| 80 | |
| 81 | --- |
| 82 | |
| 83 | ## Estimating Your Edge |
| 84 | |
| 85 | Kelly requires two inputs: win rate (`p`) and payoff ratio (`b`). Both must be estimated from data. |
| 86 | |
| 87 | ### Minimum Data Requirements |
| 88 | |
| 89 | - **50 trades minimum** for any Kelly calculation. Below this, estimation error dominates. |
| 90 | - **100+ trades preferred** for half Kelly sizing. |
| 91 | - **200+ trades** before considering aggressive fractions. |
| 92 | |
| 93 | ### Calculation from Trade History |
| 94 | |
| 95 | ```python |
| 96 | wins = [t for t in trades if t > 0] |
| 97 | losses = [t for t in trades if t < 0] |
| 98 | |
| 99 | win_rate = len(wins) / len(trades) # p |
| 100 | payoff_ratio = mean(wins) / abs(mean(losses)) # b |
| 101 | edge = win_rate * payoff_ratio - (1 - win_rate) # should be > 0 |
| 102 | |
| 103 | kelly_full = (win_rate * payoff_ratio - (1 - win_rate)) / payoff_ratio |
| 104 | ``` |
| 105 | |
| 106 | ### Conservative Estimation |
| 107 | |
| 108 | Use the **lower bound of a Wilson confidence interval** for win rate rather than the point estimate: |
| 109 | |
| 110 | ```python |
| 111 | import math |
| 112 | |
| 113 | def wilson_lower(wins: int, total: int, z: float = 1.96) -> float: |
| 114 | """Lower bound of Wilson score interval (95% confidence).""" |
| 115 | p = wins / total |
| 116 | denominator = 1 + z**2 / total |
| 117 | centre = p + z**2 / (2 * total) |
| 118 | spread = z * math.sqrt((p * (1 - p) + z**2 / (4 * total)) / total) |
| 119 | return (centre - spread) / denominator |
| 120 | ``` |
| 121 | |
| 122 | Using the lower bound of the confidence interval for win rate automatically builds in conserva |