马科维茨与组合管理的小故事
Finally, I would like to add a comment concerning portfolio theory as a part of the microeconomics of action under uncertainty. It has not always been considered so. For example, when I defended my dissertation as a student in the Economics Department of the University of Chicago, Professor Milton Friedman argued that portfolio theory was not Economics, and that they could not award me a Ph.D. degree in Economics for a dissertation which was not in Economics. I assume that he was only half serious, since they did award me the degree without long debate. As to the merits of his arguments, at this point I am quite willing to concede: at the time I defended my dissertation, portfolio theory was not part of Economics. But now it is.
source: Harry M. Markowitz – Prize Lecture. NobelPrize.org. Nobel Prize Outreach 2025. Tue. 9 Sep 2025.
收益的来源
Example
As reported by Yahoo! Finance, the S&P 500 Index of U.S.
stocks was at 903.25 on 31 December 2008. Similarly, Yahoo! Finance reported that
the index closed on 30 July 2002 at 902.78, implying a return of close to 0 percent
over the approximately six-and-a-half-year period. The results are very different,
however, if the total return S&P 500 Index is considered. The index was at 1283.62 on 30 July 2002 and had risen 13.2 percent to 1452.98 on 31 December 2008, giving an annual return of 1.9 percent.
用什么表示(量化)收益?
将单位货币分配到每一个(风险/无风险)资产中:
假设
因此,其方差可以表示为
组合收益:
组合风险:
因此,其标准差为
|
![]() 来源: 2022 CFA Program curriculum Reading 49 |
|
|
stk1 = df.loc[df.ts_code == '600519.SH', ['ts_code','trade_date','pct_chg']]
stk2 = df.loc[df.ts_code == '000333.SZ', ['ts_code','trade_date','pct_chg']]
stk3 = df.loc[df.ts_code == '000001.SZ', ['ts_code','trade_date','pct_chg']]
stk = pd.merge(stk1,stk2,on = 'trade_date')
stk = pd.merge(stk,stk3,on = 'trade_date')
stk_return = []
stk_return.append(stk.pct_chg_x.mean())
stk_return.append(stk.pct_chg_y.mean())
stk_return.append(stk.pct_chg.mean())
stk_risk = []
stk_risk.append(stk.pct_chg_x.var())
stk_risk.append(stk.pct_chg_y.var())
stk_risk.append(stk.pct_chg.var())
stk_risk=list(np.sqrt(stk_risk))
|
![]() |
假设
令
有多于2个风险资产时,所有可行组合的风险和收益的关系不再能够由一条曲线表示。
|
![]() |
或者
或者
集合
MVO的解
The model is too naive for practical purpose
来源: 2022 CFA Program curriculum Reading 49
来源: 2022 CFA Program curriculum Reading 49
![]() 来源: 2022 CFA Program curriculum Reading 49 |
|
两基金分离定理(two-fund separation theorem): 所有的投资者,不管其喜好、风险偏好、初始财富,都将只持有两个组合(或基金):一个无风险资产和一个最优的风险资产。
市场组合是由所有价值非负的风险资产(多头)构成的投资组合
投资者只会投资最优风险组合,不在最优风险组合中的资产价值为0,因此最优风险组合包括所有证券
处于均衡状态时最优风险组合中个证券所占比例必须等于其市值占市场总市值的比例
供给-需求分析
|
|
|
![]() |
假设投资者面对以下两种选择:
|
投资者对风险的态度可分为以下几类:
|
|
![]() 来源: 2022 CFA Program curriculum Reading 49 |
来源: 2022 CFA Program curriculum Reading 49
|
![]() 来源: 2022 CFA Program curriculum Reading 49 |
假设投资者的效用函数为:
来源: 2022 CFA Program curriculum Reading 49
来源: 2022 CFA Program curriculum Reading 49
Primal, Lagrangian Function, & Dual
Optimality Conditions for QP
The vectors
For a QP in standard form, the optimality conditions can be written as follows:
|
|
Analytical Solutions
There exist two efficient portfolios (funds), namely
there exists a fully invested efficient portfolio (fund) namely
such that every efficient portfolio - that is, every solution for some
Variable
(变量)、Parameter
(参数,可重复求解)、Problem
(问题)、Minimize/Maximize
(目标)、Constraints
(约束)quad_form
, norm
, sum
, sum_squares
, exp
, log
, max
等OSQP
(QP), ECOS
(SOCP), SCS
(通用锥), GLPK
(LP)GUROBI
/CPLEX
/MOSEK
(更稳健更快)problem.status
;用 warm_start=True
加快参数扫描import cvxpy as cp
import numpy as np
np.random.seed(42)
# 变量与数据
n = 5
w = cp.Variable(n) # 定义变量
mu = np.random.randn(n) * 0.01 # 生成收益率向量(标准正态*0.01)
Sigma = np.cov(np.random.randn(200, n), rowvar=False) # 计算方差-协方差矩阵
Sigma += 1e-8 * np.eye(n) # 数值稳定性调整
# 目标与约束(示例)
obj = cp.Minimize(0.5 * cp.quad_form(w, Sigma) - 3.0 * mu @ w)
cons = [cp.sum(w) == 1, w >= 0]
# 求解
prob = cp.Problem(obj, cons)
prob.solve(solver=cp.OSQP, warm_start=True)
print(prob.status, prob.value, w.value[:3])
optimal 0.08332029182527874 [0.24197489 0.17954082 0.16895055]
主要思路
|
主程序
|
|
|
Weights:
Selection binaries:
Group/sector activation:
Trading indicators:
Buy-in and per-name cap:
Long/short split linkage (optional):
Budget and exposure (examples):
|
|
|
|
|
|
|
|
Status: optimal
Objective: 0.07949999999970724
Nonzero names: 17
Estimation of Inputs to Mean–Variance Models
Model the sensitiv
Solver
Performance Analysis
We will cover most of the above topics in later lectures.
|
|
|
![]() |
|
![]() |
课后阅读与练习
|
拓展学习
|
[1] Black F, Litterman R. Global portfolio optimization[J]. Financial Analysts Journal, 1992, 48(5): 28-43.
[2] Boyd S, Boyd S P, Vandenberghe L. Convex optimization[M]. Cambridge university press; 2004 Mar 8.
[3] Cochrane J H. Asset pricing: Revised edition[M]. Princeton university press; 2009 Apr 11.
[4] Cornuejols G, Tütüncü R. Optimization methods in finance[M]. Cambridge University Press; 2006 Dec 21.
[5] Delage E, Ye Y. Distributionally robust optimization under moment uncertainty[J]. Operations Research, 2010, 58(3): 595-612.
[6] Goldfarb D, Iyengar G. Robust portfolio selection problems[J]. Mathematics of Operations Research, 2003, 28(1): 1-38.
[7] Gomes F. Portfolio choice over the life cycle: A survey[J]. Annual Review of Financial Economics, 2020, 12: 277-304.
[8] Ledoit O, Wolf M. Honey, I shrunk the sample covariance matrix[J]. The Journal of Portfolio Management, 2004, 30(4): 110-119.
[9] Li B, Hoi S C H. Online portfolio selection: A survey[J]. ACM Computing Surveys (CSUR), 2014, 46(3): 1-36.
[10] Litterman R. Common sense on risk[R]. Goldman Sachs Asset Management; 1999.
[11] Maillard S, Roncalli T, Teïletche J. The properties of equally weighted risk contribution portfolios[J]. The Journal of Portfolio Management, 2010, 36(4): 60-70.
[12] Markowitz H M. Portfolio selection[J]. The Journal of finance, 1952, 7(1): 77-91.
[13] Markowitz H M. Portfolio selection[M]//Portfolio selection. Yale university press, 1968.
[14] Markowitz H M. Mean—variance analysis[M]//Finance. Palgrave Macmillan, London, 1989: 194-198.
[15] Markowitz H M. The early history of portfolio theory: 1600–1960[J]. Financial analysts journal, 1999, 55(4): 5-16.
[16] Meucci A. The Black–Litterman approach: Original model and extensions[R]. SSRN Working Paper; 2005.
[17] Qian E. Risk parity and diversification[J]. The Journal of Investing, 2011, 20(1): 119-127.
[18] Roy A D. Safety first and the holding of assets[J]. Econometrica: Journal of the econometric society, 1952: 431-49.
[19] Rubinstein M. Markowitz's "portfolio selection": A fifty-year retrospective[J]. The Journal of finance, 2002, 57(3): 1041-1045.
非正态情形:
与 VaR / ES(CVaR)的关系:
常见陷阱:
|
|
核心概念
|
风险预算的凸优化实现(Roncalli)
|
|
|
BL 步骤 1:先验(均衡)收益与参数
|
BL 步骤 2:观点矩阵与不确定性
|
BL 步骤 3:后验融合
|
BL 步骤 4:落地与陷阱
|
|
|
|
|
盒式不确定集:目标中出现
椭球不确定集:岭式
协方差不确定:
分布鲁棒 CVaR(样本/场景
交易成本/换手:权重正则天然抑制过度调仓
|
|
估计依赖:风险平价 < 鲁棒 MVO < BL < 传统 MVO
尾部控制:SFC/分布鲁棒 CVaR > 鲁棒 MVO > 风险平价 ≈ 传统 MVO
解释性:BL(观点可解释)、风险平价(风险贡献可解释)更优
适用场景:
<img align="center" style="padding-right:10px;" width=80% src="../myfig/portfolio_assetpricing_emh/story.jpg">
[^1]
[^1]:Kolm P N, Reha Tütüncü, Fabozzi F J. 60 Years of portfolio optimization: Practical challenges and current trends[J]. European Journal of Operational Research, 2014, 234(2):356--371.
**<font color='red'>Discussion: Can we improve the above constraint?</font>**
- **<font color='red'>How to improve the above constraint?</font>**
# CVXPY example (runnable MILP): long-only with sectors, turnover, Active Share
教学要点:用一个示意图展示当 ( $L$ ) 提高时,可行域缩小、组合更保守。
与现有讲义交叉引用: - 第55–56页:从夏普最大化到 SFC 的并行“锥规划化”
课堂提示:与第59页“分布对比图”结合,展示 SFC 组合 vs. 夏普最优组合的下尾差异。
动机:弱化对 ( $\mu$ ) 的依赖,聚焦“风险如何被分配”。
对比(建议课堂图示): - 等权权重 ≠ 等权风险:高波动资产往往主导风险 - 最小方差可能“集中化” - 风险平价的风险贡献条形图通常更均衡
- 与第52–54页“约束”对齐:可添加“风险预算约束/目标”示例
实践提示:将风险平价作为“核心仓位”,在其上叠加 alpha(卫星)策略。
课堂展示:用柱状图对比等权/最小方差/风险平价的风险贡献。
与现有讲义交叉引用: - 第27–28页:市场组合与均衡逻辑 → 先验的经济解释 - 第21页:估计误差与贝叶斯/鲁棒方法的动机
教学提示:联系第25–28页资本配置线与市场组合,解释为何“均衡预期收益”可由反向优化得到。
例子:看多 A 胜 B 200bp:( $P=[1,-1,0,\dots],\ Q=0.02$ )
课堂演示:改变$\tau$、$\Omega$对权重的影响曲线。
# 之后:用 (mu_bl, Sigma) 做约束 MVO(见第57–59页 CVXPY 模板)
与现有讲义交叉引用: - 第21页:鲁棒优化作为应对估计误差的方法 - 第57–59页:与 CVXPY 框架无缝衔接
教学提示:用一页图示 $( L_1 )$ vs $( L_2 )$ 正则对权重的影响(稀疏 vs 平滑)。
实践建议:小样本/高维优先“估计层鲁棒”(因子/收缩)+“优化层鲁棒”(正则/边界)。
与现有讲义交叉引用: - 第52–54页:可加入“风险预算/风格暴露”约束示例 - 第57–59页:统一求解与可视化工作流
--- ### 课堂练习与小型实验(建议) - 练习 1(SFC):给定 ($(\hat\mu,\hat\Sigma)$)、( $L=0$ )、( $\alpha=5\%$ ),比较 SFC vs. 夏普最优 在 5% 下分位的差异 - 练习 2(风险平价):3–5 资产,作等权/最小方差/风险平价的风险贡献柱状图 - 练习 3(BL):两条相对观点,比较不同 ( $\tau$ )、( $\Omega$ ) 对 ( $\mu^{BL}$ ) 与权重的影响 - 练习 4(鲁棒 MVO):扫描 ( $L_2$ ) 正则强度,评估样本外波动与换手率
提示:直接复用第57–59页 CVXPY 框架;本节代码可嵌入为可执行单元。
--- ### 数据与参数小抄(教学/实务) - 估计期:月频 3–5 年;日频 1–2 年(配合收缩/因子) - 收缩:Ledoit–Wolf/OAS;均值向因子/行业基线收缩 - SFC:( $L$ ) 取 0 或产品保底线;( $\alpha$ )=1–5% 常见 - 风险平价:预算 ( $b_i$ ) 可按行业/资产类设定 - BL:( $\tau$ )=0.025–0.10;( $\Omega$ ) 与观点来源匹配(高置信=小方差) - 鲁棒:( $L_1/L_2$ ) 正则强度交叉验证;结合换手/交易成本