Part 1/3: Order Matching Engine Requirements
Dev’s corner is a new section of BitShares News where developers involved with the BitShares project post technical related briefs and observations.
As an academic exercise, I wanted to take on building a order matching engine in C++. The purpose here is to iterate through the process of measuring and improving performance.
I imagine the initial requirements as naive, with later iterations including removal of floating point calculations, variable precision, 128-bit integers, “dust” handling (may be more of an implementation question than a performance one).
This order matching engine will be strictly single-threaded and purposeful. It is hoped that the input will be clean and optimized (which could be offloaded) to improve throughput.
Tooling will be sparse, on purpose. The idea here is not a discussion of the intricacies of the tools, but how tweaks to code affects speed.
The engine will receive limit orders that specify the asset held, the asset to be bought, and the desired price. It will include a sequential ID, externally guaranteed to be unique (such a key could be analyzed later… we’ll see…).
Once received, the order is processed and if not immediately filled, what is left over is placed on the order book.
Simple, right? There are many details yet to be sorted out. So we will get started! Stay tuned!
For the first cut of the order book, see this GitHub commit.
Stay tuned for Part II: "Order matching and Container Types".
Posted from BitShares News using SteemPress, see: https://news.bitshares.org/order-matching-engine/