{"id":26507444,"url":"https://github.com/jmakov/fsm","last_synced_at":"2025-03-20T23:19:44.144Z","repository":{"id":185975246,"uuid":"605643048","full_name":"jmakov/fsm","owner":"jmakov","description":"A performance oriented implementation of a state machine for order processing","archived":false,"fork":false,"pushed_at":"2023-06-18T20:30:26.000Z","size":2612,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-20T22:34:30.685Z","etag":null,"topics":["cpp","cpp20","hft","hft-","trading"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmakov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-23T15:40:34.000Z","updated_at":"2024-11-17T09:14:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"630b372e-0b0e-48de-bf4a-c470b1027f2e","html_url":"https://github.com/jmakov/fsm","commit_stats":null,"previous_names":["jmakov/fsm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmakov%2Ffsm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmakov%2Ffsm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmakov%2Ffsm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmakov%2Ffsm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmakov","download_url":"https://codeload.github.com/jmakov/fsm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244706543,"owners_count":20496571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp20","hft","hft-","trading"],"created_at":"2025-03-20T23:19:43.671Z","updated_at":"2025-03-20T23:19:44.138Z","avatar_url":"https://github.com/jmakov.png","language":"C++","readme":"# A performance oriented implementation of a state machine\n\n## Design decisions\n- 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). \n\n![Clang 15](assets/bench-clang15.png) ![GCC 12.1](assets/bench-gcc12.1.png)\n\n\n- Header only library\n- No internal/external events, no pre/post transition actions, no explicit guards other than preventing invalid \ntransitions (see examples).\n- The initial state is implicitly defined with the first element in `states`.\n\nTODO:\n- handle leveraged markets (e.g. margin calls)\n\n## Usage\nRun benchmarks:\n```shell\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake all\n./bin/benchmark_StaticPolymorphism\n```\n## Examples\nIn `example/OrderFSM.hpp` we show how to implement this state graph of an order with IOT, IOK, GTD and GTC.\n\n![State graph](assets/state_graph.jpg)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmakov%2Ffsm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmakov%2Ffsm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmakov%2Ffsm/lists"}