← ClaudeAtlas

change-point-detectorlisted

Bayesian Online Change-Point Detection (BOCPD) on a ticker's daily log returns. Detects points in time where the return-generating distribution changed (regime shift in mean, vol, or both), reports the confidence at each detected boundary, and emits per-segment statistics (annualized return, annualized vol) so the reader can see what changed. Uses Adams and MacKay (2007) BOCPD with a Normal-Gamma prior on (mu, tau) and a Student-t predictive so hyperparameters update in closed form. Requires Stocks Basic. Runs on the free tier.
rgourley/quant-garage · ★ 6 · Data & Documents · score 66
Install: claude install-skill rgourley/quant-garage
# change-point-detector You hand over a ticker. The skill pulls 2 years of daily closes, computes log returns, and runs Bayesian Online Change-Point Detection. Reports the specific dates where the return distribution appears to have shifted, the confidence at each boundary, and the annualized return + vol per segment so you can see what changed. ## When to invoke - "When did SPY's regime shift this cycle?" - Sharpening `market-regime` when the rule buckets miss the edge - Auditing a pairs-scanner result: "did this pair's cointegration break, and if so when?" - Post-hoc labeling on a name that behaved differently pre- and post-a specific event Not for: real-time entries. BOCPD lags real change points by 5-20 observations; the algorithm needs enough post-shift data to update the posterior. ## What you need - A ticker (`--ticker`) - `MASSIVE_API_KEY` exported - Stocks Basic minimum Optional: - `--lookback-days` (default 504, ~2 years). Minimum 100. - `--lambda-run` (default 250): prior mean run length between change points in observations. 250 = "expect roughly one change per year." Raise to 500 to suppress smaller regime edges; lower to 100 to be more sensitive to short-lived regimes. ## What you get back Two output layers from one run. **Layer 1: canonical JSON**. `change_points` with per-detection date, index, and posterior confidence. `segments` with per-segment n_obs, mean/std daily return, and annualized return + vol. `current_run_length_obs` for how m