Last Updated: 2026-05-03 Owner: Docs-Dev Summary: Prompt for generating a full component-by-component system design document for QuantMatrix.
QuantMatrix System Design Prompt¶
You are a principal systems architect and staff engineer.
I am building a production-grade automated momentum day trading system called QuantMatrix.
Your job is to help me create a complete, implementation-ready system design document, component by component, in a way that is easy for an engineer to understand and build step by step without missing anything.
I want the design to be: - robust - modular - production-oriented - easy to extend - broker-agnostic where possible - suitable for both live trading and backtesting - explicit about failure handling, interfaces, dependencies, and operational concerns
System context: - The platform is an automated momentum day trading system - It has a UI, market-data ingestion, momentum radar, scanner engine, active strategy watchlist, strategy allocator, buy/sell strategy engine, order execution service, global risk manager, account summary, positions, orders, P&L, health monitoring, settings, and backtesting/data download flows - We may use different brokers for market data and execution - We may use Redis for cache/event/state and PostgreSQL for durable records - The system should support paper trading, live trading, and backtesting modes - The system must be easy to implement module by module - The system must store rich trade context and post-trade analytics so we can analyze why each trade made or lost money and generate recommendations for improving future trades
I do NOT want a vague high-level overview. I want a full engineering design package.
Please produce the output in the exact structure below.
- Executive Summary
- Describe the system in plain English
- State key design goals
- State non-goals
-
State architectural principles
-
Full Component Inventory For each component, provide:
- Name
- Purpose
- Responsibilities
- Inputs
- Outputs
- Internal state
- Dependencies
- Failure modes
- Scaling concerns
- Why this component should exist separately
Components to cover at minimum: - UI frontend - API/backend gateway - Account summary service - Momentum Radar service - Momentum snapshot store - Opportunity Scanner Engine - Active Strategy Watchlist manager - Strategy Allocator - Entry Signal Generator - Exit Signal Generator - Order Execution Service - Broker abstraction layer - Market Data abstraction layer - Global Risk Manager - Positions service - Orders service - P&L service - Trade journal and analytics service - Recommendation and insights service - Health monitoring service - Historical data download service - Backtesting engine - Settings/configuration service - Audit/logging service - Notification/alert service - Scheduler/time-sync service
- Technology Recommendation Per Component For each component, recommend:
- Best language/runtime
- Best framework/library
- Best storage choice
- Best communication method
- Best deployment shape
- Why this technology is the best fit
- Alternatives and tradeoffs
- Whether the component should be synchronous, asynchronous, scheduled, or event-driven
Be explicit. Do not just say "use Python" everywhere unless justified.
- Data Flow Design Describe end-to-end flows in detail:
- market data -> radar -> snapshot store -> scanner -> watchlist
- watchlist -> strategy allocator -> buy strategy -> order execution
- filled order -> sell strategy -> exit -> closed trade
- closed trade -> trade journal -> analytics -> recommendation generation
- broker account -> account summary -> UI
- historical data download -> backtesting engine
- settings changes -> runtime behavior
- risk rule breach -> halt/override flow
- emergency liquidate flow
For each flow include: - triggering event - sequence of components - state changes - persistence points - retries - idempotency requirements - monitoring points
- Interface Contracts For each component define:
- API endpoints or function signatures
- request and response schema
- event schema
- Redis key design if relevant
- database schema if relevant
- ownership boundaries
- validation rules
For trade analytics specifically, define how to capture and expose: - strategy used - entry setup conditions - exit trigger conditions - key technical indicators at entry and exit - slippage and execution quality - hold duration - realized P&L and MFE/MAE - market regime or session context - free-form notes or machine-generated explanations - recommendation outputs for future strategy tuning
Make this precise enough that multiple engineers could implement independently.
- Storage Design Recommend what should live in:
- Redis
- PostgreSQL
- in-memory only
- object/file storage if needed
For each entity explain: - why it belongs there - retention policy - indexing/query pattern - consistency requirement - whether it is source of truth or cache
Be explicit about storage for: - raw trade events - normalized completed trades - per-trade feature vectors - trade outcome labels - derived analytics summaries - recommendation history
- Reliability and Failure Handling For each component explain:
- what can fail
- how failure is detected
- retry strategy
- timeout strategy
- fallback behavior
- alerting behavior
- what should be persisted before recovery
-
what must be idempotent
-
Security and Compliance Considerations Cover:
- secrets handling
- broker API key management
- audit trails
- access control
- operational safety
- accidental trade prevention
- environment separation between dev, paper, and live
-
privacy and governance for trade analytics, including how recommendation logic is versioned and auditable
-
Step-by-Step Build Plan Break implementation into phases. For each phase include:
- goal
- components to build
- dependencies
- acceptance criteria
- risks
- what should be mocked first
- what should be productionized later
The plan should let me build the system cleanly without skipping hidden prerequisites.
- Test Strategy For each component define:
- unit tests
- integration tests
- simulation tests
- failure tests
- end-to-end tests
- backtesting validation
- paper trading validation
- production-readiness checks
-
analytics correctness validation, including whether trade explanations and recommendations are reproducible from stored trade data
-
Open Decisions and Tradeoffs List unresolved architecture decisions and give 2-3 options with pros/cons.
-
Final Deliverables At the end, produce:
- a system module map
- implementation order
- dependency graph
- minimum viable version
- production-ready version
- recommended first milestone
- a dedicated trade analytics architecture showing how the system learns from previous trades and turns that into actionable recommendations
Important rules: - Be concrete, not generic - Be explicit about component boundaries - Avoid hand-wavy descriptions - Prefer modular architecture over monolith unless justified - Prefer designs that are easy to build incrementally - Assume a small engineering team that wants maintainability - If a component should be split further, say so - If a component should not exist yet, say so - If one technology is risky, call it out clearly - Include tables where useful - Include diagrams in Mermaid when useful
Recommended usage: 1. Pass 1: architecture only 2. Pass 2: interfaces, schemas, Redis keys, DB contracts 3. Pass 3: build plan, testing, operations, dependency order