Key Takeaways: Chapter 19
1. The Backtest-to-Live Gap Is Real and Significant
Backtests systematically overestimate performance due to idealized execution assumptions, clean data, and the absence of market impact. Expect live P&L to be 30-60% lower than backtest P&L. Paper trading narrows the gap but cannot eliminate it. Use a staged deployment process: unit testing, paper trading, small live, then full live.
2. Modular Architecture Is Not Optional
Separate your trading system into distinct components: data feed handler, signal generator, risk manager, order executor, position tracker, and logger. Each component should have a clear interface and be independently testable. An event-driven architecture with a publish-subscribe event bus provides loose coupling and a complete audit trail.
3. API Integration Requires Defensive Programming
Never trust API responses blindly. Validate data freshness, handle every error category differently (authentication failures stop trading; rate limits trigger backoff; timeouts require order-status checks before retrying), and implement circuit breakers to prevent cascading failures.
4. Rate Limiting Is Your Responsibility
Implement client-side rate limiting using the token bucket algorithm. Do not rely on the platform to reject your requests gracefully. Combine rate limiting with exponential backoff retry logic and circuit breakers for a complete reliability stack.
5. Pre-Trade Risk Checks Are Your Last Line of Defense
Every order must pass through automated risk checks before reaching the exchange. Essential checks include: position limits (including pending orders), daily loss limits, order size limits, portfolio exposure limits, price reasonableness, and liquidity constraints. Never bypass risk checks, even "just this once."
6. Account for Pending Orders in Risk Calculations
A common and dangerous bug is checking risk limits only against confirmed positions, ignoring pending (submitted but unfilled) orders. Always calculate worst-case exposure assuming all pending orders fill. This is the "exposure including pending" principle.
7. Execution Quality Is Edge
In thin prediction markets, the difference between good and bad execution determines profitability. Measure slippage, fill rate, latency, and implementation shortfall continuously. Prefer limit orders over market orders. Use order splitting for larger trades. Adapt pricing aggressiveness based on fill rate feedback.
8. Position Tracking Must Be Accurate and Reconciled
Your position tracker is the single source of truth for risk calculations. Every fill must be recorded immediately. Reconcile local positions with exchange records regularly (at least every 5 minutes). Position discrepancies are always high-priority issues.
9. Log Everything in Structured Format
Use structured JSON logging that records every signal, order, fill, risk decision, error, and system event. These logs serve three purposes: real-time debugging, post-trade analysis, and strategy improvement. Log rotation prevents disk exhaustion.
10. Alerts Must Be Prioritized and Rate-Limited
Critical events (trading halted, connection lost, position mismatch) need immediate human attention via intrusive channels (email, SMS). Lower-priority events should be logged but not alerted. Rate-limit alerts to prevent alert fatigue, which is worse than no alerts at all.
11. Correlated Positions Are Concentrated Risk
Five positions in correlated markets is effectively one large position. Define correlation groups proactively and enforce group exposure limits. Detect when multiple correlated positions are losing simultaneously and suppress new signals that would increase exposure to the same factor.
12. Trading Psychology Affects Even Automated Trading
You still make critical decisions: whether to start/stop the bot, whether to change parameters, whether to override signals. FOMO, revenge trading, tilt, and overconfidence affect these decisions. Pre-commit to rules, maintain a decision journal, and impose cooling-off periods after manual interventions.
13. Manual Interventions Usually Have Negative Expected Value
Track every manual override in a decision journal with its outcome. Most traders discover that their interventions lose money on average. The only legitimate reasons to override the bot are: technical failures, stale data, external information the bot cannot access, and risk limit breaches not captured by automated checks.
14. Paper Trading Is Necessary But Not Sufficient
Paper trading validates your data pipeline, signal logic, and system stability. It does not validate execution quality, market impact, or your psychological resilience. Use it as one stage in a multi-stage deployment process. Calibrate your paper trading simulator against actual live execution data.
15. Operational Discipline Is a Daily Practice
Live trading requires daily monitoring, weekly review, and monthly strategy assessment. Maintain a deployment checklist, a disaster recovery plan, secure API key management, and version control for all strategy code. Plan for and practice recovery from common failures: API outages, internet loss, server crashes, and strategy bugs.