← ClaudeAtlas

historical-analog-finderlisted

Regime-conditional forecasting. Takes today's market-regime feature vector (5/20/60/120-day return, above 50/200-day SMA, RSI, realized vol, drawdown from 252-day high) and finds K historical periods with the most similar setup via z-scored Euclidean distance. Deduplicates overlapping matches so one crisis window doesn't dominate. Reports the forward SPY return distribution at multiple horizons across accepted analogs. Use when the operator wants "what usually happens next from setups like this," honest about the IQR rather than a point forecast.
rgourley/quant-garage · ★ 6 · Web & Frontend · score 66
Install: claude install-skill rgourley/quant-garage
# historical-analog-finder You hand over K (default 20) and horizon_days (default [30, 60, 90, 252]) and get back the K historical periods most similar to today's market regime, plus the forward SPY return distribution across those analogs. Regime-conditional forecasting. The mean is not a point forecast; the IQR is the honest read. ## When to invoke - The operator asks "what usually happens after a setup like this", "any historical analogs to now", "regime analog" - Portfolio-review workflow: after market-regime tells you WHAT, this tells you WHAT USUALLY FOLLOWS - Sizing / cash-management decisions where forward return distribution matters more than a point estimate ## What you need - `MASSIVE_API_KEY` (Stocks Starter). One SPY range-aggs call for the full history window (default 20 years). ## What you get back **Layer 1 JSON** matching [`output-schema.json`](./output-schema.json). Current regime feature snapshot (raw + z-scores), the K analogs with distance + forward returns per horizon, forward return distribution stats per horizon (p10, p25, median, p75, p90, mean, hit rate > 0). **Layer 2 rendered note**. Current-regime snapshot block, forward- distribution table across horizons, top-analog date list with per- horizon returns. See [`references/rendering.md`](./references/rendering.md). ## How it works 1. **Fetch SPY** over `history_years` (default 20). 2. **Compute a daily feature panel**: for every day with enough history (>= 260 bars), build a 9-