plugins/wealth-management/skills/historical-risk/SKILL.md
Quantify realized risk from historical data using volatility estimators, drawdown analysis, and downside risk metrics. Use when the user asks about historical volatility, maximum drawdown, drawdown duration, historical VaR, downside deviation, semi-variance, or tracking error. Also trigger when users mention 'how risky has this been', 'worst decline', 'Parkinson estimator', 'Yang-Zhang', 'peak-to-trough loss', 'recovery time', 'annualized volatility', or ask how to measure past investment risk.
npx skillsauth add joellewis/finance_skills historical-riskInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
1a — Realized Risk & Performance
Retrospective
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}).
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.
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_RS
where 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.
Drawdown at time t measures the decline from the running peak:
DD_t = (Peak_t - Value_t) / Peak_t
where Peak_t = max(Value_s) for all s <= t.
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.
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.
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.
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).
| 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 |
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%.
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:
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.
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.
See scripts/historical_risk.py for computational helpers.
testing
Model, forecast, and interpret volatility using time-series models and options-implied measures. Use when the user asks about EWMA, GARCH models, implied volatility, volatility surfaces, volatility term structure, or the VIX. Also trigger when users mention 'volatility smile', 'volatility skew', 'realized vs implied vol', 'volatility risk premium', 'vol clustering', 'mean-reverting volatility', 'options pricing inputs', 'RiskMetrics', 'decay factor', or ask how to forecast future volatility for risk management.
testing
Execute a complete tax-loss harvesting workflow from candidate identification through post-harvest monitoring. Use when the user asks about finding TLH candidates, gain/loss budgeting, replacement security selection, wash-sale compliance, or harvest execution planning. Also trigger when users mention 'unrealized losses in my portfolio', 'swap ETFs for tax purposes', 'harvest losses before year-end', 'substantially identical security', 'wash-sale window', 'NIIT offset', 'loss carryforward', or ask how much tax they can save by harvesting.
testing
Maximize after-tax returns through strategic asset location, tax-loss harvesting, gain/loss management, and withdrawal sequencing. Use when the user asks about asset location, tax-loss harvesting, Roth conversions, tax-efficient withdrawals, tax lot selection, or charitable giving with appreciated securities. Also trigger when users mention 'which account should I hold bonds in', 'wash-sale rule', 'tax drag', 'Roth vs Traditional', 'RMD planning', 'bracket stuffing', 'HIFO vs FIFO', or ask how to minimize taxes on investments.
development
Plan and track savings for specific financial goals including retirement, education, and home purchase. Use when the user asks about required savings rates, 529 plans, retirement accumulation targets, down payment planning, or goal prioritization. Also trigger when users mention 'how much do I need to save each month', 'am I on track for retirement', 'college savings', 'safe withdrawal rate', '4% rule', 'FIRE savings rate', 'catch-up contributions', 'employer match', or ask how to balance competing savings goals.