From a71dd4adb7681a6fd0dd6fa6cbccaeb08ccc8120 Mon Sep 17 00:00:00 2001 From: Dennis Thiessen Date: Sat, 18 Jul 2026 18:00:00 +0200 Subject: [PATCH] fix: chain morning alerts for regime Telegram delivery Regime is computed at 02:00 ET; without a morning alert pass, quadrant changes waited until 15:30. Dispatcher is change-driven so quiet days stay quiet. Drop unused alerts_frequency config. --- README.md | 1 + app/config.py | 4 ++-- app/scheduler.py | 4 ++++ frontend/src/components/admin/ScheduleSettings.tsx | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c681d06..2e3b901 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ 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 v2 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. **Near-close** (~15:30 ET Mon–Fri) — the only full-universe qualifying observation: diff --git a/app/config.py b/app/config.py index 7d9ca21..b9f64b9 100644 --- a/app/config.py +++ b/app/config.py @@ -59,8 +59,8 @@ class Settings(BaseSettings): sentiment_fresh_hours: int = 120 sentiment_top_composite: int = 30 fundamental_fetch_frequency: str = "weekly" # quarterly-ish data; weekly conserves API quota - rr_scan_frequency: str = "daily" - alerts_frequency: str = "hourly" + rr_scan_frequency: str = "daily" # legacy label; qualifying scan is cron near-close + # alerts_frequency removed: alerts fire only via morning + near-close pipelines fundamental_rate_limit_retries: int = 3 fundamental_rate_limit_backoff_seconds: int = 15 # Pause between tickers in the bulk fundamentals job. Free tiers throttle diff --git a/app/scheduler.py b/app/scheduler.py index 9500bed..94aeb27 100644 --- a/app/scheduler.py +++ b/app/scheduler.py @@ -1190,6 +1190,10 @@ _DAILY_PIPELINE_STEPS = [ ("market_regime", "compute_market_regime"), # Observational only — display/alerts; not trade selection. ("regime_monitor", "compute_regime_monitor"), + # Alerts after regime so quadrant changes reach Telegram in the morning. + # Dispatcher is change-driven; quiet days stay quiet. Setup alerts still + # fire on the near-close pipeline after the qualifying scan. + ("alerts", "dispatch_alerts_job"), ] # Near-close (~15:30 ET Mon–Fri): refresh in-progress day-t bars (already how diff --git a/frontend/src/components/admin/ScheduleSettings.tsx b/frontend/src/components/admin/ScheduleSettings.tsx index eef445b..c2bc3a9 100644 --- a/frontend/src/components/admin/ScheduleSettings.tsx +++ b/frontend/src/components/admin/ScheduleSettings.tsx @@ -21,7 +21,7 @@ const FIELDS: { key: keyof ScheduleConfig; label: string; hint: string; mono?: b { key: 'schedule_daily_pipeline_cron', label: 'Morning pipeline', - hint: 'OHLCV → benchmark → sentiment → regime (no R:R scan). Default 02:00 ET.', + hint: 'OHLCV → benchmark → sentiment → regime → alerts (no R:R scan). Default 02:00 ET so regime-quadrant changes hit Telegram in the morning.', mono: true, }, {