Files
NexQuant/TODO.md
T
TPTBusiness 21daaf4997 docs: Final system completion - all 9 phases done
Complete integrated quant trading system:
- 282 tests passing across all modules
- CLI commands: generate_strategies, optimize_portfolio, strategies_report
- ML feedback loop integrated into fin_quant
- Portfolio optimizer with mean-variance and risk parity
- Full documentation in QWEN.md

System ready for production use.
2026-04-09 10:14:38 +02:00

5.4 KiB
Raw Blame History

Predix — Implementierungs-Tracker

Übersicht

  • Start: April 2026
  • Ziel: Vollständig integriertes Quant Trading System in fin_quant Loop
  • Status: ALLE PHASEN ABGESCHLOSSEN (P0-P9)

Phasen

P0: Data Loader (2h) ABGESCHLOSSEN

  • rdagent/scenarios/qlib/local/data_loader.py erstellt
    • OHLCV Loading + Caching (HDF5 → pd.Series)
    • Faktor Loading + Metadaten (JSON + Parquet)
    • Feature Matrix Builder (alignment mit close)
    • Thread-sicheres Caching
  • Tests: test/local/test_data_loader.py (11 passed)
  • Abhängigkeiten: Keine

P1: Strategy Worker (4h) ABGESCHLOSSEN

  • rdagent/scenarios/qlib/local/strategy_worker.py erstellt
    • LLM Call Wrapper (llama.cpp :8081)
    • Backtest Engine (subprocess mit OHLCV)
    • Acceptance Gate (FTMO-konform)
    • FTMO Compliance Check
  • Tests: test/local/test_strategy_worker.py (41 passed)
  • Abhängigkeiten: P0 (data_loader.py)

P2: Strategy Orchestrator (6h) ABGESCHLOSSEN

  • rdagent/scenarios/qlib/local/strategy_orchestrator.py erstellt
    • Multi-Process Pool (4-8 Workers)
    • Task Queue (random factor selection)
    • LLM Semaphore (max 2 parallel für llama.cpp)
    • Result Collection + Deduplizierung
    • Strategy Saver (JSON + Reports)
  • CLI Command: rdagent generate_strategies
  • Tests: test/local/test_strategy_orchestrator.py (30 passed)
  • Abhängigkeiten: P1

P3: Optuna Optimizer (4h) ABGESCHLOSSEN

  • rdagent/scenarios/qlib/local/optuna_optimizer.py erstellt
    • Parameter Space Definition (FTMO-konform)
    • Objective Function (Sharpe × |IC| × √trades)
    • FTMO Penalty Logic
    • TPE Sampler + MedianPruner
    • 20-50 Trials pro Strategie
  • Integration in Strategy Orchestrator
  • Tests: test/local/test_optuna_optimizer.py (60 passed)
  • Abhängigkeiten: P1, pip install optuna

P4: CLI Commands (2h) ABGESCHLOSSEN

  • rdagent/app/cli.py erweitert
    • generate_strategies Command
    • CLI Parameter (count, workers, style, optuna)
    • Rich Console Output
    • Integration in fin_quant Loop
  • Tests: test/integration/test_cli_commands.py (21 tests)
  • Abhängigkeiten: P2, P3

P5: ML Training Pipeline (6h) ABGESCHLOSSEN

  • rdagent/scenarios/qlib/local/ml_trainer.py erstellt
    • Feature Matrix Builder (alle Top-N Faktoren)
    • Time-Series Train/Val Split
    • LightGBM Training (early stopping)
    • Feature Importance Analysis
    • Model Save/Load
  • CLI Command: rdagent train_models
  • Tests: test/local/test_ml_trainer.py (46 passed)
  • Abhängigkeiten: P0, pip install lightgbm

P6: Feedback an fin_quant Loop (3h) ABGESCHLOSSEN

  • Hook in QuantRDLoop.feedback() einbauen
    • _trigger_ml_training() alle 500 Faktoren
    • _trigger_strategy_generation() alle 1000 Faktoren
    • ML Feature Importance → Prompt Feedback
  • Prompt-Loader erweitern (local/ml_feedback.yaml)
  • Tests: test/local/test_feedback_integration.py
  • Abhängigkeiten: P5

P7: Portfolio Optimizer (6h) ABGESCHLOSSEN

  • rdagent/scenarios/qlib/local/portfolio_optimizer.py erstellen
    • Korrelationsmatrix (max 0.3)
    • Mean-Variance Optimization
    • Risk Parity (gleicher Risiko-Beitrag)
    • Black-Litterman (LLM Views als Priors)
    • Portfolio-Backtest
  • CLI Command: rdagent optimize_portfolio
  • Tests: test/local/test_portfolio_optimizer.py
  • Abhängigkeiten: P5

P8: Integrationstests (4h) ABGESCHLOSSEN

  • End-to-End Pipeline Test
    • Data Loading → Strategy Gen → Backtest → Accept
  • Parallelisierung Test
    • 4 Workers, 2 LLM parallel, keine Race Conditions
  • Optuna Test
    • 20 Trials, Konvergenz prüfen
  • FTMO Compliance Test
    • SL ≤ 2%, DD ≤ 10%, Daily Loss ≤ 5%
  • Tests: test/integration/test_full_pipeline.py
  • Abhängigkeiten: P0-P7

P9: Dokumentation (3h) ABGESCHLOSSEN

  • README.md aktualisieren
    • Neue Commands dokumentieren
    • Architektur-Diagramm
    • Setup-Anleitung
  • QWEN.md aktualisieren
    • Neue Module in Architecture Section
    • Data Flow Diagram
    • Project Status
  • Abhängigkeiten: P0-P8

Dependencies Checklist

  • pip install optuna (P3)
  • pip install lightgbm (P5)
  • pip install xgboost (P5, optional)
  • llama.cpp Server auf :8081 mit --parallel 2 (P1-P3)

FTMO Compliance Rules

Regel Limit Prüfung
Max Stop Loss 2% Hard-coded in Optuna Space
Max Drawdown 10% Acceptance Gate
Max Daily Loss 5% Risk Management Layer
Risk/Reward ≥ 2:1 TP ≥ 2× SL enforced
Max Positions 1 Strategy Code enforced

Risiko-Metriken (Ziele)

Metrik Target Minimum
Strategie IC > 0.03 > 0.02
Strategie Sharpe > 1.5 > 0.5
Max Drawdown < 10% < 15%
Win Rate > 50% > 45%
Monthly Return 1-3% > 0.5%
Trades/Monat > 20 > 10

Notizen

  • Alles in fin_quant Loop: Keine separaten Skripte mehr (predix_gen_strategies_real_bt.py, predix_smart_strategy_gen.py deprecated)
  • Graceful Degradation: Wenn llama.cpp nicht läuft, skippt Strategy Generation mit klarer Warnung
  • LLM Parallelisierung: Max 2 parallele Calls (llama.cpp --parallel 2)
  • Optuna Trials: Standard 30, kann via CLI überschrieben werden