qabot: dead-man's switch on the loop's event heartbeat

The loop's Telegram notifier runs inside the loop process — loop-down means
alerts-down. The always-up qabot now reads max(events.timestamp) every ~120s
(ET-naive vs ET wall clock per RUNBOOK): stale > DEADMAN_STALE_MIN during
market hours (holiday-aware via runtime.market_calendar) alerts at most every
30 min; DEADMAN_DAILY_PING sends one OK-ping after 20:30 ET. Injected
clock/read/send; 6 unit tests, no network or DB.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
momentum devandClaude Fable 5 committed 2026-07-13 16:37:01 -04:00
1 parent e882658ecb
commit 5b95a9712c
4 files changed
+172 -1

No files matched your search

+4
View File
@@ -46,6 +46,10 @@ DISCORD_DEVELOPER_WEBHOOK_URL=<REDACTED>
# Telegram notifier (bot @traitor_momentum_bot) — gated; no-op if unset
TELEGRAM_BOT_TOKEN=<REDACTED>
TELEGRAM_CHAT_ID='2082795871'
# Dead-man's switch (qabot container): the loop's own notifier dies WITH the
# loop, so the always-up qabot watches max(events.timestamp) from outside.
DEADMAN_STALE_MIN=5 # alert when no events for this many minutes during market hours
DEADMAN_DAILY_PING=1 # nightly OK-ping after 20:30 ET — proves the watchdog itself is alive
#Market Data these are free plans so work within days/months capacity.
Alpha_Vantage_Api_Key=<REDACTED>