教学图复现清单¶
M00–M20 的脚本在 2026-10-23 重跑,工作目录为仓库根,命令形如 uv run python knowledge/books/figures/M00/plot_cost_leverage.py,MPLBACKEND=Agg。那 21 个脚本退出码均为 0,且没有改脚本、没有发起网络下载,重跑后的 PNG 与运行前字节一致。M21 于 2026-10-28 新增,单独运行 knowledge/books/figures/M21/plot_ai_quant_workflow.py,退出码为 0。
Kenneth French 的 zip 只存在于 M05/_cache、M06/_cache、M07/_cache,不入库。缓存缺失时,M05、M06、M07 会向 mba.tuck.dartmouth.edu 下载;M08 通过 M07 的 fetch_ff5() 走同一条下载。M11、M17 只读已有 zip,缺文件会直接失败,不会自己下载。
| 章 | 脚本 | 输出 PNG | 本次数据来源 |
|---|---|---|---|
| M00 | M00/plot_cost_leverage.py |
cost_and_leverage.png |
正文手算常数,无外部文件 |
| M01 | M01/plot_returns_and_capm.py |
spy_tails_and_capm.png |
knowledge/Labs/momentum_plus_lab/seed_data/spy.csv,以及同目录 _cache/AAPL.csv |
| M02 | M02/plot_faber_spy.py |
spy_ten_month_ma.png |
同上 spy.csv |
| M03 | M03/plot_lookahead.py |
lookahead_and_plateau.png |
同上 spy.csv |
| M04 | M04/plot_vol_target.py |
vol_target_and_growth.png |
同上 spy.csv;右图杠杆曲线是手算 |
| M05 | M05/plot_ff_factors.py |
ff_premia.png |
M05/_cache/F-F_Research_Data_Factors_CSV.zip |
| M06 | M06/plot_momentum_sorts.py |
momentum_deciles.png |
M06/_cache 的十分位与动量 zip,外加 M05 的三因子 zip |
| M07 | M07/plot_ff5_windows.py |
ff5_windows.png |
M07/_cache 的五因子 zip,外加 M06 的动量 zip |
| M08 | M08/plot_multiple_testing.py |
multiple_testing.png |
脚本内正态模拟(种子 7);右图复用 M07 的缓存读取 |
| M09 | M09/plot_fundamental_law.py |
fundamental_law.png |
正文手算,无外部文件 |
| M10 | M10/plot_alpha_forecast.py |
alpha_and_blend.png |
正文手算,无外部文件 |
| M11 | M11/plot_risk_model.py |
risk_split_and_corr.png |
M07 的五因子 zip,加 spy.csv |
| M12 | M12/plot_construction.py |
weights_and_breadth.png |
正文手算,无外部文件 |
| M13 | M13/plot_costs.py |
turnover_and_impact.png |
正文手算,无外部文件 |
| M14 | M14/plot_attribution.py |
brinson_and_years.png |
正文手算,无外部文件 |
| M15 | M15/plot_ops.py |
hours_and_caps.png |
正文手算,无外部文件 |
| M16 | M16/plot_ml.py |
oos_and_leak.png |
正文手算,对照已发表夏普 |
| M17 | M17/plot_allocation.py |
timing_and_sixty_forty.png |
M07 五因子 zip 与 M06 动量 zip |
| M18 | M18/plot_microstructure.py |
actions_and_frictions.png |
正文手算,无外部文件 |
| M19 | M19/plot_events.py |
event_timing_and_sue.png |
正文手算,无外部文件 |
| M20 | M20/plot_options.py |
payoff_and_scale.png |
正文手算,无外部文件 |
| M21 | M21/plot_ai_quant_workflow.py |
truncation_and_bridge.png |
正文教学输入,无外部文件 |
抽查:各章图题里的数字,以及速查表中与上述脚本打印值对应的样本月末、年化、t 值和回撤,四舍五入后一致。M06 的 1932-08 高减低 −77.66% 与最大回撤 −95.56%,M07 正文里的三因子 SMB(1963-07 至 2026-08 年化 1.77%,t = 1.35,2022 年 −7.35%)不在脚本标准输出里,用脚本自己的读取函数对同一缓存重算,结果相同。差异清单:无。