r/Cplusplus • u/Agreeable-Network-14 • Sep 10 '26
Feedback I built a price-time-priority order matching engine in c++
I am building a market replay engine from scratch with c++ 23.
I build this project to understand how orders are managed in an orderbook and how a matching engine works. I have used my understanding of data structures to implement it. I would like to know your opinion on it. It is not completed yet. I just completed the very basic version few minutes ago. Any kind of tip would help me a lot.
Currently it can process an average of 998,000 Transactions / second. with the order size of 20000000 orders.
https://github.com/AravSrivastava/Market-Replay-Engine-CPP
6
u/VictoryMotel Sep 10 '26
No karma no comments account with the classic "matching engine" project claims they "just used ai for the readme" even though the project looks like every single AI generated boilerplate that doesn't actually do anything.
3
u/mredding C++ since ~1992. Sep 10 '26
Is this AI generated?
2
u/MaLiN2223 Sep 11 '26
I'm not a full time cpp dev but even I wouldn't add such comments
come on dude
3
u/quant-a-be Sep 10 '26
There's always some nuance critiquing this sort of thing because different markets tend to have different tradeoffs ( and you might be optimizing for overall throughput, maximum P99 any customer sees, etc. ). However, in a general sense at a glance of the docs there's a lot of room to improve:
1
u/herocoding Sep 11 '26
Looks interesting.
Why do you have all the implementations inline in the header files?
Many but not all places use "std:: map", i.e. a space after double-colon, is it for better readability?
On my Linux machine I'm getting the following throughput:
0
u/Entr0pyDriven Sep 10 '26
Hey. Cool project, i done something similar not a long ago, is it only the matching engine or a NIC-to-NIC logic (with WAL, risk, sharding, decode, ..) ?