historical-risk
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHistorical Risk Analysis
历史风险分析
Purpose
用途
Quantify how risky an investment or portfolio has been using historical return and price data. This skill covers volatility estimation (close-to-close, Parkinson, Yang-Zhang), drawdown analysis, historical Value-at-Risk, downside deviation, tracking error, and semi-variance. All measures are backward-looking and computed from observed data.
利用历史收益率和价格数据量化投资或投资组合的过往风险。本技能涵盖波动率估计(收盘价-收盘价、Parkinson、Yang-Zhang)、回撤分析、历史VaR、下行偏差、跟踪误差和半方差。所有指标均为回溯性指标,基于观测数据计算得出。
Layer
层级
1a — Realized Risk & Performance
1a — 已实现风险与表现
Direction
方向
Retrospective
回顾性
When to Use
适用场景
- Understanding how risky an investment has been over a past period
- Computing historical (realized) volatility using various estimators
- Measuring drawdowns: maximum drawdown, drawdown duration, and recovery time
- Calculating historical VaR (non-parametric, directly from the return distribution)
- Computing downside deviation or semi-variance for asymmetric risk assessment
- Measuring tracking error of a portfolio relative to a benchmark
- 了解某一投资在过去一段时间内的风险水平
- 使用多种估计器计算历史(已实现)波动率
- 衡量回撤:最大回撤、回撤持续时间和恢复时间
- 计算历史VaR(非参数法,直接基于收益率分布)
- 计算下行偏差或半方差以进行非对称风险评估
- 衡量投资组合相对于基准的跟踪误差
Core Concepts
核心概念
Close-to-Close Volatility
Close-to-Close Volatility
The simplest and most common volatility estimator. Compute the standard deviation of log returns and annualize.
sigma_annual = sigma_daily * sqrt(N)where N = number of trading periods per year (typically 252 for daily, 52 for weekly, 12 for monthly).
Log returns are preferred: r_t = ln(P_t / P_{t-1}).
最简单且最常用的波动率估计器。计算对数收益率的标准差并年化。
sigma_annual = sigma_daily * sqrt(N)其中N = 每年的交易周期数(通常日度数据为252,周度为52,月度为12)。
优先使用对数收益率:r_t = ln(P_t / P_{t-1})。
Parkinson (High-Low) Estimator
Parkinson (High-Low) Estimator
Uses intraday high and low prices to capture intraday volatility that close-to-close misses. More efficient than close-to-close when the true process is continuous.
sigma^2_Park = (1 / (4 * n * ln(2))) * sum( ln(H_i / L_i)^2 )This estimator is roughly 5x more efficient than close-to-close for a diffusion process, but is biased downward when there are jumps or when the range is discretized.
利用日内最高价和最低价来捕捉收盘价-收盘价估计器所遗漏的日内波动率。当真实过程为连续过程时,其效率高于收盘价-收盘价估计器。
sigma^2_Park = (1 / (4 * n * ln(2))) * sum( ln(H_i / L_i)^2 )对于扩散过程,该估计器的效率约为收盘价-收盘价估计器的5倍,但当存在跳空或区间离散化时,会产生向下偏差。
Yang-Zhang Estimator
Yang-Zhang Estimator
Combines overnight (close-to-open), open-to-close, and Rogers-Satchell components. It is unbiased for processes with both drift and opening jumps.
sigma^2_YZ = sigma^2_overnight + k * sigma^2_open-to-close + (1 - k) * sigma^2_RSwhere k is chosen to minimize estimator variance, and sigma^2_RS is the Rogers-Satchell estimator that uses all four OHLC prices within each period.
结合了隔夜(收盘价-开盘价)、开盘价-收盘价以及Rogers-Satchell组件。对于同时存在漂移和开盘跳空的过程,该估计器是无偏的。
sigma^2_YZ = sigma^2_overnight + k * sigma^2_open-to-close + (1 - k) * sigma^2_RS其中k的选择旨在最小化估计器方差,sigma^2_RS是使用每个周期内所有四个OHLC价格的Rogers-Satchell估计器。
Drawdown Analysis
回撤分析
Drawdown at time t measures the decline from the running peak:
DD_t = (Peak_t - Value_t) / Peak_twhere Peak_t = max(Value_s) for all s <= t.
- Maximum Drawdown (MDD): MDD = max(DD_t) over the evaluation period.
- Drawdown Duration: The number of periods from a peak until a new peak is reached.
- Recovery Time: The number of periods from the trough back to the prior peak level.
时间t的回撤衡量从运行峰值到当前的跌幅:
DD_t = (Peak_t - Value_t) / Peak_t其中Peak_t = 所有s <= t时的max(Value_s)。
- Maximum Drawdown (MDD): MDD = 评估期内的max(DD_t)。
- Drawdown Duration: 从峰值到达到新峰值的周期数。
- Recovery Time: 从谷底回到之前峰值水平的周期数。
Historical VaR
Historical VaR
The non-parametric (empirical) Value-at-Risk is simply the alpha-percentile of the historical return distribution. No distributional assumptions are made.
VaR_alpha = -Percentile(R, alpha)For example, 95% VaR uses the 5th percentile of returns. The negative sign is a convention so that VaR is expressed as a positive loss number.
非参数(经验)风险价值(VaR)就是历史收益率分布的α分位数。无需做分布假设。
VaR_alpha = -Percentile(R, alpha)例如,95% VaR使用收益率的第5分位数。负号是惯例,以便VaR表示为正的损失数值。
Downside Deviation
Downside Deviation
Measures dispersion of returns below a Minimum Acceptable Return (MAR):
sigma_d = sqrt( (1/n) * sum( min(R_i - MAR, 0)^2 ) )Common choices for MAR: 0%, the risk-free rate, or the mean return.
衡量收益率低于最低可接受收益率(MAR)的离散程度:
sigma_d = sqrt( (1/n) * sum( min(R_i - MAR, 0)^2 ) )MAR的常见选择:0%、无风险利率或平均收益率。
Tracking Error
Tracking Error
Standard deviation of the difference between portfolio and benchmark returns, annualized:
TE = std(R_p - R_b) * sqrt(N)This measures how consistently the portfolio tracks (or deviates from) its benchmark.
投资组合与基准收益率差值的标准差,年化后的值:
TE = std(R_p - R_b) * sqrt(N)该指标衡量投资组合与基准的跟踪(或偏离)一致性。
Semi-Variance
Semi-Variance
Variance computed using only returns below the mean (or below a threshold):
SV = (1/n) * sum( min(R_i - mean(R), 0)^2 )Semi-variance isolates downside risk and is the foundation for the Sortino ratio (see performance-metrics).
仅使用低于均值(或低于阈值)的收益率计算的方差:
SV = (1/n) * sum( min(R_i - mean(R), 0)^2 )半方差专注于下行风险,是Sortino比率的基础(参见performance-metrics)。
Key Formulas
关键公式
| Formula | Expression | Use Case |
|---|---|---|
| Annualized Volatility | sigma_ann = sigma_period * sqrt(N) | Convert period vol to annual vol |
| Log Return | r_t = ln(P_t / P_{t-1}) | Compute continuously compounded returns |
| Parkinson Variance | sigma^2 = (1 / (4n ln2)) * sum(ln(H/L)^2) | Volatility from high-low data |
| Drawdown | DD_t = (Peak_t - Value_t) / Peak_t | Measure peak-to-trough decline |
| Max Drawdown | MDD = max(DD_t) | Worst historical decline |
| Historical VaR (95%) | 5th percentile of return series | Non-parametric loss estimate |
| Downside Deviation | sigma_d = sqrt((1/n) * sum(min(R_i - MAR, 0)^2)) | Asymmetric risk below MAR |
| Tracking Error | TE = std(R_p - R_b) * sqrt(N) | Portfolio vs benchmark deviation |
| Semi-Variance | (1/n) * sum(min(R_i - mean(R), 0)^2) | Below-mean variance |
| 公式 | 表达式 | 适用场景 |
|---|---|---|
| 年化波动率 | sigma_ann = sigma_period * sqrt(N) | 将周期波动率转换为年化波动率 |
| 对数收益率 | r_t = ln(P_t / P_{t-1}) | 计算连续复利收益率 |
| Parkinson方差 | sigma^2 = (1 / (4n ln2)) * sum(ln(H/L)^2) | 基于高低价数据计算波动率 |
| 回撤 | DD_t = (Peak_t - Value_t) / Peak_t | 衡量峰谷跌幅 |
| 最大回撤 | MDD = max(DD_t) | 历史最大跌幅 |
| 历史VaR(95%) | 收益率序列的第5分位数 | 非参数损失估计 |
| 下行偏差 | sigma_d = sqrt((1/n) * sum(min(R_i - MAR, 0)^2)) | MAR以下的非对称风险 |
| 跟踪误差 | TE = std(R_p - R_b) * sqrt(N) | 投资组合与基准的偏差 |
| 半方差 | (1/n) * sum(min(R_i - mean(R), 0)^2) | 低于均值的方差 |
Worked Examples
示例演练
Example 1: Annualized Volatility from Daily Returns
示例1:基于日度收益率计算年化波动率
Given: A stock has daily log returns with a sample standard deviation of 1.2%. Assume 252 trading days per year.
Calculate: Annualized volatility.
Solution:
sigma_annual = 0.012 * sqrt(252)
= 0.012 * 15.875
= 0.1905
~ 19.05%The stock's annualized volatility is approximately 19%.
已知: 某股票的日度对数收益率样本标准差为1.2%。假设每年有252个交易日。
计算: 年化波动率。
解答:
sigma_annual = 0.012 * sqrt(252)
= 0.012 * 15.875
= 0.1905
~ 19.05%该股票的年化波动率约为19%。
Example 2: Maximum Drawdown from a Price Series
示例2:基于价格序列计算最大回撤
Given: A fund's NAV follows this path over six months: $120, $135, $150, $130, $105, $125.
Calculate: Maximum drawdown and identify the peak and trough.
Solution:
Running peaks: $120, $135, $150, $150, $150, $150.
Drawdowns at each point:
- $120: (120-120)/120 = 0%
- $135: (135-135)/135 = 0%
- $150: (150-150)/150 = 0%
- $130: (150-130)/150 = 13.3%
- $105: (150-105)/150 = 30.0%
- $125: (150-125)/150 = 16.7%
Maximum Drawdown = 30.0%, occurring from the peak of $150 to the trough of $105. As of the last observation ($125), the drawdown has not yet fully recovered.
已知: 某基金的资产净值(NAV)在六个月内的走势为:$120, $135, $150, $130, $105, $125。
计算: 最大回撤并确定峰值和谷底。
解答:
运行峰值:$120, $135, $150, $150, $150, $150。
各时点的回撤:
- $120: (120-120)/120 = 0%
- $135: (135-135)/135 = 0%
- $150: (150-150)/150 = 0%
- $130: (150-130)/150 = 13.3%
- $105: (150-105)/150 = 30.0%
- $125: (150-125)/150 = 16.7%
最大回撤 = 30.0%,发生在峰值$150到谷底$105期间。截至最后一个观测值($125),回撤尚未完全恢复。
Example 3: Historical VaR
示例3:历史VaR
Given: 500 daily returns sorted from worst to best. The 25th-worst return is -2.8% and the 26th-worst is -2.6%.
Calculate: 95% 1-day historical VaR.
Solution:
The 5th percentile corresponds to the 25th observation out of 500 (500 * 0.05 = 25).
VaR_95% = -(-2.8%) = 2.8%Interpretation: On 95% of days, the loss is expected not to exceed 2.8% based on the historical distribution.
已知: 500个日度收益率从最差到最好排序。第25差的收益率为-2.8%,第26差的为-2.6%。
计算: 95%的1日历史VaR。
解答:
第5分位数对应500个观测值中的第25个(500 * 0.05 = 25)。
VaR_95% = -(-2.8%) = 2.8%解释:根据历史分布,95%的交易日中,损失预计不会超过2.8%。
Common Pitfalls
常见误区
- Not annualizing volatility correctly: Volatility scales with the square root of time (multiply by sqrt(N)), not linearly. Multiplying daily vol by 252 instead of sqrt(252) produces wildly inflated numbers.
- Using calendar days vs trading days inconsistently: Use 252 trading days (not 365 calendar days) for equity markets when annualizing. Bond markets and some international markets may differ.
- Survivorship bias in historical data: Data sets that exclude delisted or failed securities understate realized risk.
- Lookback period sensitivity: A 1-year lookback captures different risk regimes than a 5-year lookback. Always state the lookback window and consider whether it spans relevant market conditions.
- Confusing VaR confidence level direction: 95% VaR corresponds to the 5th percentile of returns (the loss tail). The "95%" refers to the confidence level, not the percentile of gains.
- Log returns vs simple returns: For volatility estimation, log returns are preferred because they are additive across time. For reporting cumulative performance, simple returns are more intuitive.
- 波动率年化错误: 波动率随时间的平方根缩放(乘以sqrt(N)),而非线性缩放。将日度波动率乘以252而非sqrt(252)会产生严重夸大的数值。
- 日历日与交易日混用: 年化股票市场数据时使用252个交易日(而非365个日历日)。债券市场和部分国际市场可能有所不同。
- 历史数据中的生存偏差: 排除已退市或破产证券的数据集会低估已实现风险。
- 回溯期敏感性: 1年回溯期与5年回溯期捕捉的风险状态不同。始终明确回溯窗口,并考虑其是否涵盖相关市场环境。
- 混淆VaR置信水平方向: 95% VaR对应收益率的第5分位数(损失尾部)。"95%"指的是置信水平,而非收益的分位数。
- 对数收益率与简单收益率: 波动率估计优先使用对数收益率,因为其具有时间可加性。报告累计表现时,简单收益率更直观。
Cross-References
交叉引用
- performance-metrics (wealth-management plugin, Layer 1a): Uses volatility, downside deviation, tracking error, and max drawdown as denominators in risk-adjusted ratios (Sharpe, Sortino, Information Ratio, Calmar).
- forward-risk (wealth-management plugin, Layer 1b): Historical VaR and historical volatility serve as inputs to forward-looking VaR models and stress tests.
- volatility-modeling (wealth-management plugin, Layer 1b): EWMA and GARCH models extend the simple historical volatility estimators covered here into forecasting frameworks.
- performance-metrics(财富管理插件,层级1a):在风险调整比率(Sharpe、Sortino、信息比率、Calmar)中使用波动率、下行偏差、跟踪误差和最大回撤作为分母。
- forward-risk(财富管理插件,层级1b):历史VaR和历史波动率作为前瞻性VaR模型和压力测试的输入。
- volatility-modeling(财富管理插件,层级1b):EWMA和GARCH模型将此处介绍的简单历史波动率估计器扩展为预测框架。
Reference Implementation
参考实现
See for computational helpers.
scripts/historical_risk.py计算辅助工具请参见。
scripts/historical_risk.py