# quant-trader-service Clean P0 rebuild of the Trader-style strategy service. ## Scope This implementation follows the desktop design documents in `/Users/zach/Desktop/app/trader`: - `00-操盘手Trader新策略服务概要设计-20260622.md` - `03-Trader服务详细设计说明书-20260623.md` P0 keeps the service in replay/shadow preparation mode: - no real trading - no old V3 `latest/promoted` path - no `SCALE_IN` action surface - no real App feedback by default - no model training that can control live size ## Implemented P0 Surface - Spring Boot P0 service under `com.quantai.trader` - Playbook YAML loading, validation, normalized JSON, SHA-256 definition hash - MySQL 8 Flyway DDL for the P0 trader tables - Core domain records for cycles, actions, entry plans, risk, evidence, feedback, samples, and reports - State-machine guardrails for initial entry, planned legs, and management actions - Dynamic position sizing from signal, execution quality, and risk scores - Risk gate that records every allow/block decision - Evidence appender and proxy-only training sample exporter - Async replay-run registry and report contract - MyBatis-Plus repositories aligned with `quant-app-server` - Deterministic JSONL replay fixtures for accepted, rejected, blocked, and hard-fail paths - Feedback endpoint that returns `TRADER_FEEDBACK_DISABLED` unless explicitly enabled - Focused unit and MVC tests ## Commands ```bash mvn test mvn spring-boot:run ``` The service uses MySQL through MyBatis-Plus. Configure the database with `TRADER_DB_URL`, `TRADER_DB_USERNAME`, and `TRADER_DB_PASSWORD` when the local defaults are not available. Replay acceptance fixtures live under `src/test/resources/replay-fixtures`. They are deterministic P0 contract samples, not a profitability backtest corpus. ## HTTP ```text GET /api/trader/health GET /api/trader/playbooks GET /api/trader/playbooks/{playbookId} POST /api/trader/replay/runs GET /api/trader/replay/runs/{runId} POST /api/trader/replay/runs/{runId}/cancel GET /api/trader/replay/runs/{runId}/report POST /api/trader/feedback ``` Remark: `/api/trader/feedback` is intentionally disabled in P0 unless `trader.integration.http-feedback-enabled=true`.