Files
foxhunt/crates
jgrusewski 8d3efa450e test(ml-backtesting): integrated Ring 2 fuzz over full pipeline (C18)
Existing lob_sim_fuzz only exercised book_update + market orders.
This new test suite drives the FULL integrated pipeline under random
adversarial conditions:

  apply_snapshot (random-walk book)
  → step_resting_orders (random signed trade-flow signal)
  → broadcast_alpha (random per-horizon probs every 4th event)
  → step_decision_with_latency (mixed latency=0 + latency=50ms cells)
  → submit_market_immediate (immediate path)
  → pnl_track_step + isv_kelly_update_on_close

Warm-starts every backtest with random-but-plausible Kelly state
(at least h4 set credibly profitable so decisions actually open
positions). Random target_annual_vol + annualisation_factor + max_lots
per decision to vary the Kelly cap.

Per-50-event invariants:
  • book monotonicity (bid_px[k] ≤ bid_px[k-1], ask_px[k] ≥ ask_px[k-1])
  • no-crossed-book (ask[0] > bid[0])
  • Pos.realized_pnl + Pos.vwap_entry finite (no NaN/Inf leaks)
  • Pos.position_lots in plausible range (|≤100|)
  • All 5 per-horizon IsvKellyState fields finite

Three test sizes:
  integrated_fuzz_n1_short   — N=1,  200 events
  integrated_fuzz_n8_medium  — N=8,  500 events
  integrated_fuzz_n64_long   — N=64, 1000 events

All three pass on RTX 3050. The N=64 × 1000 case exercises 64,000
event-snapshots × 16,000 decisions × ~12,800 trade attempts without
any invariant violation or NaN propagation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 10:11:31 +02:00
..