Commit Graph

5 Commits

Author SHA1 Message Date
Adrian Flores Cortes
a1e606c21a [GAP-3] feat: Wire RRBacktester into prediction service and API
- Added RRBacktester import and initialization in PredictionService
- Added BacktestSummary dataclass for typed responses
- Added run_backtest() method with signal generation
- Added _generate_backtest_signals() helper for historical signals
- Added backtester_available property
- Updated POST /api/backtest endpoint to use real backtester
- Added GET /api/backtest/status endpoint for availability check
- Added losing_trades, avg_trade_duration, metrics_by_rr, metrics_by_amd to response

The backtester now uses:
- RRBacktester from src/backtesting/rr_backtester.py
- MetricsCalculator from src/backtesting/metrics.py
- AMD phase filtering and R:R configuration support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 07:13:26 -06:00
Adrian Flores Cortes
a22fb11968 [GAP-2] feat: Wire HierarchicalPipeline into prediction service
- Added HierarchicalPipeline initialization in PredictionService._load_models()
- Added HierarchicalResult dataclass for typed responses
- Added get_hierarchical_prediction() method for full L0→L1→L2 predictions
- Added get_hierarchical_model_info() method for model introspection
- Added hierarchical_available property
- Added API endpoints:
  - GET /api/hierarchical/{symbol} - Full 3-level prediction
  - GET /api/hierarchical/{symbol}/models - Model info per symbol
  - GET /api/hierarchical/status - Pipeline status
- Updated health endpoint to include hierarchical_available flag

This completes GAP #2: L1→L2 Hierarchical Predictor integration.
The pipeline now uses symbol-specific metamodels (XGBoost or Neural Gating)
to synthesize 5m and 15m base model predictions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 07:05:59 -06:00
Adrian Flores Cortes
b0b4a712eb feat: Integrate Level 0 attention models into prediction pipeline
- Add AttentionProvider service to load and serve attention scores
- Integrate attention scoring into PredictionService.generate_signal()
- Add AttentionInfo dataclass to TradingSignal
- Boost confidence by 15% when high flow detected
- Add /api/attention/{symbol} endpoint for direct attention queries
- Add /api/attention/models endpoint to list loaded models
- Add attention field to SignalResponse API model

This completes the L0→L1 integration of the hierarchical ML architecture.
Attention models identify high-flow market moments to improve signal quality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:57:59 -06:00
Adrian Flores Cortes
475e913e3c config: Deprecate MySQL and update PostgreSQL credentials
- PostgreSQL credentials updated to trading_user/trading_dev_2026
- MySQL section marked as deprecated (remote server no longer accessible)
- Table mappings updated to use market_data PostgreSQL schema
- Password redacted from deprecated MySQL config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 05:52:50 -06:00
75c4d07690 feat: Initial commit - ML Engine codebase
Hierarchical ML Pipeline for trading predictions:
- Level 0: Attention Models (volatility/flow classification)
- Level 1: Base Models (XGBoost per symbol/timeframe)
- Level 2: Metamodels (XGBoost Stacking + Neural Gating)

Key components:
- src/pipelines/hierarchical_pipeline.py - Main prediction pipeline
- src/models/ - All ML model classes
- src/training/ - Training utilities
- src/api/ - FastAPI endpoints
- scripts/ - Training and evaluation scripts
- config/ - YAML configurations

Note: Trained models (*.joblib, *.pt) are gitignored.
      Regenerate with training scripts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 04:27:40 -06:00