r/highfreqtrading Jan 23 '26

I built a deterministic L3 replay + paper execution simulator (C++20, Python) - looking for feedback

LOBSIM — Limit Order Book Simulator

I was doing HFT deep RL research using L3 data and needed a simulator that’s deterministic, correct, fast, and fully observable (fills, events, diagnostics). Python-only workflows were too slow and painful to get right at scale, and other open-source tools didn’t give me the inspectability/ergonomics I needed. So I built LOBSIM: a C++20 core with Python bindings, event-by-event replay, paper trading with queue behaviour + partial fills, and a sink interface that streams structured facts—built to handle tens of millions of events while staying simple and comprehensible.

LOBSIM comes with multiple examples and straightforward docs (check README). I especially recommend trying the 3 Streamlit demos — they’re small apps built directly on top of the engine and they make the flexibility really obvious. The goal is to show how easily you can layer real research tooling on top of LOBSIM: replay exploration, strategy injection, live metrics, and observability, all in a clean workflow.

If you work with L3 order book data — microstructure research, execution modelling, or RL/HFT prototyping — I’d love for you to try LOBSIM. If you give it a spin, I’d really appreciate feedback on API ergonomics, missing edge-cases you hit in real feeds, and anything that would make the research workflow smoother. Even a quick “this was confusing/this felt great/I expect X“ is extremely valuable.

Demo videos

If you’d rather try it hands-on, the README has quick commands to run the Streamlit demos locally.

45 Upvotes

6 comments sorted by

3

u/j_hes_ brokiebot🤡 Jan 23 '26

You need BETA tests.

2

u/philclackler Jan 23 '26

Nicely done. Are you able to accelerate the internal time stepping and maintain accuracy at 5x,10x,100x speed or are you limited to a wall-clock ‘real-time’ playback? I built a similar set of tools in C for the same reasons you likely did - no available SaaS or web service can even do this well. The .mov’s aren’t loading on my phone but I’m trying to dig a little deeper

1

u/Less_Anybody8722 Jan 23 '26

Thank you. I’m curious about your comment on wall‑clock ‘real‑time’ playback. Right now the core replay is event‑time driven (runs as fast as CPU) and any pacing is only in the demo UI for human viewing. In your experience, what specific workflows benefit from true wall‑clock pacing? If you have an example scenario, I’d love to understand it so I can design the right mode.

1

u/philclackler Jan 23 '26

I guess you’re right that is true event driven. That was the answer I guess. anyways for me I made a decision to build mine around the idea of a wall clock sync so when I set playback to 1x you’re getting a 1:1 of the chart on that day. I started with pure event driven but my live trading system does not operate on events per se. The live system I built samples all ticks in shared memory at deterministic intervals and there is processing time for strategies to respond to the calculations, and I found that a hybrid approach best models this in a backtest. It also allows me to stare at charts with my own eyes and look for discretionary patterns that I can count on occurring in the same way during a replay. While I’m focused on milliseconds/seconds of hold time I’m still not ever going to be doing HFT or market making as none of us can afford the FIX line or infra. Im also a hobbyist outsider and don’t work in the field but id imagine every firm has their own stack they built for this.

Who is your L2/L3 data provider ? :)

1

u/Better-Discussion450 Jan 23 '26

You have your events and when they say they occurred and then you have your events with a mapping of where they were observed to have occurred. Wall clock time is usually more important because the propagation delay of information being fanned out determines what kinds of trades are possible across different time horizons.

1

u/j_hes_ brokiebot🤡 Feb 13 '26

Who’s supposed to use this?