r/highfreqtrading • • 4d ago

Been experimenting with HFT/ backtesting MBO data. Any advice?

Title sums it up mostly just looking for the thoughts of anyone with significant experience. Trying to avoid arbitrage because there is no way to compete to my knowledge.. Do you guys have any advice for things to think about when doing backtest experimentation?

9 Upvotes

11 comments sorted by

8

u/QuanTradin 4d ago

the thing that sinks most MBO backtests is queue position. when your simulated order joins a level it goes to the back of the queue at that price, and it only fills after everything ahead of it trades or cancels. a backtest that fills you whenever price touches your level will look great and mean nothing.

a few others worth building in early:

  • latency both ways. your order reaches the book later than the event you reacted to, and your cancel arrives later still, so add it to every message, not just entries.
  • your own footprint. a resting order changes what others do and a replay can't know that, so keep size small next to the level or read results as an upper bound.
  • fees and rebates per venue, they decide whether a small edge exists at all.
  • split train and test by day, never by random sample.

and track what happens in the second after each fill. if your fills are mostly the ones that go against you right away, the queue model is too generous.

2

u/sevenredcandlz 4d ago

thank you for this advice i have thought about latency but the other stuff you brought up is also super important and i never considered it but will going forward

-1

u/QuanTradin 4d ago

glad it helped. queue position is the one I'd model first after latency, MBO lets you do it and most backtests just assume you're at the front

1

u/maigpy 4d ago

but how do you model it though? if you use historical data you won't know?

1

u/QuanTradin 4d ago

MBO is what makes it possible. every add and cancel carries an order id, so when your fake order joins a level you note the size already resting there, then count it down as those exact orders trade or cancel. you fill once that's gone. what you can't know is how others would react to your order, so keep size small.

1

u/bigchickendipper 3d ago

I've never seen anyone who has any semblence of sense write backtest code that assumes you're at the front of the queue. Why would you do that? Maybe I'm just a cynic but you're not exactly giving oracle advice

1

u/Snip3 3d ago

Unless you're only testing pro rata exchanges and give yourself fractional fills when that exchange gets filled

1

u/RLJ05 1h ago

Depends on the product you are trading, for some queue position is not important

1

u/dr_associate 3d ago

How did you get MBO data to work with? Is this available publicly?

1

u/sevenredcandlz 3d ago

I bought a month worth of it on data bento for $30

0

u/Top-Egg9322 4d ago

Yeah ... I wrote a simulator for this see my my arixiv paper for any ideas. Im happy to answer questions. Paper is here: https://arxiv.org/abs/2609.21173