historical-analog-finderlisted
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-