From 7fdcac3b55dea25912114618d833866f66c399cc Mon Sep 17 00:00:00 2001 From: Dennis Thiessen Date: Fri, 7 Aug 2026 22:51:49 +0200 Subject: [PATCH] docs: carry the risk-monitor wording through docs, comments and logs Follows 5ea0785, which renamed the user-visible labels. This finishes the pass so code, docs and operator output use one vocabulary: README (pipeline list, route table, FRED row), the methodology doc title, .env.example and config comments, the snapshot model / event-study / service / test docstrings, the scheduler section headers and morning-pipeline docstring, the TopBar status text ("bullish regime" -> "bullish trend"), and the four "Regime monitor:" log prefixes. Deliberately NOT changed, because "market regime" is also a standard finance term and most occurrences are not this job: the backtest caveat "~6 months is roughly one market regime" in backtest_service, README, BacktestPanel and every generated reports/*.json; "a regime shift" in TrackRecordPanel; and the capacity-bracket findings doc. Renaming those would have made the text wrong. Also unchanged, being persisted or externally linked rather than wording: the regime_monitor / market_regime job ids, the regime_quadrant_enabled setting key, the /regime route, METHODOLOGY and the snapshot fields, the service/test module filenames, and docs/research/regime-monitor-v3.md's path (referenced from commit messages). The doc now carries a one-line note recording the old name and why those identifiers still use it. Co-Authored-By: Claude Opus 5 --- .env.example | 2 +- README.md | 8 ++++---- app/config.py | 2 +- app/models/regime_snapshot.py | 2 +- app/scheduler.py | 6 +++--- app/services/event_study_service.py | 2 +- app/services/regime_monitor_service.py | 10 +++++----- docs/research/regime-monitor-v3.md | 8 ++++++-- frontend/src/components/layout/TopBar.tsx | 4 ++-- frontend/src/lib/regime.ts | 2 +- tests/unit/test_regime_monitor.py | 2 +- 11 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.env.example b/.env.example index ed303b4..b9892d5 100644 --- a/.env.example +++ b/.env.example @@ -45,7 +45,7 @@ SEC_REQUEST_SPACING_SECONDS=0.2 SEC_MAX_RETRIES=4 SEC_REQUEST_TIMEOUT_SECONDS=30.0 -# Regime Monitor — FRED (VIX + HY credit spreads). Free key: https://fred.stlouisfed.org/docs/api/api_key.html +# AI/Tech Risk Monitor — FRED (VIX + HY credit spreads). Free key: https://fred.stlouisfed.org/docs/api/api_key.html # Optional: without it the volatility (V1) and credit (C1) pillars show as n/a. FRED_API_KEY= diff --git a/README.md b/README.md index e11da7b..32e571f 100644 --- a/README.md +++ b/README.md @@ -133,8 +133,8 @@ indicators. 1. **OHLCV** — latest daily bars (Alpaca); new tickers backfill ~5 years. 2. **Sentiment** — stale names that matter (top-pick feeders, watchlist, open paper, discovery net). Display context only; the activation gate is price-only. -3. **Market Regime** + **Regime Monitor** — breadth/trend and the v3 risk thermometer; feed no trades. -4. **Telegram alerts** — change-driven (regime-quadrant etc.); quiet days stay quiet. Setup alerts still fire on the near-close pipeline after the scan. +3. **Market Trend (SPY)** + **AI/Tech Risk Monitor** — the SPY trend guard and the v3 risk thermometer; feed no trades. +4. **Telegram alerts** — change-driven (risk-quadrant etc.); quiet days stay quiet. Setup alerts still fire on the near-close pipeline after the scan. **Near-close** (~15:30 ET Mon–Fri) — the only full-universe qualifying observation: @@ -351,7 +351,7 @@ Corollaries: never let an unvalidated score gate setups; the outcome evaluator m | `/` | Dashboard — top setups, open trades, regime (default) | Authenticated | | `/market` | Market — watchlist + rankings tabs | Authenticated | | `/signals` | Signals — scanner + track record tabs | Authenticated | -| `/regime` | Market Regime | Authenticated | +| `/regime` | AI/Tech Risk Monitor | Authenticated | | `/ticker/:symbol` | Ticker Detail | Authenticated | | `/admin` | Admin Panel | Admin only | @@ -583,7 +583,7 @@ Configure in `.env` (copy from `.env.example`): | `OPENAI_API_KEY` | For sentiment (OpenAI path) | — | OpenAI API key | | `OPENAI_MODEL` | No | `gpt-4o-mini` | OpenAI model name | | `OPENAI_SENTIMENT_BATCH_SIZE` | No | `5` | Micro-batch size for sentiment collector | -| `FRED_API_KEY` | Optional (regime) | — | FRED key for the regime monitor (VIX, credit spreads) | +| `FRED_API_KEY` | Optional (risk monitor) | — | FRED key for the AI/Tech risk monitor (VIX, credit spreads) | | `TELEGRAM_BOT_TOKEN` | Optional (alerts) | — | Telegram bot token for alerts (can also be set in Admin) | | `TELEGRAM_CHAT_ID` | Optional (alerts) | — | Telegram chat id for alerts | | `DATA_COLLECTOR_FREQUENCY` | No | `daily` | OHLCV collection schedule (legacy — see note below) | diff --git a/app/config.py b/app/config.py index d1fb81e..3b7733a 100644 --- a/app/config.py +++ b/app/config.py @@ -52,7 +52,7 @@ class Settings(BaseSettings): sec_max_retries: int = 4 sec_request_timeout_seconds: float = 30.0 - # Regime Monitor — FRED (VIX level + HY credit spreads). Optional: without it + # AI/Tech Risk Monitor — FRED (VIX level + HY credit spreads). Optional: without it # the volatility (P5) and credit-spread (F2) signals are reported as n/a. fred_api_key: str = "" diff --git a/app/models/regime_snapshot.py b/app/models/regime_snapshot.py index 2afbf0b..8795b3a 100644 --- a/app/models/regime_snapshot.py +++ b/app/models/regime_snapshot.py @@ -8,7 +8,7 @@ from app.database import Base class RegimeSnapshot(Base): - """Daily point-in-time snapshot of the AI/Tech Regime Monitor. + """Daily point-in-time snapshot of the AI/Tech Risk Monitor. One row per calendar date (unique). ``breakdown_json`` holds the full ``breakdown_json`` is authoritative for v2 State, Warning, source dates, diff --git a/app/scheduler.py b/app/scheduler.py index 16efaa3..d201b06 100644 --- a/app/scheduler.py +++ b/app/scheduler.py @@ -1057,7 +1057,7 @@ async def dispatch_alerts_job() -> None: # --------------------------------------------------------------------------- -# Job: Market Regime +# Job: Market Trend (SPY) # --------------------------------------------------------------------------- @@ -1116,7 +1116,7 @@ async def collect_benchmark() -> None: # --------------------------------------------------------------------------- -# Job: Regime Monitor +# Job: AI/Tech Risk Monitor # --------------------------------------------------------------------------- @@ -1396,7 +1396,7 @@ async def _run_pipeline(job_name: str, steps: list[tuple[str, str]]) -> None: async def run_daily_pipeline() -> None: - """Morning flow: OHLCV → benchmark → sentiment → market regime (no scan).""" + """Morning flow: OHLCV → benchmark → sentiment → trend/risk (no scan).""" await _run_pipeline("daily_pipeline", _DAILY_PIPELINE_STEPS) diff --git a/app/services/event_study_service.py b/app/services/event_study_service.py index a57f6c7..5cc6dd6 100644 --- a/app/services/event_study_service.py +++ b/app/services/event_study_service.py @@ -1,4 +1,4 @@ -"""Compact chronological validation for the Regime Monitor warning score. +"""Compact chronological validation for the AI/Tech Risk Monitor warning score. The study calls its outcome a 10% correction, uses the first 70% of sessions to freeze an 80th-percentile warning threshold, and reports alarm episodes only on diff --git a/app/services/regime_monitor_service.py b/app/services/regime_monitor_service.py index 48a3751..4111c9a 100644 --- a/app/services/regime_monitor_service.py +++ b/app/services/regime_monitor_service.py @@ -1,4 +1,4 @@ -"""AI/Tech Regime Monitor v3. +"""AI/Tech Risk Monitor v3. The monitor is a risk thermometer, not a probability or trading rule. It keeps two deliberately separate outputs: @@ -918,7 +918,7 @@ async def _fetch_prices(config: dict, start: date, end: date) -> dict[str, Serie bars = await provider.fetch_ohlcv(symbol, start, end) out[symbol] = sorted(((b.date, float(b.close)) for b in bars), key=lambda item: item[0]) except Exception as exc: - logger.warning("Regime monitor: price fetch failed for %s: %s", symbol, exc) + logger.warning("Risk monitor: price fetch failed for %s: %s", symbol, exc) return out @@ -941,7 +941,7 @@ async def _fetch_fred_series(series_id: str, start: date, end: date) -> Series | response.raise_for_status() payload = response.json() except Exception as exc: - logger.warning("Regime monitor: FRED fetch failed for %s: %s", series_id, exc) + logger.warning("Risk monitor: FRED fetch failed for %s: %s", series_id, exc) return None out: Series = [] @@ -1026,7 +1026,7 @@ async def update_regime_monitor( try: overrides = await refresh_fundamental_overrides(db, config=config) except Exception as exc: - logger.warning("Regime monitor: fundamentals refresh skipped: %s", exc) + logger.warning("Risk monitor: fundamentals refresh skipped: %s", exc) end = date.today() prices = await _fetch_prices(config, end - timedelta(days=1200), end) @@ -1050,7 +1050,7 @@ async def update_regime_monitor( ) divergence = breadth_service.compute_divergence_series(breadth, leader_series) except Exception as exc: - logger.warning("Regime monitor: fixed-basket breadth skipped: %s", exc) + logger.warning("Risk monitor: fixed-basket breadth skipped: %s", exc) breadth, breadth_counts, divergence = {}, {}, {} latest_snapshot = await _latest_snapshot_row(db) diff --git a/docs/research/regime-monitor-v3.md b/docs/research/regime-monitor-v3.md index bedff55..7362056 100644 --- a/docs/research/regime-monitor-v3.md +++ b/docs/research/regime-monitor-v3.md @@ -1,6 +1,10 @@ -# Regime Monitor v3 methodology +# AI/Tech Risk Monitor v3 methodology -The Regime Monitor is an observational AI/Tech risk thermometer. It does not +Named "Regime Monitor" until 2026-08-07; the filename, the `regime_monitor` job +id, the `/regime` route and the `METHODOLOGY`/snapshot fields keep the old word, +because those are persisted or externally linked. Only the wording changed. + +The AI/Tech Risk Monitor is an observational risk thermometer. It does not gate entries, exits, position size, ranking, or alerts about individual setups. v3 supersedes v2. Every parameter below was calibrated against the 408 v2 diff --git a/frontend/src/components/layout/TopBar.tsx b/frontend/src/components/layout/TopBar.tsx index 479bea6..3ee6fd4 100644 --- a/frontend/src/components/layout/TopBar.tsx +++ b/frontend/src/components/layout/TopBar.tsx @@ -85,7 +85,7 @@ export default function TopBar() {
- {/* Market regime — ambient status; the full picture lives on /regime */} + {/* SPY trend — ambient status; the full picture lives on /regime */} {regime.data && ( - {regime.data.label} regime + {regime.data.label} trend )} diff --git a/frontend/src/lib/regime.ts b/frontend/src/lib/regime.ts index 647cd1a..9849da7 100644 --- a/frontend/src/lib/regime.ts +++ b/frontend/src/lib/regime.ts @@ -36,7 +36,7 @@ export function regimeHeadline(r: MarketRegime): string { return `${b} ${r.label}${pct}`; } -/** Whether a setup direction fights the prevailing market regime. */ +/** Whether a setup direction fights the prevailing SPY trend. */ export function isCounterTrend(direction: string, label: MarketRegime['label']): boolean { if (label === 'bullish') return direction === 'short'; if (label === 'bearish') return direction === 'long'; diff --git a/tests/unit/test_regime_monitor.py b/tests/unit/test_regime_monitor.py index 75483ab..ed164be 100644 --- a/tests/unit/test_regime_monitor.py +++ b/tests/unit/test_regime_monitor.py @@ -1,4 +1,4 @@ -"""Pure-function tests for the v3 Regime Monitor contract.""" +"""Pure-function tests for the v3 AI/Tech Risk Monitor contract.""" from __future__ import annotations