2.3 KiB
2.3 KiB
Quant-Rust-Strategist Memory
Architecture Overview
- ~100-symbol universe across 14 sectors (expanded from original 50)
- Hybrid momentum + mean-reversion via regime-adaptive dual signal in
generate_signal() - strategy.rs: shared logic between bot.rs and backtester.rs
- Backtester restricts buys to top 10 momentum stocks (TOP_MOMENTUM_COUNT=10)
- Signal thresholds: StrongBuy>=7.0, Buy>=4.5, Sell<=-4.0, StrongSell<=-7.0
PDT Implementation (2026-02-12)
- Tracks day trades in rolling 5-business-day window, max 3 allowed
- CRITICAL: Stop-loss exits must NEVER be blocked by PDT (risk mgmt > compliance)
- Late-day entry prevention: On hourly, block buys after 19:00 UTC (~last 2 hours)
- Prevents entries needing same-day stop-loss exits
- Reduced hourly trades 100->86, improved PF 1.24->1.59
- "PDT performance degradation" was mostly IEX data stochasticity, not actual PDT blocking
Backtest Results (3-month, 2026-02-12, post-PDT-fix)
Hourly: +12.00%, Sharpe 0.12, PF 1.59, 52% WR, 86 trades, MaxDD -9.36%
Daily: +11.68%, Sharpe 2.65, PF 3.07, 61% WR, 18 trades, MaxDD -5.36%
Current Parameters (config.rs)
- ATR Stop: 3.0x | Trail: 2.0x distance, 2.0x activation
- Risk: 1.2%/trade, max 25% position, 5% cash reserve, 5% max loss
- Max 7 positions, 2/sector | Drawdown halt: 12% (20 bars) | Time exit: 40
- Cooldown: 5 bars | Ramp-up: 15 bars | Slippage: 10bps
- Daily: momentum=63, ema_trend=50 | Hourly: momentum=63, ema_trend=200
- ADX: range<20, trend>25, strong>40
Hourly Timeframe: DO NOT CHANGE FROM BASELINE
- Hourly IndicatorParams: momentum=63, ema_trend=200 (long lookbacks filter IEX noise)
- Shorter periods (momentum=21, ema_trend=50): CATASTROPHIC -8% loss
Failed Experiments (avoid repeating)
- Tighter ATR stop (<3.0x): too many stop-outs on hourly
- Lower buy threshold (3.5): too many weak entries. Keep 4.5
- Blocking stop-loss exits for PDT: traps capital in losers, dangerous
- Lower volume threshold (0.7): bad trades on IEX. Keep 0.8
- Shorter hourly lookbacks: catastrophic losses
IEX Data Stochasticity
- Backtests have significant run-to-run variation from IEX data timing
- Do NOT panic about minor performance swings between runs
- Always run 2-3 times and compare ranges before concluding a change helped/hurt
Build Notes
cargo build --releasecompiles clean (only dead_code warnings)- No tests exist