790c1007192679bd530e56587854d58f3a43867c
The Q-drift kill criterion's adaptive floor formula is max(0.5, 3 × max(ISV[Q_ABS_REF=16], ISV[Q_DIR_ABS_REF=21])) but smoke-test-n9xzr showed both ISVs stuck at bootstrap 0.05 even when q_mean reached 0.76 — the producers (q_mag_bin_means_reduce and q_dir_bin_means_reduce) only fired inside reduce_current_q_stats at epoch boundary, while the per-step captured update_isv_signals consumed the resulting scratch buffers each training step. Concrete failure mode at α=0.05 EMA with raw ≈ 1.0: - Epoch 0: scratch is zero-initialized, all per-step EMA pulls toward zero, ISV[16,21] stay 0.0 - Epoch 0 boundary: reduce_current_q_stats fires, scratch becomes q_abs_ref ≈ 1.0, single update_isv_signals writes ISV[16] = 0.05 - Epoch 1+: with stale scratch held constant between boundaries, per-step EMA over hundreds of steps would saturate — but smoke step counts are small enough (small batch=64, buffer=256) that the slot stays near 0.05 - kill_floor degenerates to max(0.5, 3 × 0.05) = 0.5 forever, so the criterion fires on legitimate cold-start growth Fix: launch q_mag_bin_means_reduce + q_dir_bin_means_reduce in both fused_training paths (captured adam_update_child at ~line 2228 AND ungraphed step-0 fallback at ~line 1465) immediately before update_isv_signals. Per-step graph replays now read q_out_buf that forward_child populated this same step, write fresh scratch, and the captured update_isv_signals consumes it on the same stream. Per pearl_cold_path_no_exception_to_gpu_drives.md: cold-path EMAs fire alongside their consumers. Per feedback_no_partial_refactor.md: graphed and ungraphed paths migrate together — same producer- consumer contract. After this fix, the floor will adapt: ISV[16,21] saturate to the policy's actual q_abs_ref scale within ~60 steps at α=0.05, so by epoch 2 the floor becomes 3 × ~0.5 = ~1.5, no longer firing on legitimate cold-start growth. Co-Authored-By: Claude Opus 4.7 (1M context) <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%