jgrusewski 0c57a5a31f docs(sp17-3.3): Phase 3 close-out — canonical HEALTH_DIAG line + pearl
Phase 3.3 finalises the SP17 dueling-Q diagnostic chain. Canonical
HEALTH_DIAG line (already emitted by Phase 3.2 commit b6b17d46b) matches
the plan's exact format spec at line 1064-1066:

  HEALTH_DIAG[N]: dueling [v_share=(d=X m=Y o=Z u=W)]
                          [a_var=(d=A m=B o=C u=D)] [clip=K]

Reader parsing table added to audit doc, Phase 4 smoke gate criteria
documented:
  - a_var > 0.01 per branch throughout (regression detector)
  - v_share ∈ [0.3, 0.7] per branch (balanced dueling)
  - clip ∈ [0.5, 5.0] (magnitude scale healthy)

Memory pearl `pearl_sp4_histogram_warp_tile_undercount` filed
(MEMORY.md updated separately as it's a user-private file outside the
worktree). Documents the SP17 Phase 3.2 test-data trap discovered
during the advantage_clip_bound oracle test: `sp4_histogram_p99`'s
documented "1/(256×32) loss for typical signals" qualifies on signal
distribution; lockstep-uniform synthetic patterns violate the
assumption. Fix is per-element jitter in test data — NOT atomicAdd
(which would violate `feedback_no_atomicadd`). Real |A_centered| in
production is continuous, so the issue is test-only.

Phase 3 commit chain (atomic per `feedback_no_partial_refactor`):
  - 1e70cd5e5 Phase 3.1: A_var_ema + 1 GPU oracle test
  - b6b17d46b Phase 3.2: V_share + advantage_clip_bound + 2 GPU oracles
  - this commit: closeout audit doc

13/13 SP17 GPU oracle tests pass on RTX 3050 Ti in 2.4s.

Phase 3 is observability-only — NO consumer path is modified. The clip
bound is producer-tracked but NOT yet wired as an actual clip on any
kernel; that's Phase 5 follow-up.

Plan: docs/superpowers/plans/2026-05-08-sp17-dueling-q-network.md
      Phase 3.3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 23:04:41 +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%