본문으로 건너뛰기
라이브러리 문서 전체

퀀트 트레이딩 시스템의 리스크 관리

기사 Machine Learning for Trading

요약

이 장은 전략 설계와 실거래 운영의 일부로 리스크 관리를 다룹니다. VaR와 조건부 VaR를 사용한 꼬리 위험 측정, 드로다운의 깊이와 회복, 익스포저 분해, 스트레스 테스트, 적응형 제어, 거버넌스를 설명합니다. 제시된 방법에는 과거·모수적·Cornish-Fisher 꼬리 추정, 위기 상황 재현과 가상 시나리오, 팩터 회귀, 변동성 목표 설정, 포지션 청산, 드리프트 모니터링, 킬 스위치가 포함됩니다. 배포 전에 한도와 상향 보고 규칙을 정하고 의사결정 시점에 이용 가능한 정보만 사용할 것을 강조합니다.

이 문서는 자세한 결과를 보고하기보다 노트북 분석을 개괄합니다. 꼬리 위험 추정치를 실현 손실과 대조해 검증하고, 잦은 방향 전환에 따른 비용이나 성급한 청산 같은 상충 관계를 고려해 제어 규칙을 시험하는 방법을 설명합니다. 베팅 간 의존성이 높으면 폭넓게 분산된 성과 계산이 낙관적일 수 있으며, 리스크 특성이 실제 운영의 모든 실패를 포착하지 못할 수 있다는 한계도 밝힙니다. 독자는 이 장을 제어 규칙을 만들고 감사하는 틀로 봐야 하며, 특정 전략이나 리스크 규칙이 작동한다는 증거로 봐서는 안 됩니다.

핵심 아이디어

  • 전략 배포 전에 리스크 한도, 상향 보고 규칙, 거버넌스를 정해야 합니다.
  • CVaR는 기준을 넘는 손실을 나타내며 꼬리 위험 평가에서 VaR를 보완합니다.
  • 드로다운의 깊이, 기간, 회복 시간은 단일 시점 손실 지표가 놓치는 경로 위험을 포착합니다.
  • 스트레스 테스트에는 수익률, 비용, 변동성, 상관관계 충격을 함께 고려해야 합니다.
  • 적응형 제어에는 트레이딩 의사결정 시점에 이용할 수 있는 정보만 사용해야 합니다.
  • 베팅 간 의존성 때문에 분산도에 기반한 성과 추정의 가치는 제한됩니다.

태그

전문
# Chapter 19: Risk Management


# Chapter 19: Risk Management

This opening section reframes risk management as part of system design rather than post hoc reporting. It explains why a strategy is not deployable until its limits, escalation rules, and governance artifacts are defined in advance, auditable, and point-in-time safe.

## Learning Objectives

- Measure tail risk with VaR and CVaR, including regime-conditional estimates and liquidity-aware interpretation
- Evaluate path risk using drawdown depth, drawdown duration, recovery time, and related path-dependent metrics
- Decompose portfolio risk into market, factor, sector, geographic, and macro exposures to distinguish intended from unintended bets
- Design and interpret historical, hypothetical, and reverse stress tests that challenge return, cost, volatility, and correlation assumptions together
- Build adaptive risk controls, including volatility targeting, exposure caps, and position-level exits, using only information available at decision time
- Specify kill switches, drift monitoring, and governance artifacts that turn a backtested strategy into a deployable trading system

## Sections

### 19.1 Turning Your Backtest Winner into a Tradable System

This opening section reframes risk management as part of system design rather than post hoc reporting. It explains why a strategy is not deployable until its limits, escalation rules, and governance artifacts are defined in advance, auditable, and point-in-time safe.

- [`01_var_cvar`](01_var_cvar.ipynb) — This notebook demonstrates VaR and CVaR computation methods—historical, parametric, and Cornish-Fisher—along with backtesting to validate estimates against realized losses. These tail risk metrics form the foundation for risk budgeting and regulatory reporting.
- [`06_stress_testing`](06_stress_testing.ipynb) — This notebook demonstrates stress testing methodologies including historical crisis replay, hypothetical scenarios, and Monte Carlo simulation. We treat historical crises as regime exemplars that reveal strategy behavior under extreme conditions.

