Files
foxhunt/services/backtesting_service
jgrusewski 1aef51f99b fix(stubs): implement 15 production stubs, fix routing, delete placeholders
Web-gateway routing:
- Point TRADING_SERVICE_URL at api-gateway (proto mismatch fix)
  Web-gateway uses foxhunt.tli.TradingService proto but was connecting
  directly to trading-service which implements trading.TradingService.
  api-gateway already proxies Subscribe* → Stream* correctly.

GitLab KAS:
- Disable gitlab_kas in appConfig to stop sidekiq NotifyGitPushWorker
  errors (KAS pod was already disabled but Rails still tried to connect)

Trading service monitoring (3 stubs → real):
- AcknowledgeAlert: real alert lookup + state mutation in shared store
- GetActiveAlerts: returns actual active alerts from in-memory store
- StreamAlerts: now persists generated alerts (capped at 1000 entries)

Trading service ML streams (2 stubs → real):
- StreamModelMetrics: emits real inference_count, error_count, latency
  per model every N seconds from the RuntimeModelInfo registry
- StreamSignalStrength: emits per-symbol signal aggregation from model
  ensemble weights and latency confidence

Backtesting service:
- stop_backtest: real CancellationToken cancellation (was no-op)
  Tokens stored per-backtest, execute_backtest wraps strategy call
  in tokio::select! for immediate cancellation

Deleted 7 empty placeholder files:
- 4 Wave D regime stubs (dynamic_stops, ensemble, performance_tracker,
  position_sizer) — comment-only files, never wired
- 2 Wave 3 feature stubs (microstructure, statistical)
- 1 PPO stub (unified_ppo.rs — empty struct definitions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:47:31 +01:00
..

Backtesting Service

Overview

The backtesting_service offers an independent and isolated environment for rigorously testing and validating trading strategies against historical market data. It provides a robust platform for simulating trading performance, analyzing strategy efficacy, and generating comprehensive performance reports before live deployment.

Features

  • Independent Backtesting Service: Operates autonomously, allowing for parallel and isolated strategy evaluations.
  • gRPC API for Backtest Execution: Exposes a clear API for submitting and managing backtesting jobs.
  • Strategy Testing and Validation: Enables comprehensive testing of various trading strategies under different market conditions.
  • Performance Reporting: Generates detailed reports including metrics like P&L, Sharpe ratio, drawdown, and win rate.
  • Data Replay Engine: Accurately replays historical market data, simulating real-world order book dynamics and trade execution.
  • Results Persistence: Stores backtesting results and reports for historical analysis and comparison.

gRPC API

The backtesting_service exposes a gRPC API for initiating and retrieving backtest results. Key endpoints include:

  • RunBacktest - Submit backtest configuration and strategy
  • GetBacktestResults - Retrieve results for completed backtests
  • ListAvailableStrategies - List registered strategies
  • GetBacktestReport - Get detailed performance report

Running the service

To run the backtesting_service binary:

cargo run --bin backtesting_service

Data Requirements

The service requires historical market data in Parquet format:

  • Data should be stored in the configured data directory
  • Supports tick data, order book snapshots, and OHLCV candles
  • Data must include instrument, timestamp, and price/quantity fields

Testing

To run the tests for the backtesting_service crate:

cargo test --package backtesting_service

Documentation

Comprehensive API documentation is available at docs.rs/backtesting_service.