9ad76c4dfe1569f902c73410ea6bbdfe12538384
Empirical trigger: Phase A as designed in v2 failed Gate 1 catastrophically on both smoke vjmwc (commit3d8f12deb) and lkrdf (commitfe2498769with amplification clamp). Both produced ~155k trades (62× baseline), 9100% max-drawdown (175× baseline), and Sharpe -15.7. The clamp had effectively zero impact on the outcome, confirming the bug is structural not formulaic. Architectural finding: the v2 phase split (A: continuous control / B: signal-driven position management) is artificial. They are the same mechanism. A scalar EMA on max(|p-0.5|) cannot smooth direction jitter between horizons; only the multi-horizon ISV-weighted conviction formula (v2 §4.4, deferred to Phase B in v2) is structurally coherent. User-validated mental model: signal vector at any moment IS a forward prediction of the trade trajectory; optimal position = inventory implied by current beliefs; trade actions are sparse because most events produce only fractional adjustments to a stable optimum. Continuous evaluation, discrete action. v3 phase structure (replaces v2 A/B/C/D): CRT.1 Unified Inventory Controller (was A+B merged) CRT.2 Adaptive Risk Envelope (was Layer C, unchanged) CRT.3 Online Weight Adaptation (was Layer D, unchanged) CRT.1 components: - forward_step every event (already shipped: A0.5) - decision_stride deleted (already shipped: A1) - Multi-horizon ISV-weighted conviction (§4.4 promoted from Phase B) - Wiener-α EMA on multi-horizon conviction (§4.2 promoted) - target_lots = direction × |conviction_ema| × envelope_max - No-trade band in seed_inflight: skip if |delta| < delta_floor (NEW) - open_trade_state 24→64 expansion (§7 promoted from Phase B) - Conviction-degradation exit emergent from target→0; composite-signal safety layer (§4.3) preserved as circuit-breaker What survives from v2 commits on the branch:a0e81fbdfforward_step incremental SSM (A0.5)92f8b10edforward_step_into eliminates GPU↔CPU round-trip045850e8fdelete decision_stride field (A1)3d8f12debbuffer-level seed bit-identity test What gets superseded in CRT.1 implementation:1d889d2deA2 scalar conviction-EMA with aggregate rescale — replaced by multi-horizon §4.4 formulafe2498769A2.1 clamp on broken rescale — same reason The three conviction-EMA device slots (conviction_ema_d et al.) STAY in LobSimCuda — the EMA mechanism is reused on the multi-horizon conviction scalar. The `final_size *= scale` rescale step is deleted. Gate restructure: v2 Gate 1 (Layer A standalone) — REMOVED v2 Gate 2 (Layer B) — PROMOTED as Gate CRT.1 v2 Gate 3/4 — unchanged as CRT.2/CRT.3 Status: Design v3 — awaiting plan rewrite before implementation. 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%