### 19.2 A Practical Risk Taxonomy for Quant Strategies

This section gives readers a usable map of what can actually go wrong in production. By linking market, factor, leverage, concentration, liquidity, model, and operational risk to observable proxies and controls, it turns abstract risk categories into practical monitoring and portfolio rules.

- [`04_factor_exposure`](04_factor_exposure.ipynb) — This notebook decomposes portfolio risk into factor components using regression-based methods. We estimate exposures to market, size, value, profitability, and investment factors, and track how these exposures change over time.
- [`06_stress_testing`](06_stress_testing.ipynb) — This notebook demonstrates stress testing methodologies including historical crisis replay, hypothetical scenarios, and Monte Carlo simulation. We treat historical crises as regime exemplars that reveal strategy behavior under extreme conditions.

### 19.3 Measuring the Tail: VaR and CVaR

Here the chapter moves from ordinary variability to true downside risk. It explains why VaR alone is incomplete, why CVaR is more informative once losses breach a threshold, and why regime-conditional and liquidity-aware tail estimates are more realistic than a single unconditional number.

- [`01_var_cvar`](01_var_cvar.ipynb) — This notebook demonstrates VaR and CVaR computation methods—historical, parametric, and Cornish-Fisher—along with backtesting to validate estimates against realized losses. These tail risk metrics form the foundation for risk budgeting and regulatory reporting.

### 19.4 Drawdowns, Path Risk, and Time-to-Recovery

This section shifts the focus from point losses to lived investor experience. By covering drawdown depth, duration, recovery time, and related path-risk measures, it shows why strategies fail not only because they lose money, but because they lose it in ways allocators and operators cannot tolerate.

- [`01_var_cvar`](01_var_cvar.ipynb) — This notebook demonstrates VaR and CVaR computation methods—historical, parametric, and Cornish-Fisher—along with backtesting to validate estimates against realized losses. These tail risk metrics form the foundation for risk budgeting and regulatory reporting.
- [`02_exit_strategies`](02_exit_strategies.ipynb) — This notebook explores exit strategies that protect profits and limit losses. We compare fixed stops, trailing stops, volatility-adjusted exits, and hybrid approaches, analyzing whipsaw costs and the tradeoff between protection and premature exit.
- [`03_position_sizing_mae_mfe`](03_position_sizing_mae_mfe.ipynb) — This notebook demonstrates position sizing methods and MAE/MFE analysis for stop calibration. We implement fixed fractional and volatility-based sizing, then use trade excursion analysis to optimize stop placement.
- [`10_ml4t_backtest_risk_demo`](10_ml4t_backtest_risk_demo.ipynb) — Demonstrates the ml4t.backtest.risk module—the library implementation of risk management concepts discussed in Chapter 19. This provides production-ready stop-loss rules, rule composition, and portfolio-level kill switches.

### 19.5 Decomposing Factor, Sector, and Macro Exposures

This section asks where portfolio risk really comes from. It shows how factor, sector, geographic, and macro decomposition reveal whether performance reflects intended exposures, accidental bets, or risks that were never part of the original thesis.

- [`04_factor_exposure`](04_factor_exposure.ipynb) — This notebook decomposes portfolio risk into factor components using regression-based methods. We estimate exposures to market, size, value, profitability, and investment factors, and track how these exposures change over time.
- [`05_trade_shap_diagnostics`](05_trade_shap_diagnostics.ipynb) — This notebook demonstrates TradeShapAnalyzer from ml4t.diagnostic.evaluation, which connects SHAP explanations to trade outcomes for systematic improvement. Trade-level SHAP forensics help answer the key risk question: why did this trade fail?

### 19.6 Stress Testing and Scenario Analysis

This section broadens risk measurement beyond history-matching. By replaying crises, constructing hypothetical shock matrices, and using reverse stress tests, it shows how to identify vulnerabilities before markets force the question in real time.

