kelly-criterion
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKelly Criterion — Optimal Bet Sizing
凯利准则——最优下注仓位
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?
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.
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.
凯利准则是一种在数学上最优的下注仓位,能够最大化资金的长期几何增长率。该准则由贝尔实验室的John Kelly于1956年提出,它精准回答了一个问题:在已知交易优势的情况下,应该拿出资金账户的多大比例来承担风险,以最大化复利增长率?
核心要点:下注仓位过小会错失增长机会,仓位过大则会增加破产风险,反而降低长期增长率。凯利准则能找到这两个极端之间的精确平衡点。
实践建议:几乎绝不应该使用全额凯利(Full Kelly)。对交易优势的估算误差意味着,实际应用中全额凯利会导致过度下注。在真实交易中应使用分数凯利(Fractional Kelly),即0.25倍至0.5倍的凯利系数。
The Kelly Formula
凯利公式
For a binary outcome (win or lose):
f* = (p * b - q) / bWhere:
- = optimal fraction of bankroll to bet
f* - = probability of winning
p - = probability of losing (1 - p)
q - = payoff ratio (average win / average loss)
b
Equivalent forms:
f* = p - q / b
f* = p - (1 - p) / b
f* = (p * b - (1 - p)) / bEdge = = 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.
p * b - q针对二元结果(盈利或亏损):
f* = (p * b - q) / b其中:
- = 资金账户中用于下注的最优比例
f* - = 盈利概率
p - = 亏损概率(1 - p)
q - = 盈亏比(平均盈利 / 平均亏损)
b
等价形式:
f* = p - q / b
f* = p - (1 - p) / b
f* = (p * b - (1 - p)) / b交易优势(Edge) = = 每单位风险的预期收益。只有当交易优势>0时,凯利准则才有意义。如果交易优势为零或负数,最优下注仓位为零——不应进行交易。
p * b - qQuick Reference
快速参考表
| Win Rate | Payoff 1:1 | Payoff 1.5:1 | Payoff 2:1 | Payoff 3:1 |
|---|---|---|---|---|
| 40% | -20% | -6.7% | 10% | 20% |
| 45% | -10% | 3.3% | 15% | 25% |
| 50% | 0% | 16.7% | 25% | 33.3% |
| 55% | 10% | 18.3% | 27.5% | 35% |
| 60% | 20% | 26.7% | 35% | 40% |
Values are full Kelly fraction. In practice, use 0.25x to 0.5x of these numbers.
| 胜率 | 1:1盈亏比 | 1.5:1盈亏比 | 2:1盈亏比 | 3:1盈亏比 |
|---|---|---|---|---|
| 40% | -20% | -6.7% | 10% | 20% |
| 45% | -10% | 3.3% | 15% | 25% |
| 50% | 0% | 16.7% | 25% | 33.3% |
| 55% | 10% | 18.3% | 27.5% | 35% |
| 60% | 20% | 26.7% | 35% | 40% |
以上数值为全额凯利比例。实际应用中,应使用这些数值的0.25倍至0.5倍。
Why Use Fractional Kelly
为何使用分数凯利
Full Kelly assumes you know and exactly. You never do. Here is why fractional Kelly is essential:
pb全额凯利假设你完全准确地知道和,但现实中你永远做不到。以下是分数凯利必不可少的原因:
pb1. Estimation Error
1. 估算误差
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.
基于100笔交易得出的胜率估算值,标准误差约为±5%。如果你的真实胜率是55%,但估算值为60%,全额凯利会导致过度下注约50%,这会使长期增长率低于半额凯利(0.5倍)所能达到的水平。
2. Variance and Drawdowns
2. 方差与回撤
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).
| Kelly Fraction | Relative Growth Rate | Approximate Max Drawdown |
|---|---|---|
| 1.0x (full) | 100% | 50-80% |
| 0.5x (half) | ~75% | 25-40% |
| 0.25x (quarter) | ~50% | 12-20% |
| 0.1x (tenth) | ~25% | 5-10% |
全额凯利的方差极高。全额凯利的预期最大回撤约为账户资金的50-80%。这在心理上极具毁灭性,且在实践中十分危险(如追加保证金通知、无法继续交易)。
| 凯利系数倍数 | 相对增长率 | 近似最大回撤 |
|---|---|---|
| 1.0x(全额) | 100% | 50-80% |
| 0.5x(半额) | ~75% | 25-40% |
| 0.25x(四分之一额) | ~50% | 12-20% |
| 0.1x(十分之一额) | ~25% | 5-10% |
3. Asymmetry of Over vs. Under Betting
3. 过度下注与下注不足的不对称性
Overbetting by 2x (betting at 2f) produces zero long-term growth — the same as not trading at all. Underbetting by 2x (betting at 0.5f) still captures ~75% of the optimal growth rate. The penalty for overbetting is catastrophically worse than for underbetting.
过度下注2倍(即下注比例为2f)会导致零长期增长率——与完全不交易的结果相同。下注不足2倍(即下注比例为0.5f)仍能捕获约75%的最优增长率。过度下注的惩罚远比下注不足严重得多。
Recommended Fractions
推荐倍数
| Fraction | When to Use |
|---|---|
| 0.10x Kelly | Very uncertain edge, new strategy, < 30 trades in sample |
| 0.25x Kelly | Moderate confidence, 30-100 trades, reasonable Sharpe |
| 0.50x Kelly | High confidence, 100+ trades, consistent performance |
| 1.00x Kelly | Never recommended in practice |
| 倍数 | 使用场景 |
|---|---|
| 0.10x Kelly | 交易优势极不确定、新策略、样本交易数<30笔 |
| 0.25x Kelly | 中等信心、30-100笔交易、夏普比率合理 |
| 0.50x Kelly | 高信心、100+笔交易、业绩稳定 |
| 1.00x Kelly | 实际交易中绝不推荐 |
Estimating Your Edge
估算交易优势
Kelly requires two inputs: win rate () and payoff ratio (). Both must be estimated from data.
pb凯利准则需要两个输入参数:胜率()和盈亏比()。两者都必须从数据中估算得出。
pbMinimum Data Requirements
最低数据要求
- 50 trades minimum for any Kelly calculation. Below this, estimation error dominates.
- 100+ trades preferred for half Kelly sizing.
- 200+ trades before considering aggressive fractions.
- 任何凯利计算都需要至少50笔交易。低于这个数量,估算误差会占据主导。
- 100+笔交易更适合半额凯利仓位计算。
- 200+笔交易后再考虑使用较高倍数的凯利系数。
Calculation from Trade History
从交易历史计算
python
wins = [t for t in trades if t > 0]
losses = [t for t in trades if t < 0]
win_rate = len(wins) / len(trades) # p
payoff_ratio = mean(wins) / abs(mean(losses)) # b
edge = win_rate * payoff_ratio - (1 - win_rate) # should be > 0
kelly_full = (win_rate * payoff_ratio - (1 - win_rate)) / payoff_ratiopython
wins = [t for t in trades if t > 0]
losses = [t for t in trades if t < 0]
win_rate = len(wins) / len(trades) # p
payoff_ratio = mean(wins) / abs(mean(losses)) # b
edge = win_rate * payoff_ratio - (1 - win_rate) # 应大于0
kelly_full = (win_rate * payoff_ratio - (1 - win_rate)) / payoff_ratioConservative Estimation
保守估算
Use the lower bound of a Wilson confidence interval for win rate rather than the point estimate:
python
import math
def wilson_lower(wins: int, total: int, z: float = 1.96) -> float:
"""Lower bound of Wilson score interval (95% confidence)."""
p = wins / total
denominator = 1 + z**2 / total
centre = p + z**2 / (2 * total)
spread = z * math.sqrt((p * (1 - p) + z**2 / (4 * total)) / total)
return (centre - spread) / denominatorUsing the lower bound of the confidence interval for win rate automatically builds in conservatism, reducing the risk of overbetting due to sampling luck.
使用胜率的威尔逊置信区间下限而非点估计值:
python
import math
def wilson_lower(wins: int, total: int, z: float = 1.96) -> float:
"""Wilson得分区间的下限(95%置信度)。"""
p = wins / total
denominator = 1 + z**2 / total
centre = p + z**2 / (2 * total)
spread = z * math.sqrt((p * (1 - p) + z**2 / (4 * total)) / total)
return (centre - spread) / denominator使用胜率置信区间的下限会自动纳入保守性,降低因抽样运气导致过度下注的风险。
Edge Strength Classification
交易优势强度分类
| Edge Value | Classification | Notes |
|---|---|---|
| < 0 | Negative edge | Do not trade this strategy |
| 0 - 0.02 | No meaningful edge | Transaction costs likely exceed edge |
| 0.02 - 0.10 | Marginal edge | Conservative fractions only |
| 0.10 - 0.20 | Good edge | Standard fractions appropriate |
| > 0.20 | Excellent edge | Rare; verify not overfitting or temporary |
| 优势值 | 分类 | 说明 |
|---|---|---|
| < 0 | 负优势 | 不应使用该策略交易 |
| 0 - 0.02 | 无有效优势 | 交易成本可能超过优势 |
| 0.02 - 0.10 | 边际优势 | 仅使用保守倍数 |
| 0.10 - 0.20 | 良好优势 | 适合使用标准倍数 |
| > 0.20 | 极佳优势 | 罕见;需验证是否过拟合或仅为临时优势 |
Multi-Bet Kelly (Simultaneous Positions)
多下注凯利准则(同时持仓)
When holding multiple positions simultaneously:
当同时持有多个仓位时:
Independent Bets
独立下注
If bets are uncorrelated, each can be sized at its individual Kelly fraction. However, the sum of all Kelly fractions should not exceed 1.0 (total portfolio). If it does, scale each proportionally:
python
kelly_fractions = [0.15, 0.10, 0.12, 0.08] # individual Kelly fractions
total = sum(kelly_fractions) # 0.45
if total > 1.0:
scale = 1.0 / total
kelly_fractions = [f * scale for f in kelly_fractions]如果各下注之间不相关,每个仓位都可以按其单独的凯利系数比例配置。但所有凯利系数比例之和不应超过1.0(即整个投资组合)。如果超过,则按比例缩放每个仓位的比例:
python
kelly_fractions = [0.15, 0.10, 0.12, 0.08] # 各仓位的单独凯利比例
total = sum(kelly_fractions) # 0.45
if total > 1.0:
scale = 1.0 / total
kelly_fractions = [f * scale for f in kelly_fractions]Correlated Bets
相关下注
Correlated positions (e.g., multiple SOL memecoins) are effectively one larger bet. Reduce each position proportionally to the correlation:
python
undefined相关仓位(例如多个SOL迷因币)实际上相当于一个更大的下注。应根据相关性按比例减少每个仓位的规模:
python
undefinedSimple correlation adjustment
简单相关性调整
def adjust_for_correlation(kelly_fractions: list, avg_correlation: float) -> list:
"""Reduce Kelly fractions based on average inter-position correlation."""
n = len(kelly_fractions)
# Effective number of independent bets
n_eff = n / (1 + (n - 1) * avg_correlation)
scale = n_eff / n
return [f * scale for f in kelly_fractions]
In crypto, meme token positions often have correlations of 0.5-0.8 with each other (they all dump together in risk-off). Treat them as partially one bet.def adjust_for_correlation(kelly_fractions: list, avg_correlation: float) -> list:
"""根据仓位间的平均相关性调整凯利比例。"""
n = len(kelly_fractions)
# 有效独立下注数量
n_eff = n / (1 + (n - 1) * avg_correlation)
scale = n_eff / n
return [f * scale for f in kelly_fractions]
在加密货币市场中,迷因币仓位之间的相关性通常为0.5-0.8(在风险规避时期会集体下跌)。应将它们视为部分合并的单一下注。Portfolio Kelly Cap
投资组合凯利上限
Regardless of individual calculations, enforce a hard cap: total Kelly allocation should never exceed 1.0 (100% of portfolio). A practical maximum is 0.6-0.8 to leave cash buffer for drawdowns and new opportunities.
无论单独计算结果如何,都应设定硬性上限:总凯利配置比例绝不应超过1.0(即投资组合的100%)。实际操作中的最大上限为0.6-0.8,以留出现金缓冲应对回撤和新机会。
PumpFun / Meme Token Kelly
PumpFun / 迷因币凯利准则
Meme token trading presents specific challenges for Kelly:
- Edge is hard to estimate: Win rates and payoff ratios shift rapidly with market regime.
- Fat tails dominate: A few large winners and many small losers. Standard Kelly assumes thin tails.
- Correlation spikes in drawdowns: All meme tokens can dump simultaneously.
迷因币交易给凯利准则的应用带来了特定挑战:
- 交易优势难以估算:胜率和盈亏比会随市场状态快速变化。
- 肥尾效应主导:少数大额盈利和大量小额亏损。标准凯利准则假设瘦尾分布。
- 回撤时相关性飙升:所有迷因币可能同时下跌。
Practical Adjustments
实践调整
- Use 0.1x to 0.25x Kelly maximum for meme tokens.
- Cap absolute position size at 2-5% of portfolio regardless of Kelly output.
- Recalculate edge weekly — stale estimates are dangerous.
- If Kelly suggests > 30%, your edge estimate is almost certainly wrong. Use 5% maximum.
python
def meme_kelly(win_rate: float, payoff_ratio: float, account: float) -> float:
"""Conservative Kelly for high-uncertainty meme token trades."""
kelly_full = (win_rate * payoff_ratio - (1 - win_rate)) / payoff_ratio
kelly_conservative = kelly_full * 0.15 # 0.15x fractional
max_fraction = 0.05 # hard cap at 5%
return min(max(kelly_conservative, 0), max_fraction) * account- 迷因币交易的凯利系数最大使用0.1x至0.25x。
- 无论凯利计算结果如何,将绝对仓位规模上限设定为投资组合的2-5%。
- 每周重新估算交易优势——过时的估算十分危险。
- 如果凯利计算结果建议超过30%,你的优势估算几乎肯定有误。使用5%的最大上限。
python
def meme_kelly(win_rate: float, payoff_ratio: float, account: float) -> float:
"""针对高不确定性迷因币交易的保守凯利计算。"""
kelly_full = (win_rate * payoff_ratio - (1 - win_rate)) / payoff_ratio
kelly_conservative = kelly_full * 0.15 # 0.15倍分数凯利
max_fraction = 0.05 # 硬性上限5%
return min(max(kelly_conservative, 0), max_fraction) * accountWhen Kelly Does Not Work
凯利准则不适用的场景
Kelly optimality relies on assumptions that are often violated:
| Assumption | Reality | Impact |
|---|---|---|
| Known edge (p, b) | Estimated from noisy data | Overbetting risk |
| Independent bets | Correlated positions | Ruin risk increases |
| Binary outcomes | Continuous P&L distribution | Formula approximation |
| Stationary edge | Edge changes over time | Stale sizing |
| No transaction costs | Slippage, fees, MEV | Effective edge lower |
| Unlimited divisibility | Minimum position sizes | Rounding needed |
凯利准则的最优性依赖于一些常被违背的假设:
| 假设 | 现实情况 | 影响 |
|---|---|---|
| 已知交易优势(p, b) | 从含噪声的数据中估算 | 过度下注风险 |
| 独立下注 | 仓位之间存在相关性 | 破产风险增加 |
| 二元结果 | 盈亏呈连续分布 | 公式仅为近似 |
| 交易优势稳定 | 交易优势随时间变化 | 仓位规模过时 |
| 无交易成本 | 存在滑点、手续费、MEV | 实际交易优势更低 |
| 仓位可无限拆分 | 存在最小仓位规模 | 需要取整 |
Mitigations
缓解措施
- Use fractional Kelly (addresses estimation error)
- Adjust for correlation (addresses dependence)
- Use continuous Kelly for non-binary returns (see )
references/kelly_derivation.md - Recalculate regularly (addresses non-stationarity)
- Subtract estimated costs from edge before calculating Kelly
- 使用分数凯利(解决估算误差问题)
- 针对相关性进行调整(解决仓位依赖问题)
- 针对非二元收益使用连续凯利(参见)
references/kelly_derivation.md - 定期重新计算(解决非稳定性问题)
- 在计算凯利之前,从交易优势中扣除估算的成本
Continuous Kelly (For Portfolio Returns)
连续凯利准则(针对投资组合收益)
When returns are continuous rather than binary win/lose:
f* = (μ - r) / σ²Where:
- = expected return of the strategy
μ - = risk-free rate (often 0 for crypto)
r - = variance of returns
σ²
This is equivalent to when the Sharpe ratio is computed as .
Sharpe² / (2 * σ)(μ - r) / σUse this form when you have a return stream rather than discrete win/loss trades. See for the full derivation.
references/kelly_derivation.md当收益为连续而非二元的盈利/亏损时:
f* = (μ - r) / σ²其中:
- = 策略的预期收益
μ - = 无风险利率(加密货币市场中通常为0)
r - = 收益方差
σ²
当夏普比率计算为时,该公式等价于。
(μ - r) / σSharpe² / (2 * σ)当你拥有收益流而非离散的盈利/亏损交易时,使用此形式。完整推导参见。
references/kelly_derivation.mdIntegration with Other Skills
与其他技能的集成
- : Kelly provides the optimal fraction; position-sizing translates that into units. Use Kelly as one input, then apply liquidity and volatility constraints from position-sizing.
position-sizing - : Kelly sizing must respect portfolio-level risk limits. If Kelly suggests 10% per trade but your risk policy caps at 5%, the cap wins.
risk-management - : Document your Kelly parameters (fraction used, sample size, recalculation frequency) as part of strategy specification.
strategy-framework - : Recalculate Kelly when regime changes. Edge in a trending market differs from edge in a ranging market.
regime-detection
- :凯利准则提供最优比例;仓位配置将该比例转换为具体单位。将凯利准则作为一个输入,然后应用仓位配置中的流动性和波动性约束。
position-sizing - :凯利仓位规模必须遵守投资组合层面的风险限制。如果凯利准则建议每笔交易占10%,但你的风险政策上限为5%,则以政策上限为准。
risk-management - :将凯利参数(使用的倍数、样本规模、重新计算频率)作为策略规范的一部分记录下来。
strategy-framework - :当市场状态变化时重新计算凯利准则。趋势市场中的交易优势与震荡市场中的不同。
regime-detection
Files
文件
References
参考资料
- — Full mathematical derivation of Kelly criterion, fractional Kelly growth rates, continuous Kelly, and multi-outcome Kelly
references/kelly_derivation.md - — Edge estimation from trading data, confidence intervals, worked examples, common pitfalls, and danger zones
references/practical_kelly.md
- — 凯利准则、分数凯利增长率、连续凯利及多结果凯利准则的完整数学推导
references/kelly_derivation.md - — 从交易数据估算交易优势、置信区间、实例分析、常见陷阱及风险区域
references/practical_kelly.md
Scripts
脚本
- — Kelly calculator from win rate, payoff ratio, and account size. Prints fractional Kelly recommendations and sensitivity analysis. Dependencies: none.
scripts/kelly_calculator.py - — Estimate Kelly from a list of trade P&L values. Computes confidence intervals, rolling stability analysis, and recommended fraction. Dependencies: numpy.
scripts/kelly_from_trades.py
- — 根据胜率、盈亏比和账户规模计算凯利系数。输出分数凯利建议及敏感性分析。依赖:无。
scripts/kelly_calculator.py - — 从盈亏列表估算凯利系数。计算置信区间、滚动稳定性分析及推荐倍数。依赖:numpy。
scripts/kelly_from_trades.py