Last Updated: 2026-05-03 Owner: Docs-Dev Summary: Prompt for converting the architecture design into implementation-ready module definitions, schemas, and build details.
QuantMatrix Implementation Specification Prompt¶
You are a principal engineer writing an implementation specification for a production-grade automated momentum day trading platform called QuantMatrix.
I already have a system design document. Your job now is to transform that design into a build-ready implementation specification that engineers can execute module by module without ambiguity.
The output must be: - concrete - implementation-oriented - explicit about boundaries - explicit about files, modules, APIs, schemas, and configs - suitable for phased delivery by a small engineering team
Do not rewrite the design document at a high level. Convert it into an engineering execution specification.
Assume the system includes: - UI frontend - backend API - market data ingestion - momentum radar - opportunity scanner - active strategy watchlist - strategy allocator - entry strategies - exit strategies - order execution service - broker abstraction - account summary service - positions service - orders service - P&L service - trade journal and analytics - recommendation and insights engine - global risk manager - health monitoring - settings/configuration - historical data download - backtesting - Redis - PostgreSQL
Please produce the output in the exact structure below.
- Implementation Scope
- What this implementation spec covers
- What it assumes from the design doc
-
What is intentionally deferred
-
Target Repository Structure Provide a proposed repo layout down to major directories and important files.
For each directory/file explain: - purpose - ownership - dependency direction
Include at minimum: - frontend app structure - backend app structure - domain modules - broker adapters - data modules - risk modules - strategy modules - scheduler/jobs - tests - infra/config - migrations - docs
- Module-by-Module Build Specification For each module define:
- module name
- purpose
- exact responsibilities
- what it must not do
- inputs
- outputs
- internal models
- public interfaces
- external dependencies
- persistence needs
- error handling expectations
-
observability requirements
-
File-Level Responsibilities For each major module, specify:
- expected files/classes/functions
- what each file should contain
- what should be kept separate
- what should be mocked in early versions
Do this in a way that an engineer can create the files directly.
- API Specification Define all required APIs in implementation detail:
- endpoint path
- method
- purpose
- request schema
- response schema
- validation rules
- auth expectations
- failure responses
Cover: - dashboard/account summary - momentum radar - watchlist actions - positions - orders - trade analytics and recommendations - risk/health - settings - historical data download - backtesting - emergency controls
- Redis Specification Define:
- key naming conventions
- streams
- hashes
- sorted sets
- expiration policy
- ownership of keys
- read/write patterns
Include exact examples for: - market data cache - momentum radar minute snapshots - blocked symbols - watchlist state if cached - position cache if used - risk state - health state - idempotency keys
- PostgreSQL Specification Define:
- tables
- columns
- indexes
- constraints
- retention policy
- source-of-truth vs derived tables
Include exact tables for: - orders - executions - trades - trade_features - trade_outcomes - trade_notes_or_explanations - recommendation_history - pnl snapshots - active_watchlist if retained - audit logs - settings overrides if persisted - optional archival of radar snapshots if needed
- Event and Message Contracts Define exact payloads for:
- market tick
- top gainer scan result
- watchlist candidate
- strategy assignment
- buy signal
- sell signal
- order command
- order ack
- fill event
- risk violation
- emergency halt event
- health event
Use JSON examples.
Also define payloads for: - trade_closed - trade_analysis_requested - trade_analysis_completed - recommendation_generated
- Configuration Specification List every environment variable and runtime setting:
- name
- type
- default
- required or optional
- which module uses it
- safety notes
Separate: - local dev - paper trading - live trading - backtesting
Include configuration for: - analytics retention windows - feature extraction toggles - recommendation generation mode - explanation model or rules engine version if used
- Build Order Provide exact implementation order.
For each step include: - modules to create - dependencies - required mocks - acceptance criteria - tests required before moving on
- Testing Specification Define:
- unit test targets
- integration test targets
- fixture strategy
- broker mocking strategy
- Redis test strategy
- DB migration test strategy
- end-to-end workflow tests
- backtest correctness checks
-
paper trading validation checklist
-
Operational Specification Define:
- startup sequence
- shutdown sequence
- health checks
- alert conditions
- retry and backoff behavior
- emergency liquidation behavior
- reconciliation jobs
- stale strategy handling
- scanner timing behavior
- trade analytics batch or streaming workflow
-
recommendation refresh cadence
-
Engineering Checklist Provide a checklist for each module that answers:
- implemented
- tested
- observable
- failure-safe
- idempotent
- documented
-
analytically useful for post-trade review
-
Final Output At the end provide:
- MVP implementation set
- Phase 2 implementation set
- Production hardening set
- Top 10 hidden risks during implementation
- Recommended first coding milestone
The implementation spec must explicitly define how to capture, store, and analyze the full context of every trade so that we can answer: - Why was this trade entered? - Why was it exited? - Which conditions were present in winning vs losing trades? - Which strategies, symbols, times of day, and market conditions perform best or worst? - What concrete recommendations should be generated from historical trades to improve future performance?
For the trade analytics module, require: - exact schemas - feature extraction points - storage of indicator values at entry and exit - outcome labeling - query patterns for review dashboards - recommendation generation workflow - rules for auditability and reproducibility
Important rules: - Be specific, not high-level - Prefer explicit file/module boundaries - Avoid vague “service layer” language unless fully defined - If a module should not be built yet, say so clearly - If one module depends on another, state it directly - If an API or schema is uncertain, list assumptions and recommended defaults - Optimize for step-by-step execution with minimal rework
After producing the full implementation specification, also provide: 1. A dependency graph in Mermaid 2. A module delivery checklist 3. A “build this first” starter set for the first sprint