- [`06_stress_testing`](06_stress_testing.ipynb) — This notebook demonstrates stress testing methodologies including historical crisis replay, hypothetical scenarios, and Monte Carlo simulation. We treat historical crises as regime exemplars that reveal strategy behavior under extreme conditions.

### 19.7 Adaptive Risk Controls Without Leakage

This is the chapter's operational core for live implementation. It explains how volatility targeting, exposure caps, turnover tightening, and position-level exits can adapt to changing conditions without smuggling future information into the backtest.

- [`02_exit_strategies`](02_exit_strategies.ipynb) — This notebook explores exit strategies that protect profits and limit losses. We compare fixed stops, trailing stops, volatility-adjusted exits, and hybrid approaches, analyzing whipsaw costs and the tradeoff between protection and premature exit.
- [`07_drift_detection`](07_drift_detection.ipynb) — This notebook demonstrates drift detection methods for production ML trading systems. When live data distributions diverge from training data, models silently degrade.
- [`08_ml_exit_signals`](08_ml_exit_signals.ipynb) — This notebook demonstrates a two-model architecture for exit timing. The entry model predicts high-return opportunities while the exit model predicts adverse moves.
- [`09_deep_hedging`](09_deep_hedging.ipynb) — This notebook demonstrates deep hedging (Buehler et al., 2019): a neural network learns hedging positions that minimize CVaR of terminal PnL under transaction costs. Where Section 19.7 builds adaptive risk controls from rules (vol targeting, regime caps, stops), this notebook shows how the same risk objective can be optimized end-to-end by a neural network — bridging the gap between measurement (Section 19.3) and learned control.
- [`11_systematic_risk_sweep`](11_systematic_risk_sweep.ipynb) — Demonstrates how to systematically optimize position-level exit rules (StopLoss, TakeProfit, TrailingStop) through 1D sweeps, 2D grid searches, and MAE/MFE-calibrated stops. Rather than hand-picking 3-5 configurations, we sweep the full parameter space and visualize Sharpe/Calmar trade-offs as heatmaps --- letting the data reveal the optimal risk regime.

### 19.8 Applying Kill Switches and Risk Governance

This section turns metrics and controls into institutional process. It defines what failure conditions look like, how escalation should work, when re-research is required, and why drift detection and written risk governance are necessary for any strategy that is meant to survive contact with the market.

- [`07_drift_detection`](07_drift_detection.ipynb) — This notebook demonstrates drift detection methods for production ML trading systems. When live data distributions diverge from training data, models silently degrade.
- [`10_ml4t_backtest_risk_demo`](10_ml4t_backtest_risk_demo.ipynb) — Demonstrates the ml4t.backtest.risk module—the library implementation of risk management concepts discussed in Chapter 19. This provides production-ready stop-loss rules, rule composition, and portfolio-level kill switches.

The cross-case-study risk-overlay comparison lives in Chapter 20: see [`20_strategy_synthesis/07_regime_risk`](../20_strategy_synthesis/07_regime_risk.ipynb).

## Running the Notebooks

```bash
# From the repository root
uv run python 19_risk_management/<notebook>.py

# Test mode (reduced data via Papermill)
uv run pytest tests/test_chapter_notebooks.py -v -k "19_risk_management"
```

## References

