FFFF v2: real multi-coin order flow, queue-position simulator, SAC agent, honest held-out evaluation by jadenfix · Pull Request #8 · jadenfix/DRL4MM · GitHub
[go: up one dir, main page]

Skip to content

v2: real multi-coin order flow, queue-position simulator, SAC agent, honest held-out evaluation - #8

Merged
jadenfix merged 3 commits into
mainfrom
v2
Oct 18, 2026
Merged

jadenfix merged 3 commits into
mainfrom
v2

Conversation

@jadenfix
Copy link
Copy Markdown
Owner

A v2 pipeline for market making on real order flow, evaluated honestly on held-out data.

What's new

  • Data: Binance USD-M bookTicker and aggTrades (CC BY-NC-SA 4.0) for BTC, ETH, LTC and SOL over three weeks chosen by volatility (calm, median, volatile), 84 instrument-days, checksum-verified and streamed one day at a time.
  • Simulator: a queue-position replay (one decision per second, 100 ms latency, post-only orders joining the back of the queue, inventory cap, hourly flattening, no fees). Deliberately pessimistic fill rules.
  • Baselines tuned on validation only: best fixed half-spread per instrument, Avellaneda-Stoikov (sigma and k fitted on training days), the repo's fixed-midpoint quotes, and the previous TD3.
  • Agent: SAC with a 30-second markout reward and inventory penalty, 16 causal market features plus 9 agent-state features, quoting a half-spread and skew around the microprice; a five-seed ensemble chosen on validation.
  • Evaluation: days 1 to 4 train, day 5 validates, days 6 to 7 test, with SOL never seen by the agent. Bootstrap intervals by day, sign-flip and HAC tests, and a no-look-ahead test that perturbs the future.

Result

The agent does not significantly beat the validation-chosen baseline on any instrument. Pooled: agent -1.17 USDT/h [-2.98, +0.37] vs baselines -1.67 [-4.80, +0.98], difference +0.50 [-0.17, +1.36], p = 0.34. It clearly improves on the previous TD3 (+9.19 USDT/h pooled, HAC p = 0.005; day-level sign-flip p = 0.125). Full tables are in results/v2/results.md.

Entry point: python -m mmv2 all. 107 tests pass.

🤖 Generated with Claude Code

jadenfix and others added 3 commits October 18, 2026 01:28
- mmv2/data.py, fetch.py: stream Binance USD-M bookTicker + aggTrades
  (data.binance.vision) over HTTPS, verify SHA-256 against the published
  checksums, inflate in memory and keep one compact NPZ per instrument-day
  (100 ms top of book + per-bin aggregated trades); nothing raw on disk.
- mmv2/config.py: calm, median and volatile weeks for BTC/ETH/LTC/SOL;
  per-week chronological 4/1/2 train/validation/test split; SOL held out.
- mmv2/sim.py: queue-position replay with latency, post-only orders,
  queue tracking, inventory cap and liquidation at the end; causal
  market features.
- mmv2/policies.py, baselines.py: fixed half-spread grid, Avellaneda-Stoikov
  (sigma, k from training days; gamma and horizon tuned on validation), the
  repo's fixed-midpoint quotes and the previous TD3 through an adapter.
- mmv2/rl.py, ablate.py, select.py: TD3/SAC with markout or PnL rewards,
  validation checkpointing and seed ensembles.
- mmv2/evaluate.py, stats.py, report.py: one-shot test evaluation, day-block
  bootstrap CIs, exact sign-flip and HAC paired tests.
- tests: fill rules, perturb-the-future no-look-ahead test (catches a
  one-bin peek), streaming zip and statistics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Ablations on validation (TD3/SAC, PnL vs 30 s markout reward, residual
  action, feature set, anchor, inventory penalty) chose SAC with the
  markout reward; five seeds trained for 600k steps, the validation-best
  checkpoint of each averaged as an ensemble (mmv2/final_config.json).
- Held-out test, evaluated once: no instrument shows a significant
  difference from the validation-chosen best baseline, and the agent trails
  the hindsight-best baseline everywhere (not significantly). Pooled it
  loses -1.17 USDT/h [-2.98, +0.37]; it does improve on the previous TD3.
- results/v2: results.md, test results, tuned baselines, ablation summary,
  frozen agent, data manifest and the site parity log.
- README documents data, simulator, baselines, agent, protocol, limits
  and data credits; v1 documentation kept below.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
train/train_td3.py changed on main in #7 after the manifest was recorded,
so the render guard failed on main and on this branch. The replay demo
itself runs simulator.replay, which is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jadenfix
jadenfix merged commit d6c4808 into main Oct 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0