https://github.com/jmakov/fsm
A performance oriented implementation of a state machine for order processing
https://github.com/jmakov/fsm
cpp cpp20 hft hft- trading
Last synced: about 1 year ago
JSON representation
A performance oriented implementation of a state machine for order processing
- Host: GitHub
- URL: https://github.com/jmakov/fsm
- Owner: jmakov
- License: apache-2.0
- Created: 2023-02-23T15:40:34.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-18T20:30:26.000Z (almost 3 years ago)
- Last Synced: 2024-12-20T22:34:30.685Z (over 1 year ago)
- Topics: cpp, cpp20, hft, hft-, trading
- Language: C++
- Homepage:
- Size: 2.49 MB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A performance oriented implementation of a state machine
## Design decisions
- Based on benchmark this implementation is based on the CRTP visitor pattern as it seem to be the fastest between LLVM 15 and GCC 12.1 (pictured).
 
- Header only library
- No internal/external events, no pre/post transition actions, no explicit guards other than preventing invalid
transitions (see examples).
- The initial state is implicitly defined with the first element in `states`.
TODO:
- handle leveraged markets (e.g. margin calls)
## Usage
Run benchmarks:
```shell
mkdir build && cd build
cmake ..
make all
./bin/benchmark_StaticPolymorphism
```
## Examples
In `example/OrderFSM.hpp` we show how to implement this state graph of an order with IOT, IOK, GTD and GTC.
