Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robaho/cpp_orderbook
a financial exchange in C++
https://github.com/robaho/cpp_orderbook
cpp20 exchange fix fixprotocol trading
Last synced: about 1 month ago
JSON representation
a financial exchange in C++
- Host: GitHub
- URL: https://github.com/robaho/cpp_orderbook
- Owner: robaho
- Created: 2024-06-17T19:32:29.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-10-15T22:13:43.000Z (2 months ago)
- Last Synced: 2024-10-20T08:16:09.656Z (2 months ago)
- Topics: cpp20, exchange, fix, fixprotocol, trading
- Language: C++
- Homepage:
- Size: 3.55 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Summary
This is a C++ implementation of a financial exchange. It is inspired by the Go version in [go-trader](https://github.com/robaho/go-trader).
It uses [cpp_fixed](https://github.com/robaho/cpp_fixed) to perform fixed decimal point integer math.
It supports limit and market orders.
## Building
Remove `fixed.h` , and run `make all` to obtain the latest version of the fixed point decimal library.
## Usage
See `exchange.h` for the public api. `orderbook.h` is the internal single threaded order book management.
## Performance
Running OSX on a 8-core 4.0 ghz Intel processor (only 4 real cores) with a single instrument.
```
Insert orders at 5.5M per second.
Insert orders with 30% trade match, 4M per second.
Cancel orders at 4M per second.
```Running same hardware with an instrument per core:
```
Insert orders at 21M per second.
Insert orders with 31% trade match, 17M per second.
Cancel orders at 15M per second.
```
Since the test is fully cpu bound, only the 4 real cores can be utilized but still achieving a linear speedup. This is achieved using a few highly efficient lock-free structures.It could probably bit a faster, but the design biases towards readability and safety.
See `benchmark_test.cpp` and `benchmark_multithread_test.cpp` for the performance tests.
## Next Steps
Add FIX protocol acceptor to enable testing with `go-trader` client.