I'm writing a backtester and using an order-by-order Nasdaq ITCH feed whilst testing it.

Let's say the bid-ask spread is 100 @ 9-11 @ 100

My strategy inserts an bid order for 100 @ 10 and this becomes the new best bid. I continue parsing the ITCH feed and I see that the 100 @ 9 has traded. This implies had I really placed a bid for 10, that would have traded now.

So instead of removing the bid at 9, I remove my own order and notify my strategy that we were just filled. However, in reality the bid at 9 disappeared and therefore ITCH would never send another message (i.e. cancel) for it because as far as they're concerned, it no longer exists. Therefore I am stuck with this order in the book, which actually shouldn't be there.

Is this situation unavoidable in a backtesting simulation? Or is there something I can/should do?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.