5D Library › 体制转换分数凯利、最大回撤约束与生命周期杠杆配置 · English
第一章 全凯利与乐观的漂移:好年景为什么催生过度下注
增长曲线
凯利准则选择下注占财富的比例,使财富长期增长最快 (Kelly 1956)。对于超额收益为 、波动率为 的资产,在连续再平衡的组合中,增长最优的杠杆是 (Thorp 2006)。下注 倍的 ,超额对数增长率为 ,其中 是夏普比率。这条曲线是一条抛物线:在 处达到顶点,到 回到零,再往上为负。
实际中要紧的是, 并不是直接选出来的。投资者先认定一个超额收益,再从它算出 ;如果认定值是真实值的两倍,下注就是两倍凯利。p01 取超额收益每年 0.05、波动率 0.16。
推导
# Chapter 1. p01: The Kelly growth curve and what an optimistic drift
# does to it. Excess return mu - r = 0.05 a year, volatility 0.16, so
# full Kelly f* = (mu - r) / sigma^2. An investor who believes the
# excess return is m instead of 0.05 bets c = m / 0.05 times Kelly.
# Excess log growth of wealth: S^2 (c - c^2 / 2), S = Sharpe ratio.
EX, SIG = 0.05, 0.16
if __name__ == "__main__":
f_star = EX / SIG ** 2
s2 = (EX / SIG) ** 2
print(" full Kelly leverage f* = {:.3f}; Sharpe {:.4f}".format(
f_star, EX / SIG))
print(" believed excess multiple c leverage wealth vol growth")
for m in (0.0125, 0.025, 0.05, 0.075, 0.10, 0.125, 0.15):
c = m / EX
g = s2 * (c - c * c / 2)
print(" {:15.4f} {:10.2f} {:8.2f} {:10.3f} {:+.4f}".format(
m, c, c * f_star, c * EX / SIG, g))
print(" growth at half Kelly / full Kelly: {:.2f}".format(
(0.5 - 0.125) / 0.5))
print(" wealth vol at half Kelly / full Kelly: {:.2f}".format(0.5))
# full Kelly leverage f* = 1.953; Sharpe 0.3125
# believed excess multiple c leverage wealth vol growth
# 0.0125 0.25 0.49 0.078 +0.0214
# 0.0250 0.50 0.98 0.156 +0.0366
# 0.0500 1.00 1.95 0.312 +0.0488
# 0.0750 1.50 2.93 0.469 +0.0366
# 0.1000 2.00 3.91 0.625 +0.0000
# 0.1250 2.50 4.88 0.781 -0.0610
# 0.1500 3.00 5.86 0.938 -0.1465
# growth at half Kelly / full Kelly: 0.75
# wealth vol at half Kelly / full Kelly: 0.50这里的全凯利是 1.953 倍杠杆,财富波动率 0.312,每年超额增长 0.0488。认定超额收益为 0.10 的投资者押上 3.91 倍财富,超额增长恰好为零,财富波动率 0.625;认定为 0.15 的投资者押上 5.86 倍,每年对数意义上亏损 0.1465。半凯利保留 0.75 的增长,只承担 0.50 的波动,这就是谨慎的实践者下注凯利分数的原因 (MacLean et al. 2011)。
漂移能估计得多准
市场的波动率用几年数据就能估计得不错,均值却不行。用 年数据测得的平均超额收益,标准误是 ,p02 的 (a) 部分说明这意味着什么。(b) 部分加入一个有两种隐藏体制的市场:牛市体制超额收益每年 0.12、波动率 0.13,熊市体制 -0.25、波动率 0.28,两者按马尔可夫链切换 (Hamilton 1989)。
推导
# Chapter 1. p02: How well can the drift be estimated, and what does a
# "tailwind" sample do? (a) i.i.d. world of p01: the standard error of
# a mean excess return estimated from T years is 0.16 / sqrt(T).
# (b) A two-regime market, monthly: bull excess 0.12 a year (vol 0.13),
# bear -0.25 (vol 0.28); a bull month stays bull with chance 0.98, a
# bear month stays bear with 0.92. An investor estimates mean and
# variance from the last 60 months, either at random dates or only
# when a bull run has lasted 36 months or more. Seed 98.
import random
from math import sqrt
from statistics import NormalDist
BULL, BEAR = (0.12 / 12, 0.13 / sqrt(12)), (-0.25 / 12, 0.28 / sqrt(12))
STAY = (0.98, 0.92)
def chain(rng, n):
s, run, out = 0, 0, []
for _ in range(n):
if rng.random() > STAY[s]:
s, run = 1 - s, 0
run += 1
m, sd = BULL if s == 0 else BEAR
out.append((s, run, rng.gauss(m, sd)))
return out
def kelly(xs):
m = sum(xs) / len(xs)
v = sum((x - m) ** 2 for x in xs) / (len(xs) - 1)
return m * 12, v * 12, m / v
if __name__ == "__main__":
z = NormalDist()
print(" (a) years std error P(estimate >= 2 x true)")
for t in (5, 10, 30, 100):
se = 0.16 / sqrt(t)
print(" {:9d} {:9.4f} {:23.3f}".format(
t, se, 1 - z.cdf(0.05 / se)))
rng = random.Random(98)
xs = chain(rng, 600000)
allx = [x for _, _, x in xs]
m_all, v_all, f_all = kelly(allx)
print(" (b) whole history: excess {:.4f}, vol {:.4f}, Kelly {:.2f}"
.format(m_all, sqrt(v_all), f_all))
for name, cond in (("random dates", lambda s, r: True),
("bull run >= 36 months", lambda s, r: s == 0
and r >= 36)):
fs = []
for i in range(60, len(xs), 7):
s, r, _ = xs[i - 1]
if cond(s, r):
fs.append(kelly(allx[i - 60:i])[2])
fs.sort()
q = lambda a: fs[int(a * (len(fs) - 1))]
print(" {:<22} n {:5d} median f {:5.2f} 10%-90% {:5.2f} to "
"{:5.2f}".format(name, len(fs), q(0.5), q(0.1), q(0.9)))
print(" {:<22} share with f >= 2 x whole-history Kelly: {:.3f}"
.format("", sum(f >= 2 * f_all for f in fs) / len(fs)))
# (a) years std error P(estimate >= 2 x true)
# 5 0.0716 0.242
# 10 0.0506 0.162
# 30 0.0292 0.043
# 100 0.0160 0.001
# (b) whole history: excess 0.0452, vol 0.1759, Kelly 1.46
# random dates n 85706 median f 2.42 10%-90% -2.27 to 9.24
# share with f >= 2 x whole-history Kelly: 0.460
# bull run >= 36 months n 34037 median f 5.69 10%-90% 0.41 to 11.32
# share with f >= 2 x whole-history Kelly: 0.740用十年数据,标准误是 0.0506,与超额收益本身一样大,因此一个诚实的估计至少高出真实值一倍的机会是 0.162;用五年数据是 0.242。要有一百年的数据,这个机会才降到 0.001。
在两体制市场中,全历史超额收益是 0.0452、波动率 0.1759,单一体制的凯利杠杆是 1.46。在随机日期用最近六十个月估计,中位数是 2.42,因为大多数六十个月的窗口主要由牛市月份组成;其中 0.460 达到全历史凯利的两倍以上。只在牛市已持续三年之后才估计的投资者,也就是人们通常加杠杆的时刻,得到的中位数是 5.69,其中 0.740 落在两倍凯利以上。过度下注不是某些投资者的性格缺陷,而是长期顺风的数据本身造成的。
假说 · 尚未验证
作者的诠释(尚未验证): 散户承担的杠杆随此前牛市的长度上升,大致与用滚动窗口估计的凯利同步。什么会证明它错: 在覆盖多个周期的券商或融资余额数据中,融资相对于权益的比例不随此前上涨的长度上升,或其上升幅度小于滚动五年凯利估计的变化所隐含的幅度。
小结
凯利增长曲线宽容下注不足而惩罚下注过度:到两倍凯利时增长已经消失。决定凯利的漂移,用十年数据也只能估计到每年约 0.05 的精度,而在长牛市中取得的样本会高估它,因此顺风时算出的「全凯利」通常是真实凯利的数倍。
参考文献
Fan, Y. (2026). Regime-Switching Fractional Kelly, Maximum-Drawdown Constraints and Lifecycle Leverage Allocation: Cyclical Drift Estimation Errors, Ruin-Bounded Bet Sizing and Human-Capital Amortization [体制转换分数凯利、最大回撤约束与生命周期杠杆配置] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090256 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).