3cb083f18213dec2bdfc71c4e8124cf422aed82d
Plan 3 Tasks 8 + 9. Single commit because Task 9 directly consumes Task 8's seed-fraction signal; no useful intermediate state. ISV tail-append: - [82] SEED_STEPS_TARGET_INDEX — config replay_seed_steps (CPU constructor write) - [83] SEED_STEPS_DONE_INDEX — GPU-incremented per collect_experiences_gpu - [84] SEED_FRAC_EMA_INDEX — adaptive EMA of (1 - done/target) - Fingerprint shifted [80,81] → [85,86]; ISV_TOTAL_DIM 82 → 87 GPU-only design (per user direction "fully gpu driven no cpu involvement"): - 4 scripted policies as ONE CUDA kernel (scripted_policy_kernel.cu) - Per-sample policy mix (40% uniform LCG / 20% momentum / 20% mean-rev / 20% vwap-deviation) deterministic by `i % 5` - Action source switched at launch boundary (CPU per-epoch read of ISV slot decides which kernel to dispatch; the action computation itself is 100% GPU) - No CPU physics mirror — existing GPU `experience_env_step` runs unchanged seed_step_counter_update_kernel.cu: - Single-thread cold-path; increments DONE, computes FRAC = max(0, 1-done/target) - Adaptive α matches Task 3/4 convention (α_base × (1 + 0.5×|clamp(sharpe,±2)|)) cql_alpha_seed_update_kernel.cu (Task 9): - target = config.cql_alpha × max(0, 1 - seed_frac) - During seed phase (frac=1) → target=0 → CQL α decays to 0 (no pessimism on exploration data); as frac → 0 → CQL α ramps to config value - Updates ISV[CQL_ALPHA_INDEX=48]; CQL gradient kernel reads slot 48 via pinned device-mapped ISV (Plan 1 Task 12 consumer pattern unchanged) Registry: SEED_STEPS_DONE + SEED_FRAC_EMA both FoldReset; CQL_ALPHA flipped SchemaContract → FoldReset; SEED_STEPS_TARGET stays SchemaContract. Read-only monitors (mirror PlanThresholdMonitor / StateKlMonitor pattern): - monitors/seed_monitor.rs — surfaces ISV[82..85) for HEALTH_DIAG + controller_activity smoke fire-rate - monitors/cql_alpha_monitor.rs — surfaces ISV[48] + ISV[84] dependency Smoke (RTX 3050 Ti, 3 folds × 5 epochs, dqn-smoketest profile with replay_seed_steps=1000 override so seed phase completes mid-fold): - All 3 folds saved best-checkpoint - Fold 2 best Sharpe = 92.4938 at epoch 1 (target range 80-120) ✓ - Per-fold val_metric: f0=3.80 / f1=9.73 / f2=20.24 (loss-based) - HEALTH_DIAG[3..4] cql_alpha=0.0500 with health=0.49 → base ≈ 0.10 from ISV[48], consistent with kernel ramping toward final×(1-frac); regime gate (1-regime)×health applies on top - 11 cargo check warnings (matches pre-task baseline; no new warnings) - 6/6 monitor unit tests pass (read/diagnose/observe×fire_rate) Smoke override rationale: smoke runs ~200 samples per collect (4 episodes × 50 timesteps) × 5 epochs × 3 folds ≈ 3000 total. Default 100k target would keep entire smoke in seed phase. Override to 1000 lets the seed→network transition complete mid-fold so the CQL α ramp is observable. Per pearl_one_unbounded_signal_per_reward.md: cql_alpha is bounded (clamped to config_final × (1 - seed_frac) ∈ [0, config_final]), composes safely with downstream CQL loss. 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%