jgrusewski a60e7b092f Merge plan-c-phase-2-thompson — SP4 signal-driven magnitude control + Plan C Phase 2 Thompson direction branch
119 commits, 89 files changed (+24,734 / -1,415).

Two coordinated workstreams:

1. Plan C Phase 2 (#233): direction-branch Thompson sampling resumed
   to resolve the ff00af68a UCB-asymmetry regression. Selector now
   matches distributional Q-target (Thompson at training, argmax at
   eval), restoring the symmetry pearl. Exit gate train_active_frac >
   0.40 met by smoke-test-gmvf8 (F0=0.75, all 3 folds Succeeded).

2. SP4 Layer A + Layer B + close-out: ISV-driven adaptive bounds for
   the magnitude branch replace SP1-era 1e6×ISV multipliers and
   hard-coded clamps. 42 ISV slots wired through 5 producer kernels
   with sentinel-detect → Pearl-A first-observation + Pearl-D
   Wiener-optimal meta-rate adaptation. Pearl B fused per-param-group
   oracle covers all 8 param groups including Curiosity sub-buffers.
   Pearl C engagement counter integrated into 5 Adam kernels with
   rate-deficit gating. StateResetRegistry extended for fold-boundary
   correctness.

Subsequent close-out:
- GPU-only Pearls A+D refactor (eliminated host-side compute path
  that broke CUDA Graph capture).
- Layer B per-group Adam split (resolved Pearl C engagement deferral).
- #260 SP1-era 1e6 × ISV multiplier elimination via dedicated
  bw_d_h_s2_p99 + q_dir_grad_p99 producers.
- feedback_no_cpu_compute_strict sweep: 5 GPU EMA migrations
  (grad_norm fast/slow + iqn_loss + utilization + adaptive_clip +
  calibrate_homeostatic_targets) + 5 documented exceptions for
  host-aggregated PnL/eval-result inputs.
- Intent-side magnitude distribution diagnostic (#212).

Validation:
- 4 L40S smokes Succeeded: smoke-test-tkkx6, 5nrz7, g2mvm, gmvf8
- Local RTX 3050 Ti: 16/16 SP4 GPU producer tests + 11/11 SP4 lib tests
- cargo check --workspace clean (no new warnings)

Zero open deferrals on SP4-touched paths. Zero hardcoded magnitude
multipliers in cuda_pipeline consumer code. Zero host-side EMA/
reduction violations on production hot paths.

Memory pearls landed: pearl_first_observation_bootstrap (Pearl A),
pearl_fused_per_group_statistics_oracle (Pearl B),
pearl_engagement_rate_self_correction (Pearl C),
pearl_wiener_optimal_adaptive_alpha (Pearl D),
pearl_l1_lambda_grad_direction_entropy_deficit (signal-driven L1),
pearl_sp4_close_out (canonical reference for future migrations),
feedback_no_cpu_compute_strict (hard rule against host-side compute).

Closes #84, #175, #212, #217, #233, #240.

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