A realistic order simulation framework
Why I wrote ordersim
Issue 1 is coming. Before we get there, indulge me for a minute — I want to talk about a useful open-source project. You guessed it: mine. But it’s open source, so it’s now officially yours too.
ordersim gives you exchange matching-engine-level realism in how your orders fill. I recommend that level of granularity for anyone serious about trading. And even if you never touch ordersim — be absolutely anal about simulator precision when you write, or shop around for, a “backtester.” I’m not so narcissistic as to point only at my own: hftbacktest stands out in the field — serious queue-position and latency modelling, though crypto- and HFT-focused. (No affiliation) The honest truth is the field is short. Do the research. Mostly you will find tools people call “backtesters” run at bar level and quietly bury the exact fill assumptions that matter.
And they do.
If you’ve read some of my earlier pieces — or simply been exposed to real trading — you’ll know how big the gap can be between what a backtest tells you and what the market actually does to your order. And you’ll have understood by now how much hinges on the simulation framework and its assumptions. Yes, assumptions. Every backtester has them. The question is: how crude are they? How many are packed into the system? And are they independent, or additive?
That difference — between the fill you assumed and the fill you got — is not a rounding error.
So, why use this simulator and not just the others referenced?
Over almost two and a half decades, every three or four years, I’ve started another order simulator from scratch — because the organization needed one, or because I needed one for my own research. I grew tired of it. I’m hoping to have something central now, something I can reuse without building it again from the ground up. The logic in it is mine: the assumptions, the matching behaviour, the things twenty-five years of watching orders meet real books taught me to model and not to fudge. This last build started as futures research. I had it cleaned up and repackaged for open source — but I was watching every line closely, because in a tool like this the fill logic is the product, and every iota matters.
Self-promotion that appears like selfishness masquerading as selflessness? Or is it the other way around?
ordersim needs you. Not in the abstract “stars and forks” way — your questions, your scrutiny, your taking issue with it. And your use of it. If it helps you make a lot of money, it makes you richer and me happier. That’s the deal. The beauty of good open source — for everyone, by everyone — is that it ends up built by the people who are best in class. That’s the version of “by everyone” I love.
It’s on GitHub. pip install ordersim. Break it, use it, tell me where it’s wrong.


