V5 Trading System — Design and Roadmap Goal ---- Build a production-ready V5 trading system for XAUUSD that is robust to market costs and suitable for live paper/live trading. Focus on risk controls, walk-forward validation, realistic fills, and a live inference API. Key Requirements ---------------- - Realistic backtests with slippage, commissions, partial fills, and order types - Walk-forward training & validation to reduce overfitting - Modular model artifacts: tree-only + Keras artifacts (same as V4) but with versioning - Live inference API with strict risk manager, position sizing, and circuit-breakers - Paper-trade adapter to test on real exchange simulator/broker sandbox - Monitoring & alerting (P&L, drawdown, latency, model drift) Milestones ---------- 1. V5 spec + scaffolding (this doc + FastAPI scaffold) 2. Realistic backtester improvements 3. Walk-forward validation pipeline 4. Ensemble retrain with robust techniques 5. Live inference + paper-trade adapter 6. Monitoring, HF model card, and deployment Acceptance Criteria ------------------- - Backtest Sharpe > target (configurable) on OOS sets with realistic costs - Max drawdown within risk budget - Live inference latency < 100ms per request (p95) on target hardware - Automated rollback on model drift or large drawdown Notes ----- Start from existing V4 codebase for feature engineering and model saving. Reuse safe serialization approach. Incrementally add safety features and validate each milestone with tests.