BANGER
Product status: Banger’s public beta is paper-only. References to live execution are future-looking. Venue rules and legal claims can change; verify current primary sources for your jurisdiction.
2026-08-10 · 6 min read · facts as of 2026-08-10

Monitoring a Trading Bot: Logs, Metrics, and Alerts

A trading bot fails quietly. It does not crash with a stack trace on your screen. It keeps running, keeps sending orders, and keeps losing money while you sleep. The gap between a strategy that survives and one that blows up is usually not the alpha. It is whether you noticed the bot was broken in time to stop it.

This post covers what to log, what to measure, and what to alert on for an automated prediction-market strategy running against a live order book. The examples lean toward Polymarket and Kalshi, but the discipline is venue-agnostic.

Three layers, three questions

Split observability into logs, metrics, and alerts because each answers a different question at a different time.

If you only build one thing first, build metrics and one drawdown alert. Logs help you understand a loss after it happens. An alert helps you prevent it from getting worse.

What to log

Log in a structured, machine-readable format rather than free-form text.

Structured logging means emitting each event as discrete key-value fields, usually JSON, instead of a sentence. The value is concrete: you can filter and aggregate by field instead of writing brittle regex against a message string. A useful pattern is JSON in production and human-readable text in development, which most logging libraries support through output formatters using the same log statements.

For a trading bot, log an event at every decision boundary. At minimum:

Keep field names consistent across every log line. Do not write market_id in one place and marketId in another, because inconsistency defeats the entire point of structured logs. Use UTC ISO-8601 timestamps from a synced clock so you can line up your log with the venue's fill timestamps. And never log venue API keys or secrets.

Attach a correlation ID to every log line tied to a single order lifecycle. When a fill comes back at a price you did not expect, one ID lets you pull the signal, the risk check, the submission, and the ack in a single query.

What to measure

Google's SRE book defines four golden signals for any user-facing system: latency, traffic, errors, and saturation. If you can only measure four things about a service, measure those. They translate cleanly to a trading bot, and you layer trading-specific metrics on top.

The infrastructure signals, adapted:

The trading-specific metrics are the ones that actually protect capital:

What to alert on

Good alerts are rare and actionable. If an alert fires and you do nothing, delete it. The goal is to nag a human only when a problem is real and ongoing, not for every transient blip.

The alerts worth waking up for:

Every hard limit should have an automated response, not just a notification. A daily loss stop that only sends a text is not a stop. The bot should flatten or halt on its own, and the alert tells you it happened.

Alerts are not a substitute for a kill switch

Monitoring tells you something is wrong. It does not fix anything. The layer that actually protects capital is a risk envelope that the strategy cannot override: a per-trade cap, a daily loss stop, a maximum open-position count, and a kill switch that halts trading when a limit trips.

This is the model Banger enforces. You write your strategy as a Python class, but the risk envelope is declarative and sits outside your strategy code, so a bug in the strategy cannot spend past its cap. Before any of it touches real money, you paper-trade against the live order book to see how the strategy and its alerts behave under real conditions. Banger never holds your funds; you connect your own venue keys.

# Paper-trade against the live book first, then watch your metrics before going live
pip install bangertrades
banger run strategy.py --paper

The order matters. Instrument the strategy, run it on paper until the metrics and alerts prove they behave, then go live with a hard risk envelope underneath. Logs explain the loss after the fact. Metrics show it building. The kill switch is what keeps a bad afternoon from becoming a bad month.

Sources

Keep reading

Run your first strategy free

Paper-trade on Polymarket and Kalshi market data without venue keys.

Start free