jgrusewski c1dc84a345 fix(rl): B-10 wire G1 Q-distribution launch into step_with_lobsim_gpu
Initial B-10 commit placed `launch_q_distribution_stats` after the
`dqn_head.forward(h_t)` at line 6615 — but that's inside
`step_with_lobsim`, the legacy non-GPU path. The actual GPU path
exercised by `alpha_rl_train` is `step_with_lobsim_gpu` (line 8402),
which has its own h_t-based Q forward at line 8632. The G1 diag fields
(q_dist_entropy_mean, q_value_range_mean, q_value_abs_max) returned 0
locally because the launch never ran in the GPU path.

Added the same launch_q_distribution_stats call after line 8632.
The non-GPU launch at 6615 is left in place — `step_with_lobsim` is
still callable; per `feedback_no_partial_refactor.md` both paths are
instrumented consistently.

Validated locally (RTX 3050 Ti, 200+50 b=16 fold-1):
  q_dist_entropy_mean       = 2.6482   (was 0)
  q_value_range_mean        = 4.9257   (was 0)
  q_value_abs_max           = 3.8715   (was 0)

The entropy value 2.65 is consistent with a near-uniform softmax over
Q_N_ATOMS=21 atoms with some learned concentration (ln(21)=3.04 = full
uniform, 0 = one-hot delta). Range and abs_max in 4-5 unit scale match
the locally-adapted atom support.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 12:25:47 +02:00

Foxhunt

Production HFT trading system in Rust.

Architecture

The workspace contains 32 crates organized as follows:

Core Libraries (16)

Crate Purpose
trading_engine Order processing, FIX 4.4, IB TWS, SIMD, RDTSC timing
risk VaR, Kelly, circuit breakers, kill switches, compliance
risk-data Risk data types and shared structures
trading-data Trading data types
ml DQN Rainbow, PPO, TFT, Mamba2, ensemble inference
ml-data ML data types and feature definitions
data Market data ingestion and storage
backtesting Replay engine, strategy tester
adaptive-strategy Ensemble execution, microstructure analysis
common Shared types, resilience, error handling
storage S3 and local model storage
model_loader Model serialization and loading
market-data Market data feed handlers
database PostgreSQL access layer (SQLx)
config Configuration management
tli CLI commands and tooling

Services (8)

Service Purpose
backtesting_service gRPC backtesting service
broker_gateway_service FIX routing, broker connectivity
trading_service Core trading operations
ml_training_service Model training orchestration
data_acquisition_service Market data acquisition
trading_agent_service Autonomous trading agents
api_gateway gRPC API gateway with auth
web-gateway Axum REST + WebSocket gateway

Frontend

web-dashboard/ -- React 19 + TypeScript + Vite + TradingView charts.

Building

# Check compilation (no PostgreSQL required)
SQLX_OFFLINE=true cargo check --workspace

# Run tests for a specific crate
SQLX_OFFLINE=true cargo test -p <crate> --lib

# Clippy
SQLX_OFFLINE=true cargo clippy --workspace

ML Models

Four production model architectures on Candle v0.9.1 with CUDA:

  • DQN Rainbow -- Deep Q-Network with prioritized replay, dueling heads, noisy nets
  • PPO -- Proximal Policy Optimization with GAE and LSTM policies
  • TFT -- Temporal Fusion Transformer for multi-horizon forecasting
  • Mamba2 -- State space model for sequence prediction

Each model has a standalone trainer and a UnifiedTrainable adapter for the hyperopt pipeline.

Infrastructure

  • Git: Gitea at git.fxhnt.ai (Tailscale-only), Scaleway DEV1-S
  • Observability: OpenTelemetry OTLP (env OTEL_EXPORTER_OTLP_ENDPOINT)
  • Database: PostgreSQL with SQLx offline mode for CI

License

Proprietary. All rights reserved.

Description
No description provided
Readme 849 MiB
Languages
Rust 88.2%
Cuda 7.7%
Python 1.3%
Shell 1.1%
PLpgSQL 0.8%
Other 0.8%