Wire LR scheduler to actually update the Adam optimizer (was logged but never applied). Add update_learning_rate to DQN, RegimeConditionalDQN, and DQNAgentType so decay_factor propagates through all agent variants. Fix train/eval parity: CLI defaults 51→54 features, 3→45 actions; DQN eval always uses 3-layer hidden_dims; PPO eval uses 5-layer value network matching trainer. enhanced_ml.rs hardcoded config updated from state_dim=16/num_actions=3 to 54/45. Fix Candle F32/BF16 traps: replace `Tensor * 0.5` (f64 literal) with broadcast_mul(Tensor::full(0.5_f32)) in quantile_regression.rs (2x), dqn.rs Huber loss, and IQN gamma multiplication. Prevents panics on Ampere+ BF16 GPUs. Add urgency_weight() multiplier to training cost model in reward.rs and portfolio_tracker.rs — urgency dimension (Patient/Normal/Aggressive) now affects learned value function, matching evaluate_baseline.rs. Fix equity tracking: additive (equity += ret) → multiplicative (equity *= 1.0 + ret) in compute_metrics. Fix total return calc. Fix PER beta annealing: epochs*70 → epochs*1000 (~1015 actual steps per epoch for 130k bars / batch 128). Fix silent target network freeze: mutex lock failure now propagates error instead of silently skipping weight update. Make save_checkpoint atomic (write .tmp then rename). Make NormStats write atomic with error logging instead of silent discard. Convert EnsembleConfig::new assert! → Result<Self, MLError> with 14 call site updates. Fix hyperopt result serialization to warn instead of silently dropping to Value::Null. Fix clippy MSRV mismatch: clippy.toml 1.75 → 1.85 matching Cargo.toml. 2732 tests pass, 0 clippy warnings across workspace. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
3.6 KiB
TOML
91 lines
3.6 KiB
TOML
# Clippy Configuration for Foxhunt HFT Trading System
|
|
# Strategic clippy configuration prioritizing performance and correctness for ultra-low latency trading
|
|
|
|
# === PERFORMANCE-CRITICAL THRESHOLDS ===
|
|
# These values are optimized for HFT where microsecond performance matters
|
|
|
|
# Cognitive complexity threshold (default: 25, HFT setting: 20)
|
|
# Lower threshold for maintainability in complex trading logic
|
|
cognitive-complexity-threshold = 20
|
|
|
|
# Pass-by-value size limit (default: 256, HFT setting: 128)
|
|
# Smaller threshold to prevent unintentional copies in hot paths
|
|
pass-by-value-size-limit = 128
|
|
|
|
# Trivial copy size limit (default: target_pointer_width, HFT setting: 64)
|
|
# Conservative threshold for hot trading paths
|
|
trivial-copy-size-limit = 64
|
|
|
|
# Stack size threshold (default: 512000, HFT setting: 128)
|
|
# Prefer heap allocation for large objects to avoid stack overflow
|
|
too-large-for-stack = 128
|
|
|
|
# === TRADING DOMAIN-SPECIFIC SETTINGS ===
|
|
|
|
# Too many arguments threshold (default: 7, HFT setting: 8)
|
|
# Financial functions often need many parameters (price, volume, timestamp, etc.)
|
|
too-many-arguments-threshold = 8
|
|
|
|
# Too many lines threshold (default: 100, HFT setting: 120)
|
|
# Allow slightly longer functions for performance-critical algorithms
|
|
too-many-lines-threshold = 120
|
|
|
|
# Type complexity threshold (default: 250, HFT setting: 200)
|
|
# Keep types manageable for compile-time optimization
|
|
type-complexity-threshold = 200
|
|
|
|
# Struct excessive bools threshold (default: 3, HFT setting: 4)
|
|
# Trading data structures need flags for order states, market conditions
|
|
max-struct-bools = 4
|
|
|
|
# === IDENTIFIER AND NAMING ===
|
|
|
|
# Single char binding names threshold (default: 4, HFT setting: 6)
|
|
# Allow common financial abbreviations (p=price, v=volume, t=time, etc.)
|
|
single-char-binding-names-threshold = 6
|
|
|
|
# Allowed identifier prefixes for HFT domain
|
|
allowed-prefixes = ["to", "as", "into", "from", "try_into", "try_from", "with", "without", "hft", "market", "order", "trade", "price", "tick"]
|
|
|
|
# Minimum identifier chars (default: 1)
|
|
# Allow single-letter variables for mathematical expressions
|
|
min-ident-chars-threshold = 1
|
|
|
|
# === ARRAY AND COLLECTION SETTINGS ===
|
|
|
|
# Vec box size threshold (default: 4096, HFT setting: 4096)
|
|
# Keep default for order book data structures
|
|
vec-box-size-threshold = 4096
|
|
|
|
# Array size threshold (default: 512000, HFT setting: 256000)
|
|
# Reasonable limit for price level arrays
|
|
array-size-threshold = 256000
|
|
|
|
# === GENERAL SETTINGS ===
|
|
|
|
# Allow unwrap in tests and benchmarks only
|
|
allow-unwrap-in-tests = true
|
|
|
|
# Minimum Supported Rust Version
|
|
msrv = "1.85"
|
|
|
|
# Standard library items to avoid (empty = allow all)
|
|
disallowed-names = []
|
|
|
|
# === STRATEGIC LINT CONFIGURATION FOR HFT PRODUCTION ===
|
|
# This configuration prioritizes correctness and performance over documentation completeness
|
|
# Critical lints should be enforced via CI with: cargo clippy -- -D clippy::correctness -D clippy::perf
|
|
|
|
# Note: clippy.toml supports thresholds and enables, not deny/warn/allow levels
|
|
# Lint levels are enforced through CI flags and source code attributes
|
|
|
|
# === CRITICAL LINTS FOR CI ENFORCEMENT ===
|
|
# Use in CI: cargo clippy --workspace --all-targets --all-features -- -D clippy::correctness -D clippy::perf -D clippy::unwrap_used
|
|
|
|
# === LINT LEVEL ENFORCEMENT ===
|
|
# Lint levels (warn/deny/allow) should be specified via:
|
|
# 1. Command line flags: cargo clippy -- -D clippy::unwrap_used
|
|
# 2. Source code attributes: #[deny(clippy::unwrap_used)]
|
|
# 3. Workspace-level configuration in Cargo.toml [workspace.lints.clippy]
|
|
|
|
# Documentation policy: Private item docs are handled separately from critical trading functionality |