Quant Infrastructure #5 - Order Executor
A guide to robust order tracking in a trading infrastructure.
In the previous article of the main series, we looked at robustly tracking our trading inventory and built an Inventory component for our Quant Infrastructure.
In this article, we look at tracking and managing orders and build an OrderExecutor for this purpose. Orders require a different approach from the Inventory because we actively control them as opposed to passively taking information from the exchange.
The technique we will show is commonly known as orders-in-flight. The implementation we will build will be simple and robust to errors, both theoretical and those encountered in practice during real trading.
We will address common problems such as duplicate orders and ghost orders and ensure that our order tracking is consistent with our inventory — which we covered in the previous article from the Inventory component’s side.
For consistency, I assume the Inventory component is similar to what we described in the previous part of the series.
Today’s article is free to read. As per usual, the complete source code is attached at the end of the article for paying subscribers.
We will use straightforward Rust to allow readers using other languages to follow and adapt the code to their language of choice relatively easily if they wish.
The article is exchange-agnostic and the techniques shown work on most if not all CEX exchanges such as Binance, Bybit, etc. I have not tested them with any DEXes, however — though I suspect they work there just as well.
Keep reading with a 7-day free trial
Subscribe to TaiwanQuant's Newsletter to keep reading this post and get 7 days of free access to the full post archives.