Three new reward intelligence features, all zero-state GPU-native: 1. Spread-aware transaction costs: tx_cost scales by CUSUM volatility. Trading in choppy markets costs more — teaches the model to reduce frequency in volatile regimes. Real spread DOES widen with volatility. 2. Kelly-inspired confidence scaling: when realized_pnl > 0 (model has been right), amplify PnL weight 1.5x. When losing, amplify drawdown penalty 1.5x. Self-reinforcing: good decisions → stronger signal → better Q-values. Bad decisions → defensive mode → more exploration. 3. Profit-taking bonus: +0.1 reward when model reduces a position toward flat while cumulative episode PnL is positive. Explicitly rewards the ACT of taking profit, not just being in a winner. Teaches the model to lock in gains rather than riding them back to breakeven. Total kernel additions: ~20 lines, ~10 FLOPs. Zero extra state beyond what PORTFOLIO_STRIDE=12 already provides. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ml
10-model ML ensemble for the Foxhunt HFT system, built on Candle v0.9.1.
Models
- DQN (Rainbow) — deep Q-network with prioritized replay, dueling heads, noisy nets
- PPO — proximal policy optimization with GAE, LSTM policies, clip-higher
- TFT — temporal fusion transformer for multi-horizon forecasting
- Mamba2 — state space model for sequence prediction
- Liquid Networks — biologically inspired networks for non-stationary data
- TLOB — transformer-based limit order book analysis
- KAN — Kolmogorov-Arnold networks
- xLSTM — extended LSTM architecture
- TGGN — temporal graph neural network
- Diffusion — diffusion-based generative model
Key Modules
ensemble— model ensemble coordination and confidence aggregationhyperopt— PSO-based hyperparameter optimization with per-model adapterstrainers— unified training loops (DQN, PPO, supervised)inference—InferenceAdaptertrait for predictioncheckpoint— model checkpointing and restorationevaluation— walk-forward evaluation pipeline
Usage
use ml::dqn::DQN;
use ml::ppo::PpoTrainer;