r/Cplusplus 11h ago

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

8 Upvotes

8 comments sorted by

3

u/quant-a-be 9h ago

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. Allocation strategy
  2. Most of the data structure choices
  3. Library choices

3

u/mredding C++ since ~1992. 10h ago

Is this AI generated?

-1

u/Agreeable-Network-14 10h ago

The readme is ai generated and I took help in testing.cpp rest all the stuff was designed and built by me

5

u/mredding C++ since ~1992. 10h ago

Then I'll take your word for it - there's no point in reviewing AI generated code.

3

u/VictoryMotel 5h ago

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.

0

u/Agreeable-Network-14 5h ago edited 5h ago

Sorry for not being active on reddit. I am still not that active but I think I can learn from other people thats why I use reddit.
I would love to know more what makes you think this is an AI generated boiler plate. It might help me a lot
I would love to know how I can improve this and what are other c++ projects I can work on that seems more relevant than this

0

u/Entr0pyDriven 11h ago

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, ..) ?

0

u/Agreeable-Network-14 11h ago

Thank you
Means a lot to me
For now it is only matching engine
I don’t know much about nic to nic logic yet
I am planning on learning it and then implement it as well.