- **Aaron Brixton et al.** (2022). [A Changing Stock-Bond Correlation](https://www.aqr.com/Insights/Research/Journal-Article/A-Changing-Stock-Bond-Correlation). *AQR Alternative Thinking*.
- **A. E. Whalley and P. Wilmott** (1997). [An Asymptotic Analysis of an Optimal Hedging Model for Option Pricing with Transaction Costs](https://doi.org/10.1111/1467-9965.00034). *Mathematical Finance*.
- **Alan Moreira and Tyler Muir** (2017). [Volatility-Managed Portfolios](https://doi.org/10.1111/jofi.12513). *The Journal of Finance*.
- **Andrew Ang and Allan Timmermann** (2011). [Regime Changes and Financial Markets](https://doi.org/10.2139/ssrn.1919497).
- **Andrew J. Patton** (2011). [Volatility forecast comparison using imperfect volatility proxies](https://doi.org/10.1016/j.jeconom.2010.03.034). *Journal of Econometrics*.
- **Ashwin Alankar et al.** (2023). [Fairy Tails: Lessons from 150 Years of Drawdowns](https://doi.org/10.3905/jpm.2023.1.503). *The Journal of Portfolio Management*.
- **{Board of Governors of the Federal Reserve System** (2011). [Supervisory Guidance on Model Risk Management - SR Letter 11-7](https://www.federalreserve.gov/supervisionreg/srletters/sr1107.htm).
- **Brian Hurst** (2010). Understanding Risk Parity.
- **Campbell R. Harvey et al.** (2022). [An Investor’s Guide to Crypto](https://doi.org/10.2139/ssrn.4124576).
- **Giuseppe A. Paleologo** (2025). The Elements of Quantitative Investing. *John Wiley & Sons*.
- **G. William Schwert** (1989). [Why Does Stock Market Volatility Change Over Time?](https://doi.org/10.1111/j.1540-6261.1989.tb02647.x). *The Journal of Finance*.
- **H. Buehler et al.** (2019). [Deep hedging](https://doi.org/10.1080/14697688.2019.1571683). *Quantitative Finance*.
- **Hervé Zumbach and Gilles Zumbach** (2025). [A Quantitative Approach to Historical Stress Tests](https://doi.org/10.3905/jpm.2025.1.742). *The Journal of Portfolio Management*.
- **Kent Daniel and Tobias J. Moskowitz** (2016). [Momentum crashes](https://doi.org/10.1016/j.jfineco.2015.12.002). *Journal of Financial Economics*.
- **Kevin Khang** (2022). [Toward Regime-Aware Risk Forecasts](https://doi.org/10.3905/jpm.2022.48.5.049). *The Journal of Portfolio Management*.
- **Marcos Lopez de Prado** (2018). Advances in Financial Machine Learning. *John Wiley & Sons*.
- **Michele Leonardo Bianchi et al.** (2023). [Fat and Heavy Tails in Asset Management](https://doi.org/10.3905/jpm.2023.1.501). *The Journal of Portfolio Management*.
- **Peter Reinhard Hansen and Asger Lunde** (2006). [Consistent ranking of volatility models](https://doi.org/10.1016/j.jeconom.2005.01.005). *Journal of Econometrics*.
- **R. Cont** (2001). [Empirical properties of asset returns: stylized facts and statistical issues](https://doi.org/10.1080/713665670). *Quantitative Finance*.
- **R. Douglas Martin et al.** (2024). [Minimum Downside Risk Portfolios](https://doi.org/10.3905/jpm.2024.1.642). *The Journal of Portfolio Management*.
- **R. Tyrrell Rockafellar and Stanislav Uryasev** (2000). [Optimization of conditional value-at-risk](https://doi.org/10.21314/JOR.2000.038). *The Journal of Risk*.
- **Samir Varma** (2025). [The False Promise of Drawdown Rules: New Evidence and a Better Framework](https://doi.org/10.3905/jpm.2025.1.765). *The Journal of Portfolio Management*.
- **Sid Browne et al.** (2023). [Timing and Sizing Skills of Systematic Strategies across Time and Economic Regimes](https://doi.org/10.3905/jpm.2023.1.505). *The Journal of Portfolio Management*.
- **Tim Bollerslev** (1986). [Generalized autoregressive conditional heteroskedasticity](https://doi.org/10.1016/0304-4076(86)90063-1). *Journal of Econometrics*.
- **Yizhan Shu and John M. Mulvey** (2025). [Dynamic Factor Allocation Leveraging Regime-Switching Signals](https://doi.org/10.3905/jpm.2024.1.649). *The Journal of Portfolio Management*.

출처의 라이선스에 따라 출처를 표시하고 전문을 공개합니다. 라이선스: MIT

이 요약은 원문을 바탕으로 Stratmill의 리서치 에이전트가 작성했으며, 원문을 복사한 것이 아닙니다.