alexrichterxyz / research_limit_order_book

This C++ matching engine boasts a user friendly, efficient, yet highly customizable interface making it ideal for simulation and research purposes.
MIT License
4 stars 1 forks source link

Unit testing and benchmarking #3

Open Reidmen opened 1 year ago

Reidmen commented 1 year ago

Hi @alexrichterxyz

Interesting project!, just wondering, are you planning to include unit testing, benchmarking, etc? Kind of curious of the performance when doing matching against nasdaq open datasets

Otherwise, I'm curious about trying it out in the next couple of months 👍

alexrichterxyz commented 1 year ago

Hi @Reidmen ,

thanks for taking an interest in this project. I am absolutely planning on including unit testing. In fact, I have already implemented a simple framework for unit tests in the /test folder. I will most likely resume development in November. Other order types that I will implement are "One Cancels Other" (OCO) and "One Sends Other" (OSO).

The matching engine should be able to handle hundreds of thousands to millions of limit orders per second on standard hardware. Insertion is O(log(n)) and all other operations are O(1). Benchmarking it against the datasets you mentioned could be very useful and I will look into that. Thanks for the suggestion :)

Reidmen commented 1 year ago

I'll try to contribute if time allows, there is another open source project that achieves ~100 ns per insertion on average. Same dataset as in nasdaq open datasets.

It would be great to get those numbers here!

alexrichterxyz commented 1 year ago

Awesome. The current documentation is very basic. If you want we can schedule a quick Zoom call in October/November to introduce you to the codebase.

~100 ns seems doable on a 4GHz CPU like theirs.

Reidmen commented 1 year ago

Sure man, that would be great! Mid Oct sounds good to me!

In my work laptop (i7-10510U) on the dataset 01302020.NASDAQ_ITCH50 ~13GB I'm getting the following statistics:

ITCH processing...Done!

Errors: 0

Processing time: 2:39.829 m
Total ITCH messages: 423285709
ITCH message latency: 377 ns
ITCH message throughput: 2648363 msg/s
Total market updates: 914722608
Market update latency: 174 ns
Market update throughput: 5723127 upd/s

Order statistics:
Add order operations: 222445333
Update order operations: 8539126
Delete order operations: 222183004
Execute order operations: 17852982

getting those number with a simpler implementation would be cool to have!