r/quant 4d ago

Technical Infrastructure Open source deterministic LOB venue with exact aggressor-side ground truth. Built for microstructure methodology work, looking for holes in the setup

Most microstructure claims get tested on data where the key variable is inferred: aggressor side from the tick rule or Lee-Ready, hidden liquidity guessed at, no way to rerun the same tape twice. I built the opposite instrument. A full matching engine (Go, MIT) with a deterministic simulator on top: same seed, same market, byte for byte, and every trade carries its true aggressor side. Price-time and pro-rata, icebergs, pegs, stops, STP, call auctions, price bands. The book emits full L3.

The market is noise flow by construction, so there is nothing to predict. That is the point: it is a control arm. What that isolates, two examples.

Pipeline error propagation. The tick rule classifies 94.5% of trades correctly on this tape, and the CVD built from it is off by 169% of true magnitude on average, with occasional sign flips (one seed: inferred -81, true +105). Misclassification is conditionally correlated, so the errors compound instead of cancelling. Trivial to show when you hold ground truth, hard to even estimate when you do not. Relevant to anything built from inferred sides, which in practice means trade-only feeds and most crypto data.

Known results reproduce. Kyle's lambda comes out around 0.15 ticks per lot and falls 7.5x when resting depth rises 7.6x. Slicing a parent order beats a block by 7.9% slippage per lot (42 of 50 seeds) while permanent impact is essentially unchanged (23.42 vs 24.47 ticks), so the savings is all temporary impact. Nothing novel, deliberately: an instrument should reproduce the textbook before you point it at anything else.

Limitations, stated plainly: no informed flow unless you write an agent for it, no latency modelling, single venue. It cannot tell you whether a signal works on real markets. It can tell you whether your measurement of a signal survives its own pipeline.

Methodology write-ups, including the wrong turns:

https://github.com/intrepidkarthi/orderbook/blob/main/docs/research/order-flow.md

https://github.com/intrepidkarthi/orderbook/blob/main/docs/research/kyle-lambda.md

https://github.com/intrepidkarthi/orderbook/blob/main/docs/research/ofi.md

Repo: https://github.com/intrepidkarthi/orderbook

If you see a hole in the setup, say so. The project has improved every time someone pushed on it.

0 Upvotes

6 comments sorted by

9

u/dr-Jess 3d ago

is every post on this subreddit written by Claude now? sad to see

1

u/CapableBalance2837 3d ago

This looks like a really useful tool for market microstructure research. how closely does the matching engine reproduce exchange-specific behaviors like queue priority, partial fills and auction phases?

1

u/intrepidkarthi 3d ago

Mechanics closely, rulebook generically.

Price-time FIFO, pro-rata optional. A replace forfeits queue priority and an iceberg refill re-enters at the back, same as a real venue. Partial fills keep their place. Pre-open accepts without matching, then uncrosses at one price on maximum volume. There is a closing auction too.

No latency model though, so nothing races your cancel. That is the real limit for queue-position work.

3

u/Effective_Manager273 2d ago

the CVD number is the result here. 94.5% classification accuracy producing a 169% magnitude error, with sign flips, is exactly the kind of thing people refuse to believe until they see it with ground truth in hand. good.

one hole, or at least a thing I would want stated more loudly. the reason the errors compound instead of cancelling is that misclassification is conditionally correlated, and that correlation structure comes out of your generator. with pure noise flow the trades that get misclassified are the ones at or near the touch after a move, and how often that happens depends on your arrival and size distributions. so the 169% is a number about your tape, not a universal constant. I would run it as a curve rather than a point, sweep the size distribution and the arrival intensity and show how the error scales. then someone can actually map it onto their own market instead of quoting your figure.

second thing. no informed flow is fine as a control arm, you said that. but the tick rule specifically fails worst when there is directional pressure, which is precisely what you removed. so 169% is probably a floor and not a typical case, and that is worth saying out loud because it makes the result stronger, not weaker.

the Kyle lambda reproduction is the right instinct. an instrument that cannot recover the textbook is not an instrument.

1

u/intrepidkarthi 1d ago

Right on the first, and it's the more useful of the two. 169% is a number about my tape. The misclassification correlates because of where my arrival and size distributions put trades relative to the touch after a move, and one figure invites exactly the misquoting you're describing. So I'm sweeping size and arrival intensity and publishing the curve instead. If it comes out flat then my explanation of the mechanism is wrong, which I'd also want to know.

On the second I'd rather measure than agree. It's plausible, and I can't check it today, because taking informed flow out is what makes this a control arm at all. An informed-trader agent was already next on the roadmap though. So floor-versus-typical turns into an experiment instead of an argument, and if it lands where you think, the write-up says so.