Skip to content
/ fsm Public

A performance oriented implementation of a state machine for order processing

License

Notifications You must be signed in to change notification settings

jmakov/fsm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Clang 15 GCC 12.1

  • 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:

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.

State graph

About

A performance oriented implementation of a state machine for order processing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published