8ba8755b481cf0a08a81ebd5a6326b9d789abf5e
Self-critical review of v1 (commit 0f3484325) found 12 issues. All
fixed inline. Spec marked Status: Design v2 with explicit changelog.
LOAD-BEARING FIXES
1. §4.4 conviction cold-start: removed backwards "uniform fallback"
branch that maintained trading authority when net_edge=0 across
all horizons (exactly when model has no edge). Replaced with ε
floor on net_edge_h. Single formula, smooth bootstrap, no regime
switch.
3. §4.3 exit logic: 5 OR conditions → 1 composite exit_signal scalar
(max of degradation, disagreement, pnl_decay terms). SL/trail and
8h circuit-breaker stay orthogonal as safety, not exit policy.
Attribution per term recorded in §7 state for observability.
6. §9 Gate 2: PF > 1.0 (2.5× improvement, unrealistic) → tiered
MUST (no-regression) + WIN (real lift, four candidate criteria) +
explicit STOP condition if MUST passes without WIN.
7. §9.1.1: alpha-realization metric defined explicitly as
realized_pnl / max(unrealized during signal-validity window).
Was hand-waved in v1; now formulated.
TRACTABLE INLINE FIXES
2. §7 open_trade_state: 128 → 64 bytes. Diagnostic-only fields
(scale_up/down counts, max/min target reached) moved to a
separate audit buffer (single source of truth keeps state lean).
4. §5.1 envelope: multiplicative formula → additive bounded
contributions. tanh(sharpe), min(dd/cap), clamp(vol). No single
factor can crash envelope to zero. Floor (envelope_floor lots)
and hard-cap (envelope_hard_cap) remain.
5. §5.2 threshold: hand-waved "self-tune toward PF" → explicit
3-arm bandit (lower, current, higher percentile) every K_eval
closed trades, Wiener-α EMA target with floor, bounded
[0.5, 0.95].
8. §3.4 + §3.6: Layer A wall-time ≤ 5× → ≤ 2× (controller is
light, 5× would indicate structural bug, not config tuning).
9. §4.2: explicit Wiener-α formula for conviction EMA with floor
at 0.4 per pearl_wiener_alpha_floor_for_nonstationary.
10. §6.2.1: shadow eval defined explicitly with backtest-mode (last
15% of fold) and live-mode (parallel-prediction-only) variants.
Promotion criteria spelled out (PF, Sharpe, tail loss).
11. §6.2: Layer D loss explicit (primary = value regression on
realized PnL conditional on state; secondary = EWC++ regularizer
toward base). Was three losses with no specified combination.
12. §10.5: adapter regime over-fit risk added with sample-count
down-weighting, cross-regime shadow eval, periodic adapter reset
as hard backstop.
GREENFIELDS (per user direction)
- §3.3: decision_stride field DELETED from YAML + Rust (not
deprecated). No backwards-compat shim. Per
feedback_no_legacy_aliases.
- §7.1: open_trade_state 24→64 byte migration is atomic, no old
layout shim.
- §8: boundary matrix decision_stride row marked REMOVED, not
DEPRECATED.
§13 pearl conformance: per-section pearl application (not bulk
citation). Added pearl_audit_unboundedness_for_implicit_asymmetry,
pearl_no_deferrals_for_complementary_fixes acknowledgement (layers
are sequenced amplifications, not parallel fixes), and the new
pearl_stop_checks_run_at_deadline_cadence from S2.
Status: Design v2 — awaiting user review before writing-plans.
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%