
Quant Strategy Monitor for Discord
Your strategy is running on a server. Are you actually watching it?
You deploy a strategy to a VPS and then… you log in twice a day and hope. Did it
fire a signal this morning? Is the process still alive, or did the data feed die
three hours ago and you don't know? How did this week actually go? Most retail
quants find out too late — by scrolling logs after something already went wrong.
Quant Strategy Monitor for Discord puts your live / forward-test strategy
where you already are: Discord. Three things, all pushed to a webhook you own —
no bot, no SaaS, no dashboard to babysit. Verify your webhook in one command
(audit.py --test), then drop three cron lines from examples/ and you're live.
What you get
① Real-time signal alerts
Every entry and exit posts to Discord the instant it fires — colour-coded green
long / red short — and the same call records it to a ledger for the weekly report.
python3 scripts/signal_push.py --side long --symbol ESZ5 --price 5321.5 \
--note "entry" --notify-discord "$SIGNAL_WEBHOOK"
Or straight from inside your strategy: from ledger import log_event.
② A heartbeat — so a dead strategy can't hide
Your strategy stamps "I'm alive" each cycle. The monitor pings you the moment
that heartbeat goes stale — catching a dead feed or a stuck loop even while the
process still looks up. This is the alert that saves you from finding out on
Sunday that you stopped trading on Tuesday.
from heartbeat import stamp
stamp("live-strategy", extra={"signals_today": n}) # every loop / bar / run
# alert if the strategy hasn't stamped in 15 min
*/5 * * * * python3 scripts/audit.py --heartbeats /srv/strat/.health_heartbeats \
--max-age-min 15 --notify-discord "$HEALTH_WEBHOOK"
③ A weekly performance report
Every week, a digest of your ledger lands in a report channel: win rate,
cumulative return, average R, max drawdown, profit factor, expectancy per trade,
average win / loss, win / loss streaks, and a per-symbol breakdown.
0 22 * * 0 python3 scripts/digest.py --ledger forward_ledger.jsonl --window 7 \
--notify-discord "$REPORT_WEBHOOK"
📊 Forward-test weekly digest
Window: last 7 days
Signals: 12 (long 7 / short 5)
Closed: 10 (W 6 / L 4, win rate 60%)
Cumulative return: +4.20% avg R +0.55
Max drawdown: -1.80% Profit factor: 2.10
Expectancy: +0.42% / trade (avg win +1.05% / avg loss -0.52%)
Best / worst: +2.10% / -0.90% Streaks: 3W / 2L
By symbol: ESZ5 6 trades 67% win +3.1% · NQZ5 4 trades 50% win +1.1%
Alerting is de-duplicated — no spam. Running the health check every 10 minutes
does not mean a ping every 10 minutes: you're alerted on a new or changed
problem, or a recovery, and a persistent issue re-reminds at most once per
cooldown. Bursts back off on Discord's 429 rate limit. One --config JSON holds
your three webhooks (signal / health / report) and paths; ready-to-edit samples
live in examples/.
Bonus: a pipeline health audit underneath it all
A strategy that stopped firing might be right (quiet market) or catastrophically
wrong (the cron died, the deploy clobbered a file, a log filled the disk). So the
kit also runs an SRE-style, read-only health audit so a broken pipeline can't
masquerade as "a quiet week":
- silent-cron detection — a scheduled job whose output has gone stale
- systemd failed / inactive units, and Windows scheduled tasks (disabled / failed)
- git hygiene + a committed-secret scan
- UTF-8 BOM shebang faults — the bug that makes
systemdfail withExec format error 203while a manual run still works - unbounded log growth
It also ships the methodology behind a real audit — a four-layer health check
(drift, change-history, data completeness, end-to-end delivery) and a
seven-dimension optimization sweep — for when you want to review the whole system
by hand, not just watch it.
python3 scripts/audit.py --project /srv/my-strategy --notify-discord "$HEALTH_WEBHOOK"
python3 scripts/audit.py --demo # see it find problems on a synthetic tree
What ships
signal_push.py— push a signal/trade to Discord and record it, in one call.heartbeat.py— astamp()your strategy calls + a staleness monitor.ledger.py— an append-only JSONL event log; local, auto-rotating.digest.py— the weekly report (win rate, return, drawdown, profit factor,
expectancy, streaks, per-symbol).audit.py— the pipeline health audit + Discord push with de-dup.notify_discord.py— colour-coded embeds; handles the Cloudflare-403 UA and
429 back-off.alertstate.py/config.py— alert de-dup, and one JSON for your webhooks.examples/— a ready-to-edit config, crontab and sample ledger.- References + a passing test suite — the methodology, and the tool is itself tested.
Boundaries & disclosures
Monitor-only — it makes no trading decisions. It only monitors, records, and
relays signals and outcomes your own system already produced. It does not
generate long/short signals, select instruments, recommend entries or exits, set
stop-loss or target levels, size positions or leverage, decide whether a trade
should happen, or place/modify any order. signal_push.py posts a signal you
pass it — it originates no decision of its own.
Not financial advice. Nothing it outputs is professional financial advice or a
buy/sell recommendation. It makes no performance promises and uses no certainty
language. The weekly digest is descriptive statistics of your own logged, forward-
test results; past performance does not predict future results. Consult a licensed
professional before making financial decisions.
External service + credential. When you configure a Discord webhook, the tool
sends your chosen alerts to Discord, a third-party service — data that (depending
on what you log) may include symbols, prices, direction, returns, win rate,
drawdown, and health/deployment status. No data leaves your host unless you supply
a webhook. A webhook URL is a sensitive credential — keep it out of repos,
logs, and example configs; the tool never echoes it into a report or alert.
Writes + persistent operation. Beyond read-only checks, it writes local files
(the ledger, heartbeat stamps, and an alert-state file) and, when you schedule it
via cron, keeps running and alerting after a single invocation ends. Nothing is
installed on its own. The git secret-scan reports only a file path and credential
type — never the secret value.
What this is not
Not a signal service and not a strategy — it contains no trading logic and
makes no performance claims; it only reports what your strategy does. Not a
monitoring SaaS and not a bot that watches your box 24/7 — it runs from your own
cron. Best on Linux (systemd / cron); on Windows it checks scheduled tasks and the
signal / heartbeat / ledger / digest / git / BOM / log pieces work everywhere.
FAQ
Does anything leave my host? Only what you choose to send to your own Discord
webhook (an external service) — nothing else, and nothing at all if you don't
configure a webhook. There is no telemetry. Health checks are read-only, though the
tool does write local ledger / heartbeat / state files.
Do I need a Discord bot? No — just a webhook URL (Server Settings →
Integrations → Webhooks). No bot, no token, no OAuth.
Does it place trades? No. It watches and reports. It never touches your broker
or your orders.
Which Python? 3.8+, standard library only. pytest is needed only for the tests.


