ml4t-stress-test

Installation
SKILL.md

Stress Testing

A strategy backtested on 2015-2023 has never seen a regime where equities and bonds fall simultaneously. Without stress testing against 2008, 2020, and 2022, you are implicitly betting that those regimes will not recur.

The Problem

Backtests cover only the historical sample, which may exclude the scenarios most relevant to survival. A momentum strategy backtested from 2010 onward has never experienced the 2009 momentum crash (-46% in one month). Stress testing applies known crisis scenarios and hypothetical shocks to the current portfolio, revealing exposures that summary statistics hide. This is not optional - it is how you discover that your "diversified" portfolio has a hidden correlation spike that produces a -30% month.

The Pattern

WRONG

import numpy as np

# Only looks at backtest period (2016-2023) - misses major crises
returns = backtest_returns  # 2016-2023 daily
max_loss = returns.min()
print(f"Worst day: {max_loss:.1%}")  # -3.2%, looks safe
# But GFC 2008 would have been -15% in a single week for this portfolio
Installs
16
Repository
ml4t/skills
GitHub Stars
39
First Seen
Sep 13, 2026