79d0c530340926c842cec32bb500fea48067d3ad
Three producers in enrichment.rs had hardcoded magnitude thresholds
sized for time-bar trades (per-trade pnl ≈ 1e-3..1e-2). Foxhunt's
volume bars (bars_per_day ≈ 34_496) produce per-trade pnl in
1e-7..1e-5 range, so the constants tripped every cycle:
- compute_winner_concentration: `all_mean <= 1e-6` → win_conc=0
- compute_hindsight_labels: `t.pnl < -0.001` → hindsight count=0
- compute_curriculum_weights: `(1/sharpe).clamp(0.1, 10.0)` →
similar small Sharpes saturate to 10 →
uniform weights → curric_conc=0
Surfaced by smoke v5 (train-vds7r, commit d1638959d): across all 3
cycles of fold 0, the E6/E7/E8 scalar signals stayed pinned at
0.0000 — the Phase 5/6/7 PER-alpha-boost path was dark code.
Fix:
- New `compute_pnl_std(trades)` helper: Welford std over eval-trade
pnl column; 0.0 on empty, |pnl| on single-element bootstrap
- `compute_winner_concentration(trades, pnl_std)`: guard becomes
`all_mean <= (0.1 × pnl_std).max(0.0)`
- `compute_hindsight_labels(trades, pnl_std)`: filter becomes
`t.pnl < (-0.5 × pnl_std).min(-1e-9)` (floor handles cold start)
- `compute_curriculum_weights`: clamp relaxed (0.1, 10.0) →
(0.01, 100.0); fallback weight 0.1 → 0.01
- `run_enrichments` computes pnl_std once per cycle, threads through
to producers; diagnostic log extended with pnl_std field
Pearls honoured:
- feedback_isv_for_adaptive_bounds: hardcoded constants → signal-
derived thresholds
- pearl_controller_anchors_isv_driven: anchors derive from observed
data scale, not bar-resolution magic numbers
- pearl_first_observation_bootstrap: pnl_std=0 → producers return
sentinel 0.0 or use absolute floor (cold-start preserved)
Verification:
- cargo check -p ml --features cuda # clean
- cargo test -p ml --lib financials # 7/7 (unchanged)
Expected v6 cycle 1: pnl_std ≈ 1e-5, win_conc ≈ 1.5..3.0,
hindsight count > 40k, curric_conc > 0.
Note: curriculum clamp bounds (0.01, 100.0) are still hardcoded;
making them fully ISV-driven is deferred to Phase 9. Immediate
Phase 8.2 goal is unblocking the dark-code path so the downstream
per_update_pa / per_insert_pa alpha-boost composition actually
fires on volume-bar trades.
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%