b861567890f9d3ff9c9675a9c96306b7bbc9a9db
W1 SEMANTIC: Pearl 2 iqn_branch[b] is now consumed at Pearl 5 per-pass IQN budget. Previous code used iqn_trunk/4 in both parallel + sequential IQN paths, silently averaging Pearl 2's per-branch IQN differentiation. Now: iqn_budget_per_branch = iqn_branch[branch_idx] / 4.0 inside the per-branch loop — sum across 4 branches = iqn_trunk magnitude preserved, per-branch differentiation preserved. iqn_trunk renamed _iqn_trunk in the destructure (still in-scope comments only). W2 DELETE: ATOM_NUM_ATOMS_BASE + NOISY_SIGMA_BASE imports removed from fused_training.rs:44 — consumers are atoms_update_kernel.cu (Layer B) and experience_kernels.cu; imports were speculative additions. W3 DELETE: v_blocks at gpu_iql_trainer.rs:756 — both kernel launches used v_blocks2; v_blocks was stale dead code. W4 DELETE: OrderRouter import from ml-dqn/src/dqn.rs — import only, never used in the file body. W5 DELETE: get_snapshots_for_timestamp import from data_loading.rs — imported but never called; only OFICalculator + get_trades_for_bar used. W6 DELETE: update_target_networks method (42 lines) from ml-dqn/dqn.rs — orphan with zero call sites; real path uses fused CUDA EMA kernel. Cascaded: convergence_half_life import deleted (now unused). W7-W13 FILE-LEVEL #![allow(unsafe_code)]: cublas_algo_deterministic.rs and sp4_wiener_ema.rs — workspace unsafe_code = "warn" fires for every unsafe impl/fn; both files require unsafe for CUDA/cuBLAS interop; pattern matches mapped_pinned.rs, gpu_iqn_head.rs, gpu_weights.rs, etc. W14-W15 VISIBILITY SCOPE: ControllerPrevValues + ControllerFireCounts in trainer/mod.rs changed pub → pub(crate); consumed only within ml. Per feedback_no_hiding: zero #[allow(...)] item-level suppressions added; 2 file-level #![allow(unsafe_code)] follow established crate convention. cargo check (ml + ml-dqn) + cargo build --release + cargo test --lib all CLEAN (0 warnings; 13/13 lib tests pass). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Languages
Rust
88.2%
Cuda
7.7%
Python
1.3%
Shell
1.1%
PLpgSQL
0.8%
Other
0.8%