├── .clang-format
├── .clang-tidy
├── .github
├── docker
│ ├── Build_Marketsim.Dockerfile
│ ├── Deploy_Marketsim.Dockerfile
│ ├── Postgres_Marketsim.Dockerfile
│ ├── init.sql
│ └── liquibase_custom.Dockerfile
└── workflows
│ ├── build-builder-image.yml
│ ├── build-deploy-documentation.yml
│ ├── build-liquibase-image.yml
│ ├── build-postgres-image.yml
│ └── marketsim-ci.yml
├── .gitignore
├── CMakeLists.txt
├── CMakePresets.json
├── LICENSE
├── README.md
├── THIRD-PARTY-LICENSES.md
├── cfg
├── client_qasimulator.xml
├── configSim.txt
└── default
│ ├── FIX50SP2_marketsimulator.xml
│ └── FIXT11_marketsimulator.xml
├── cmake
├── CheckDependencyExist.cmake
├── Conan.cmake
├── TargetInit.cmake
├── TargetTest.cmake
├── build
│ ├── Archive.cmake
│ ├── CompilerWarnings.cmake
│ ├── PreventInSourceBuilds.cmake
│ ├── StandardProjectSettings.cmake
│ └── Version.cmake
└── utils
│ ├── Git.cmake
│ ├── Sanitizers.cmake
│ ├── StaticAnalyzers.cmake
│ └── TimeTrace.cmake
├── db
├── external-price-seed
│ ├── root-changelog.yml
│ └── schema
│ │ ├── changelog.yml
│ │ └── tables
│ │ └── price_seed.yml
├── market-simulator
│ ├── root-changelog.yml
│ ├── sample-data
│ │ ├── changelog.yml
│ │ ├── common
│ │ │ ├── changelog.yml
│ │ │ └── setting.yml
│ │ └── demo
│ │ │ ├── changelog.yml
│ │ │ └── xetra
│ │ │ ├── changelog.yml
│ │ │ ├── listings
│ │ │ ├── 1-AMZ.yml
│ │ │ ├── 2-MSF.yml
│ │ │ ├── 3-NFC.yml
│ │ │ ├── 4-VODI.yml
│ │ │ └── 5-VOW.yml
│ │ │ ├── price_seeds
│ │ │ ├── 1-AMZ.yml
│ │ │ ├── 2-MSF.yml
│ │ │ ├── 3-NFC.yml
│ │ │ ├── 4-VODI.yml
│ │ │ └── 5-VOW.yml
│ │ │ ├── setting
│ │ │ └── setting.yml
│ │ │ └── venue.yml
│ └── schema
│ │ ├── changelog.yml
│ │ ├── constraints
│ │ ├── data_source.yml
│ │ ├── listing.yml
│ │ ├── market_phase.yml
│ │ └── venue.yml
│ │ ├── keys
│ │ ├── column_mapping.yml
│ │ ├── data_source.yml
│ │ ├── listing.yml
│ │ ├── market_phase.yml
│ │ ├── price_seed.yml
│ │ ├── setting.yml
│ │ └── venue.yml
│ │ ├── sequences
│ │ ├── data_source.yml
│ │ ├── listing.yml
│ │ └── price_seed.yml
│ │ └── tables
│ │ ├── column_mapping.yml
│ │ ├── data_source.yml
│ │ ├── listing.yml
│ │ ├── market_phase.yml
│ │ ├── price_seed.yml
│ │ ├── setting.yml
│ │ └── venue.yml
└── root-changelog.yml
├── docs
├── FIXRulesOfEngagement
│ ├── AdminMessages
│ │ └── AdminMessages.adoc
│ ├── CommonComponents
│ │ └── CommonComponents.adoc
│ ├── FIXRulesOfEngagement.adoc
│ ├── Introduction
│ │ ├── Cover.odt
│ │ ├── Cover.pdf
│ │ └── Introduction.adoc
│ ├── MessageFlows
│ │ └── MessageFlows.adoc
│ ├── PhaseReportingMessages
│ │ └── PhaseReportingMessages.adoc
│ ├── PreTradeMessages
│ │ └── PreTradeMessages.adoc
│ ├── TradeMessages
│ │ └── TradeMessages.adoc
│ ├── build.bat
│ ├── build.sh
│ └── images
│ │ ├── 01MktDataIncrementalMsg.png
│ │ ├── 02MktDataStreamingMsg.png
│ │ ├── 03MktDataSnapReqRsp.png
│ │ ├── 04MktDataReqRct.png
│ │ ├── 05MktDataNewOrderSgl.png
│ │ ├── 06MktDataNewOrderRct.png
│ │ ├── 07MktDataExeRpt.png
│ │ ├── 08MktDataCancel.png
│ │ ├── 09MktDataPartialCancel.png
│ │ ├── 10MktDataOrderReplace.png
│ │ ├── 11MktDataCancelReject.png
│ │ ├── 12MktDataCancelSuccess.png
│ │ ├── 13MktDataCancelReplaceReject.png
│ │ ├── 14MktDataStsReport.png
│ │ ├── 15MktDataStsSnapSht.png
│ │ └── 16MktDataStsReject.png
├── Overview
│ ├── Overview.adoc
│ ├── build.bat
│ └── build.sh
├── RESTAPI
│ ├── AdministrativeCommands
│ │ └── AdministrativeCommands.adoc
│ ├── AdministrativeSettings
│ │ └── AdministrativeSettings.adoc
│ ├── General
│ │ └── General.adoc
│ ├── Introduction
│ │ ├── Cover.odt
│ │ ├── Cover.pdf
│ │ └── Introduction.adoc
│ ├── RESTAPI.adoc
│ ├── build.bat
│ ├── build.sh
│ └── images
│ │ └── 17pricebook.png
├── common
│ ├── adoc
│ │ ├── docinfo-footer.html
│ │ ├── docinfo.html
│ │ ├── header.adoc
│ │ └── titleblock.adoc
│ ├── favicon.ico
│ └── pdf
│ │ ├── Logo.png
│ │ └── PDFTheme.yml
└── index.html
├── images
├── image01_dark.png
├── image01_light.png
├── image02_dark.png
└── image02_light.png
├── project
├── CMakeLists.txt
├── app
│ ├── CMakeLists.txt
│ ├── ih
│ │ ├── application.hpp
│ │ ├── command_options.hpp
│ │ ├── components
│ │ │ ├── fix_acceptor.hpp
│ │ │ ├── generator.hpp
│ │ │ ├── http_server.hpp
│ │ │ └── trading_engine.hpp
│ │ ├── dispatchers
│ │ │ └── venue_trading_reply_dispatcher.hpp
│ │ ├── loading.hpp
│ │ ├── loop.hpp
│ │ └── platforms
│ │ │ ├── platform.hpp
│ │ │ └── venue_simulation_platform.hpp
│ ├── src
│ │ ├── application.cpp
│ │ ├── command_options.cpp
│ │ ├── loading.cpp
│ │ ├── loop.cpp
│ │ ├── main.cpp
│ │ └── platforms
│ │ │ └── venue_simulation_platform.cpp
│ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── test_main.cpp
│ │ └── unit_tests
│ │ └── command_options_tests.cpp
├── cfg
│ ├── CMakeLists.txt
│ ├── include
│ │ └── cfg
│ │ │ └── api
│ │ │ └── cfg.hpp
│ └── src
│ │ ├── cfg_impl.cpp
│ │ └── cfg_impl.hpp
├── core
│ ├── CMakeLists.txt
│ ├── include
│ │ └── core
│ │ │ ├── common
│ │ │ ├── attribute.hpp
│ │ │ ├── enum_converter.hpp
│ │ │ ├── json
│ │ │ │ ├── field.hpp
│ │ │ │ ├── type.hpp
│ │ │ │ ├── type_container.hpp
│ │ │ │ ├── type_enum.hpp
│ │ │ │ └── type_struct.hpp
│ │ │ ├── meta.hpp
│ │ │ ├── name.hpp
│ │ │ ├── return_code.hpp
│ │ │ ├── std_formatter.hpp
│ │ │ └── unreachable.hpp
│ │ │ ├── domain
│ │ │ ├── attributes.hpp
│ │ │ ├── enumerators.hpp
│ │ │ ├── instrument_descriptor.hpp
│ │ │ ├── json
│ │ │ │ ├── instrument_descriptor.hpp
│ │ │ │ ├── market_phase.hpp
│ │ │ │ └── party.hpp
│ │ │ ├── market_data_entry.hpp
│ │ │ ├── market_phase.hpp
│ │ │ └── party.hpp
│ │ │ ├── tools
│ │ │ ├── format.hpp
│ │ │ ├── numeric.hpp
│ │ │ ├── overload.hpp
│ │ │ ├── string_checkers.hpp
│ │ │ └── time.hpp
│ │ │ └── version.hpp
│ ├── src
│ │ ├── common
│ │ │ ├── json
│ │ │ │ └── type.cpp
│ │ │ └── return_code.cpp
│ │ ├── domain
│ │ │ ├── attributes.cpp
│ │ │ ├── composites.cpp
│ │ │ ├── enumerators.cpp
│ │ │ ├── market_phase.cpp
│ │ │ └── party.cpp
│ │ ├── tools
│ │ │ ├── string_checkers.cpp
│ │ │ └── time.cpp
│ │ └── version.cpp
│ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── fixtures
│ │ └── given_expected_fixture.hpp
│ │ ├── test_definitions
│ │ └── test_attributes.hpp
│ │ ├── test_main.cpp
│ │ ├── test_utils
│ │ └── matchers.hpp
│ │ └── unit_tests
│ │ ├── common
│ │ ├── attributes_tests.cpp
│ │ ├── enum_converter_tests.cpp
│ │ ├── json
│ │ │ ├── attribute_tests.cpp
│ │ │ ├── attributes_tests.cpp
│ │ │ ├── type_container_tests.cpp
│ │ │ ├── type_enum_tests.cpp
│ │ │ ├── type_struct_tests.cpp
│ │ │ └── type_tests.cpp
│ │ └── return_code_tests.cpp
│ │ ├── domain
│ │ ├── enumerators_tests.cpp
│ │ ├── instrument_descriptor_tests.cpp
│ │ ├── market_phase_tests.cpp
│ │ └── party_tests.cpp
│ │ └── tools
│ │ ├── numeric_tests.cpp
│ │ ├── string_checkers_tests.cpp
│ │ └── time_tests.cpp
├── data_layer
│ ├── CMakeLists.txt
│ ├── ih
│ │ ├── common
│ │ │ ├── command
│ │ │ │ ├── commands.hpp
│ │ │ │ └── handlers.hpp
│ │ │ ├── database
│ │ │ │ ├── context_resolver.hpp
│ │ │ │ ├── driver.hpp
│ │ │ │ └── ping_agent.hpp
│ │ │ ├── exceptions.hpp
│ │ │ └── queries
│ │ │ │ └── data_extractor.hpp
│ │ ├── formatters
│ │ │ └── pqxx
│ │ │ │ └── context.hpp
│ │ └── pqxx
│ │ │ ├── common
│ │ │ ├── column_resolver.hpp
│ │ │ ├── enumeration_resolver.hpp
│ │ │ └── names
│ │ │ │ ├── database_entries.hpp
│ │ │ │ └── enumerations.hpp
│ │ │ ├── context.hpp
│ │ │ ├── dao
│ │ │ ├── datasource_dao.hpp
│ │ │ ├── listing_dao.hpp
│ │ │ ├── price_seed_dao.hpp
│ │ │ ├── setting_dao.hpp
│ │ │ └── venue_dao.hpp
│ │ │ ├── database
│ │ │ ├── connector.hpp
│ │ │ ├── transaction.hpp
│ │ │ └── value_sanitizer.hpp
│ │ │ ├── queries
│ │ │ ├── datasource_queries.hpp
│ │ │ ├── detail
│ │ │ │ ├── delete_query_builder.hpp
│ │ │ │ ├── insert_query_builder.hpp
│ │ │ │ ├── predicate_formatter.hpp
│ │ │ │ ├── select_query_builder.hpp
│ │ │ │ └── update_query_builder.hpp
│ │ │ ├── listing_queries.hpp
│ │ │ ├── price_seed_queries.hpp
│ │ │ ├── setting_queries.hpp
│ │ │ └── venue_queries.hpp
│ │ │ └── result
│ │ │ ├── datasource_parser.hpp
│ │ │ ├── detail
│ │ │ └── basic_row_parser.hpp
│ │ │ ├── listing_parser.hpp
│ │ │ ├── price_seed_parser.hpp
│ │ │ ├── setting_parser.hpp
│ │ │ └── venue_parser.hpp
│ ├── include
│ │ └── data_layer
│ │ │ └── api
│ │ │ ├── converters
│ │ │ └── column_mapping.hpp
│ │ │ ├── data_access_layer.hpp
│ │ │ ├── database
│ │ │ └── context.hpp
│ │ │ ├── exceptions
│ │ │ └── exceptions.hpp
│ │ │ ├── inspectors
│ │ │ ├── column_mapping.hpp
│ │ │ ├── datasource.hpp
│ │ │ ├── listing.hpp
│ │ │ ├── market_phase.hpp
│ │ │ ├── price_seed.hpp
│ │ │ ├── setting.hpp
│ │ │ └── venue.hpp
│ │ │ ├── models
│ │ │ ├── column_mapping.hpp
│ │ │ ├── datasource.hpp
│ │ │ ├── listing.hpp
│ │ │ ├── market_phase.hpp
│ │ │ ├── price_seed.hpp
│ │ │ ├── setting.hpp
│ │ │ └── venue.hpp
│ │ │ ├── predicate
│ │ │ ├── definitions.hpp
│ │ │ ├── expression.hpp
│ │ │ ├── lexeme.hpp
│ │ │ ├── predicate.hpp
│ │ │ └── traits.hpp
│ │ │ └── validations
│ │ │ ├── column_mapping.hpp
│ │ │ └── datasource.hpp
│ ├── src
│ │ ├── api
│ │ │ ├── converters
│ │ │ │ └── column_mapping.cpp
│ │ │ ├── data_access_layer.cpp
│ │ │ ├── database
│ │ │ │ └── context.cpp
│ │ │ ├── exceptions
│ │ │ │ └── exceptions.cpp
│ │ │ ├── models
│ │ │ │ ├── column_mapping.cpp
│ │ │ │ ├── datasource.cpp
│ │ │ │ ├── listing.cpp
│ │ │ │ ├── market_phase.cpp
│ │ │ │ ├── price_seed.cpp
│ │ │ │ ├── setting.cpp
│ │ │ │ └── venue.cpp
│ │ │ └── validations
│ │ │ │ ├── column_mapping.cpp
│ │ │ │ └── datasource.cpp
│ │ ├── common
│ │ │ ├── database
│ │ │ │ └── ping_agent.cpp
│ │ │ └── exceptions.cpp
│ │ └── pqxx
│ │ │ ├── common
│ │ │ ├── column_resolver.cpp
│ │ │ └── enumeration_resolver.cpp
│ │ │ ├── context.cpp
│ │ │ ├── dao
│ │ │ ├── datasource_dao.cpp
│ │ │ ├── listing_dao.cpp
│ │ │ ├── price_seed_dao.cpp
│ │ │ ├── setting_dao.cpp
│ │ │ └── venue_dao.cpp
│ │ │ └── database
│ │ │ └── connector.cpp
│ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── common
│ │ ├── marshaller.hpp
│ │ └── model.hpp
│ │ ├── test_main.cpp
│ │ ├── test_utils
│ │ ├── matchers.hpp
│ │ └── sanitizer_stub.hpp
│ │ └── unit_tests
│ │ ├── common
│ │ ├── command
│ │ │ └── commands_tests.cpp
│ │ ├── database
│ │ │ └── ping_agent_tests.cpp
│ │ └── queries
│ │ │ └── data_extractor_tests.cpp
│ │ ├── converters
│ │ └── column_mapping_tests.cpp
│ │ ├── inspectors
│ │ ├── column_mapping_inspectors_tests.cpp
│ │ ├── datasource_inspectors_tests.cpp
│ │ ├── listing_inspectors_tests.cpp
│ │ ├── market_phase_inspectors_tests.cpp
│ │ ├── price_seed_inspectors_tests.cpp
│ │ ├── setting_inspectors_tests.cpp
│ │ └── venue_inspectors_tests.cpp
│ │ ├── models
│ │ ├── column_mapping_tests.cpp
│ │ ├── datasource_tests.cpp
│ │ ├── listing_tests.cpp
│ │ ├── market_phase_tests.cpp
│ │ ├── price_seed_tests.cpp
│ │ ├── setting_tests.cpp
│ │ └── venue_tests.cpp
│ │ ├── pqxx
│ │ ├── common
│ │ │ ├── column_resolver_tests.cpp
│ │ │ └── enumeration_resolver_tests.cpp
│ │ ├── context_tests.cpp
│ │ ├── database
│ │ │ ├── connector_tests.cpp
│ │ │ └── transaction_tests.cpp
│ │ └── queries
│ │ │ ├── datasource_queries_tests.cpp
│ │ │ ├── detail
│ │ │ ├── delete_query_builder_tests.cpp
│ │ │ ├── insert_query_builder_tests.cpp
│ │ │ ├── predicate_formatter_tests.cpp
│ │ │ ├── select_query_builder_tests.cpp
│ │ │ └── update_query_builder_tests.cpp
│ │ │ ├── listing_queries_tests.cpp
│ │ │ ├── price_seed_queries_tests.cpp
│ │ │ ├── setting_queries_tests.cpp
│ │ │ └── venue_queries_tests.cpp
│ │ ├── predicate
│ │ ├── expression_tests.cpp
│ │ └── lexemes_tests.cpp
│ │ └── validations
│ │ ├── column_mapping_tests.cpp
│ │ └── datasource_tests.cpp
├── fix
│ ├── CMakeLists.txt
│ ├── acceptor
│ │ ├── CMakeLists.txt
│ │ ├── ih
│ │ │ ├── acceptor.hpp
│ │ │ ├── communicators
│ │ │ │ ├── application.hpp
│ │ │ │ ├── fix_reply_sender.hpp
│ │ │ │ └── reply_sender.hpp
│ │ │ ├── mapping
│ │ │ │ ├── from_fix_mapper.hpp
│ │ │ │ └── to_fix_mapper.hpp
│ │ │ └── processors
│ │ │ │ ├── app_event_processor.hpp
│ │ │ │ ├── app_reply_processor.hpp
│ │ │ │ ├── app_request_processor.hpp
│ │ │ │ ├── event_processor.hpp
│ │ │ │ └── request_processor.hpp
│ │ ├── include
│ │ │ └── acceptor
│ │ │ │ ├── acceptor.hpp
│ │ │ │ ├── lifetime.hpp
│ │ │ │ └── transport.hpp
│ │ ├── src
│ │ │ ├── acceptor.cpp
│ │ │ ├── communicators
│ │ │ │ ├── application.cpp
│ │ │ │ └── fix_reply_sender.cpp
│ │ │ └── mapping
│ │ │ │ ├── from_fix_mapper.cpp
│ │ │ │ └── to_fix_mapper.cpp
│ │ └── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── mocks
│ │ │ ├── event_processor_mock.hpp
│ │ │ ├── from_fix_mapper_stub.hpp
│ │ │ ├── reply_sender_mock.hpp
│ │ │ ├── request_processor_mock.hpp
│ │ │ ├── to_fix_mapper_stub.hpp
│ │ │ └── trading_request_receiver_mock.hpp
│ │ │ ├── test_main.cpp
│ │ │ └── unit_tests
│ │ │ ├── communicators
│ │ │ └── application_tests.cpp
│ │ │ ├── mapping
│ │ │ ├── from_fix_mapper_tests.cpp
│ │ │ └── to_fix_mapper_tests.cpp
│ │ │ └── processors
│ │ │ ├── app_reply_processor_tests.cpp
│ │ │ └── app_request_processor_tests.cpp
│ └── common
│ │ ├── CMakeLists.txt
│ │ ├── include
│ │ └── common
│ │ │ ├── custom_fields.hpp
│ │ │ ├── custom_values.hpp
│ │ │ ├── fix_logger.hpp
│ │ │ ├── mapping
│ │ │ ├── checks.hpp
│ │ │ ├── detail
│ │ │ │ ├── definitions.hpp
│ │ │ │ ├── error_reporting.hpp
│ │ │ │ ├── from_fix_conversion.hpp
│ │ │ │ └── to_fix_conversion.hpp
│ │ │ ├── from_fix_mapping.hpp
│ │ │ ├── setting
│ │ │ │ ├── mapping_settings.hpp
│ │ │ │ └── timestamp_precision.hpp
│ │ │ └── to_fix_mapping.hpp
│ │ │ ├── message_store.hpp
│ │ │ ├── meta.hpp
│ │ │ ├── session_conversion.hpp
│ │ │ └── session_settings.hpp
│ │ ├── src
│ │ ├── fix_logger.cpp
│ │ ├── mapping
│ │ │ ├── detail
│ │ │ │ ├── from_fix_conversion.cpp
│ │ │ │ └── to_fix_conversion.cpp
│ │ │ └── setting
│ │ │ │ └── mapping_settings.cpp
│ │ ├── message_store.cpp
│ │ ├── session_conversion.cpp
│ │ └── session_settings.cpp
│ │ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── test_main.cpp
│ │ └── unit_tests
│ │ ├── mapping
│ │ ├── checks_tests.cpp
│ │ ├── from_fix_conversion_tests.cpp
│ │ ├── from_fix_mapping_tests.cpp
│ │ ├── setting
│ │ │ └── mapping_settings_tests.cpp
│ │ └── to_fix_conversion_tests.cpp
│ │ ├── session_conversion_tests.cpp
│ │ └── settings_tests.cpp
├── generator
│ ├── CMakeLists.txt
│ ├── ih
│ │ ├── adaptation
│ │ │ ├── generated_message.hpp
│ │ │ └── protocol_conversion.hpp
│ │ ├── constants.hpp
│ │ ├── context
│ │ │ ├── component_context.hpp
│ │ │ ├── generation_manager.hpp
│ │ │ ├── instrument_context.hpp
│ │ │ ├── order_generation_context.hpp
│ │ │ ├── order_generation_context_impl.hpp
│ │ │ └── order_market_data_provider.hpp
│ │ ├── factory
│ │ │ ├── executable_factory.hpp
│ │ │ └── executable_factory_impl.hpp
│ │ ├── generator.hpp
│ │ ├── generator_impl.hpp
│ │ ├── historical
│ │ │ ├── adapters
│ │ │ │ ├── csv_reader.hpp
│ │ │ │ ├── data_access_adapter.hpp
│ │ │ │ └── postgresql_connector.hpp
│ │ │ ├── data
│ │ │ │ ├── provider.hpp
│ │ │ │ ├── record.hpp
│ │ │ │ └── time.hpp
│ │ │ ├── mapping
│ │ │ │ ├── column_mapping_filter.hpp
│ │ │ │ ├── configurator.hpp
│ │ │ │ ├── datasource_params.hpp
│ │ │ │ ├── depth_config.hpp
│ │ │ │ ├── params.hpp
│ │ │ │ └── specification.hpp
│ │ │ ├── parsing
│ │ │ │ ├── params.hpp
│ │ │ │ ├── parsing.hpp
│ │ │ │ └── row.hpp
│ │ │ ├── processor.hpp
│ │ │ ├── record_applier.hpp
│ │ │ ├── replier.hpp
│ │ │ └── scheduler.hpp
│ │ ├── random
│ │ │ ├── algorithm
│ │ │ │ ├── generation_algorithm.hpp
│ │ │ │ ├── order_generation_algorithm.hpp
│ │ │ │ └── utils
│ │ │ │ │ ├── attributes_setter.hpp
│ │ │ │ │ ├── max_mktdepth_selector.hpp
│ │ │ │ │ ├── price_params_selector.hpp
│ │ │ │ │ └── quantity_params_selector.hpp
│ │ │ ├── generators
│ │ │ │ ├── counterparty_generator.hpp
│ │ │ │ ├── event_generator.hpp
│ │ │ │ ├── price_generator.hpp
│ │ │ │ ├── quantity_generator.hpp
│ │ │ │ ├── resting_order_action_generator.hpp
│ │ │ │ ├── value_generator.hpp
│ │ │ │ └── value_generator_impl.hpp
│ │ │ ├── instrument_generator.hpp
│ │ │ ├── utils.hpp
│ │ │ └── values
│ │ │ │ ├── event.hpp
│ │ │ │ ├── price_generation_params.hpp
│ │ │ │ ├── quantity_generation_params.hpp
│ │ │ │ └── resting_order_action.hpp
│ │ ├── registry
│ │ │ ├── generated_order_data.hpp
│ │ │ ├── generated_orders_registry.hpp
│ │ │ ├── generated_orders_registry_impl.hpp
│ │ │ └── registry_updater.hpp
│ │ ├── tracing
│ │ │ ├── json_tracer.hpp
│ │ │ ├── null_tracer.hpp
│ │ │ ├── trace_logger.hpp
│ │ │ ├── trace_value.hpp
│ │ │ └── tracing.hpp
│ │ └── utils
│ │ │ ├── executable.hpp
│ │ │ ├── executor.hpp
│ │ │ ├── parsers.hpp
│ │ │ ├── request_builder.hpp
│ │ │ └── validator.hpp
│ ├── include
│ │ └── generator
│ │ │ └── generator.hpp
│ ├── src
│ │ ├── adaptation
│ │ │ ├── generated_message.cpp
│ │ │ └── protocol_conversion.cpp
│ │ ├── context
│ │ │ ├── generation_manager.cpp
│ │ │ ├── order_generation_context_impl.cpp
│ │ │ └── order_market_data_provider.cpp
│ │ ├── factory
│ │ │ └── executable_factory_impl.cpp
│ │ ├── generator.cpp
│ │ ├── generator_impl.cpp
│ │ ├── historical
│ │ │ ├── adapters
│ │ │ │ ├── csv_reader.cpp
│ │ │ │ ├── data_access_adapter.cpp
│ │ │ │ └── postgresql_connector.cpp
│ │ │ ├── data
│ │ │ │ ├── provider.cpp
│ │ │ │ └── record.cpp
│ │ │ ├── mapping
│ │ │ │ ├── column_mapping_filter.cpp
│ │ │ │ ├── configurator.cpp
│ │ │ │ ├── datasource_params.cpp
│ │ │ │ ├── params.cpp
│ │ │ │ └── specification.cpp
│ │ │ ├── parsing
│ │ │ │ ├── params.cpp
│ │ │ │ └── parsing.cpp
│ │ │ ├── processor.cpp
│ │ │ ├── record_applier.cpp
│ │ │ ├── replier.cpp
│ │ │ └── scheduler.cpp
│ │ ├── random
│ │ │ ├── algorithm
│ │ │ │ ├── order_generation_algorithm.cpp
│ │ │ │ └── utils
│ │ │ │ │ └── quantity_params_selector.cpp
│ │ │ ├── generators
│ │ │ │ ├── counterparty_generator.cpp
│ │ │ │ ├── event_generator.cpp
│ │ │ │ ├── price_generator.cpp
│ │ │ │ ├── quantity_generator.cpp
│ │ │ │ ├── resting_order_action_generator.cpp
│ │ │ │ └── value_generator_impl.cpp
│ │ │ ├── instrument_generator.cpp
│ │ │ └── values
│ │ │ │ ├── event.cpp
│ │ │ │ ├── price_generation_params.cpp
│ │ │ │ ├── quantity_generation_params.cpp
│ │ │ │ └── resting_order_action.cpp
│ │ ├── registry
│ │ │ ├── generated_orders_registry_impl.cpp
│ │ │ └── registry_updater.cpp
│ │ └── utils
│ │ │ ├── executor.cpp
│ │ │ ├── parsers.cpp
│ │ │ ├── request_builder.cpp
│ │ │ └── validator.cpp
│ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── mocks
│ │ ├── context
│ │ │ └── order_context.hpp
│ │ ├── historical
│ │ │ ├── data_access_adapter.hpp
│ │ │ └── provider.hpp
│ │ ├── random
│ │ │ ├── counterparty_generator.hpp
│ │ │ ├── price_generator.hpp
│ │ │ ├── quantity_generator.hpp
│ │ │ ├── random_event_generator.hpp
│ │ │ ├── resting_order_action_generator.hpp
│ │ │ └── value_generator.hpp
│ │ ├── registry
│ │ │ └── generated_orders_registry.hpp
│ │ └── trading_request_channel.hpp
│ │ ├── test_main.cpp
│ │ ├── test_utils
│ │ ├── generated_message_utils.hpp
│ │ ├── historical_data_utils.hpp
│ │ └── historical_mapping_utils.hpp
│ │ └── unit_tests
│ │ ├── adaptation
│ │ ├── instrument_descriptor_conversion_tests.cpp
│ │ └── to_protocol_message_conversion_tests.cpp
│ │ ├── context
│ │ └── generation_manager_tests.cpp
│ │ ├── historical
│ │ ├── adapters
│ │ │ ├── csv_reader_tests.cpp
│ │ │ └── data_access_adapter_tests.cpp
│ │ ├── data
│ │ │ ├── action_tests.cpp
│ │ │ ├── level_tests.cpp
│ │ │ ├── provider_tests.cpp
│ │ │ └── record_tests.cpp
│ │ ├── mapping
│ │ │ ├── column_mapping_filter_tests.cpp
│ │ │ ├── configurator_default_association_tests.cpp
│ │ │ ├── configurator_no_source_columns_tests.cpp
│ │ │ ├── configurator_tests.cpp
│ │ │ ├── depth_config_tests.cpp
│ │ │ ├── source_column_tests.cpp
│ │ │ └── specification_tests.cpp
│ │ ├── parsing
│ │ │ ├── csv_parsing_params_tests.cpp
│ │ │ ├── database_parsing_params_tests.cpp
│ │ │ ├── general_datasource_params_tests.cpp
│ │ │ ├── params_tests.cpp
│ │ │ ├── parsing_tests.cpp
│ │ │ ├── parsing_value_tests.cpp
│ │ │ └── row_tests.cpp
│ │ ├── record_applier_tests.cpp
│ │ └── record_checker_tests.cpp
│ │ ├── random
│ │ ├── algorithm
│ │ │ ├── order_generation_algorithm_tests.cpp
│ │ │ └── utils
│ │ │ │ ├── attributes_setter_tests.cpp
│ │ │ │ ├── max_mktdepth_selector_tests.cpp
│ │ │ │ ├── price_params_selector_tests.cpp
│ │ │ │ └── quantity_params_selector_tests.cpp
│ │ ├── generators
│ │ │ ├── counterparty_generator_tests.cpp
│ │ │ ├── event_generator_tests.cpp
│ │ │ ├── price_generator_tests.cpp
│ │ │ ├── quantity_generator_tests.cpp
│ │ │ ├── resting_order_action_generator_tests.cpp
│ │ │ └── value_generator_impl_tests.cpp
│ │ └── values
│ │ │ ├── event_tests.cpp
│ │ │ ├── price_generation_params_tests.cpp
│ │ │ ├── quantity_generation_params_tests.cpp
│ │ │ └── resting_order_action_tests.cpp
│ │ ├── registry
│ │ ├── generated_order_data_tests.cpp
│ │ ├── generated_orders_registry_tests.cpp
│ │ └── registry_updater_tests.cpp
│ │ ├── tracing
│ │ ├── json_tracer_tests.cpp
│ │ └── trace_value_tests.cpp
│ │ └── utils
│ │ └── validator_tests.cpp
├── http
│ ├── CMakeLists.txt
│ ├── ih
│ │ ├── constants.hpp
│ │ ├── controllers
│ │ │ ├── datasource_controller.hpp
│ │ │ ├── listing_controller.hpp
│ │ │ ├── price_seed_controller.hpp
│ │ │ ├── setting_controller.hpp
│ │ │ ├── trading_controller.hpp
│ │ │ └── venue_controller.hpp
│ │ ├── data_bridge
│ │ │ ├── datasource_accessor.hpp
│ │ │ ├── listing_accessor.hpp
│ │ │ ├── operation_failure.hpp
│ │ │ ├── price_seed_accessor.hpp
│ │ │ ├── setting_accessor.hpp
│ │ │ └── venue_accessor.hpp
│ │ ├── endpoint.hpp
│ │ ├── formatters
│ │ │ ├── redirect.hpp
│ │ │ └── request_formatter.hpp
│ │ ├── headers
│ │ │ └── x_api_version.hpp
│ │ ├── marshalling
│ │ │ └── json
│ │ │ │ ├── datasource.hpp
│ │ │ │ ├── detail
│ │ │ │ ├── enumeration_resolver.hpp
│ │ │ │ ├── key_resolver.hpp
│ │ │ │ ├── keys.hpp
│ │ │ │ ├── marshaller.hpp
│ │ │ │ ├── traits.hpp
│ │ │ │ ├── unmarshaller.hpp
│ │ │ │ └── utils.hpp
│ │ │ │ ├── halt.hpp
│ │ │ │ ├── listing.hpp
│ │ │ │ ├── price_seed.hpp
│ │ │ │ ├── setting.hpp
│ │ │ │ └── venue.hpp
│ │ ├── processors
│ │ │ ├── delete_processor.hpp
│ │ │ ├── get_processor.hpp
│ │ │ ├── post_processor.hpp
│ │ │ └── put_processor.hpp
│ │ ├── redirect
│ │ │ ├── destination.hpp
│ │ │ ├── destination_resolver.hpp
│ │ │ ├── redirection_processor.hpp
│ │ │ ├── redirector.hpp
│ │ │ ├── request.hpp
│ │ │ ├── request_redirector.hpp
│ │ │ ├── resolver.hpp
│ │ │ └── result.hpp
│ │ ├── router.hpp
│ │ ├── server.hpp
│ │ └── utils
│ │ │ └── response_formatters.hpp
│ ├── include
│ │ └── http
│ │ │ └── http.hpp
│ ├── src
│ │ ├── controllers
│ │ │ ├── datasource_controller.cpp
│ │ │ ├── listing_controller.cpp
│ │ │ ├── price_seed_controller.cpp
│ │ │ ├── setting_controller.cpp
│ │ │ ├── trading_controller.cpp
│ │ │ └── venue_controller.cpp
│ │ ├── data_bridge
│ │ │ ├── datasource_accessor.cpp
│ │ │ ├── listing_accessor.cpp
│ │ │ ├── price_seed_accessor.cpp
│ │ │ ├── setting_accessor.cpp
│ │ │ └── venue_accessor.cpp
│ │ ├── http.cpp
│ │ ├── marshalling
│ │ │ └── json
│ │ │ │ ├── datasource.cpp
│ │ │ │ ├── detail
│ │ │ │ ├── enumeration_resolver.cpp
│ │ │ │ └── key_resolver.cpp
│ │ │ │ ├── halt.cpp
│ │ │ │ ├── listing.cpp
│ │ │ │ ├── price_seed.cpp
│ │ │ │ ├── setting.cpp
│ │ │ │ └── venue.cpp
│ │ ├── processors
│ │ │ ├── delete_processor.cpp
│ │ │ ├── get_processor.cpp
│ │ │ ├── post_processor.cpp
│ │ │ └── put_processor.cpp
│ │ ├── redirect
│ │ │ ├── destination_resolver.cpp
│ │ │ ├── redirection_processor.cpp
│ │ │ └── request_redirector.cpp
│ │ └── router.cpp
│ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── mocks
│ │ ├── redirector.hpp
│ │ ├── resolver.hpp
│ │ ├── trading_admin_request_receiver.hpp
│ │ └── venue_accessor.hpp
│ │ ├── test_main.cpp
│ │ ├── test_utils
│ │ ├── matchers.hpp
│ │ └── test_server.hpp
│ │ └── unit_tests
│ │ ├── controllers
│ │ └── trading_controller_tests.cpp
│ │ ├── headers
│ │ └── x_api_version_tests.cpp
│ │ ├── marshalling
│ │ └── json
│ │ │ ├── datasource_marshalling_tests.cpp
│ │ │ ├── detail
│ │ │ ├── enumeration_resolver_tests.cpp
│ │ │ ├── key_resolver_tests.cpp
│ │ │ ├── marshaller_tests.cpp
│ │ │ └── unmarshaller_tests.cpp
│ │ │ ├── halt_unmarshalling_tests.cpp
│ │ │ ├── listing_marshalling_tests.cpp
│ │ │ ├── price_seed_marshalling_tests.cpp
│ │ │ ├── setting_marshalling_tests.cpp
│ │ │ └── venue_marshalling_tests.cpp
│ │ └── redirect
│ │ ├── destination_resolver_tests.cpp
│ │ ├── redirection_processor_tests.cpp
│ │ ├── request_redirector_tests.cpp
│ │ └── result_tests.cpp
├── log
│ ├── CMakeLists.txt
│ ├── ih
│ │ ├── custom_spd_flags.hpp
│ │ ├── factories
│ │ │ ├── logger_factory.hpp
│ │ │ └── sink_factory.hpp
│ │ └── util.hpp
│ ├── include
│ │ └── log
│ │ │ ├── logger.hpp
│ │ │ └── logging.hpp
│ ├── src
│ │ ├── custom_spd_flags.cpp
│ │ ├── factories
│ │ │ └── logger_factory.cpp
│ │ ├── logger.cpp
│ │ └── util.cpp
│ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── test_main.cpp
│ │ ├── test_utils
│ │ ├── matchers.hpp
│ │ └── rapidjson_utils.hpp
│ │ └── unit_tests
│ │ ├── custom_spd_flags_tests.cpp
│ │ ├── factories
│ │ ├── logger_factory_tests.cpp
│ │ └── sink_factory_tests.cpp
│ │ ├── logger_tests.cpp
│ │ ├── logging_tests.cpp
│ │ └── util_tests.cpp
├── middleware
│ ├── CMakeLists.txt
│ ├── ih
│ │ └── channels.hpp
│ ├── include
│ │ └── middleware
│ │ │ ├── channels
│ │ │ ├── detail
│ │ │ │ └── receiver.hpp
│ │ │ ├── generator_admin_channel.hpp
│ │ │ ├── trading_admin_channel.hpp
│ │ │ ├── trading_reply_channel.hpp
│ │ │ ├── trading_request_channel.hpp
│ │ │ └── trading_session_event_channel.hpp
│ │ │ └── routing
│ │ │ ├── errors.hpp
│ │ │ ├── generator_admin_channel.hpp
│ │ │ ├── trading_admin_channel.hpp
│ │ │ ├── trading_reply_channel.hpp
│ │ │ ├── trading_request_channel.hpp
│ │ │ └── trading_session_event_channel.hpp
│ ├── src
│ │ └── middleware.cpp
│ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── mocks
│ │ ├── generator_admin_receiver_mock.hpp
│ │ ├── trading_admin_receiver_mock.hpp
│ │ ├── trading_reply_receiver_mock.hpp
│ │ ├── trading_request_receiver_mock.hpp
│ │ └── trading_session_event_listener_mock.hpp
│ │ ├── test_main.cpp
│ │ ├── test_utils
│ │ └── protocol_utils.hpp
│ │ └── unit_tests
│ │ ├── generator_admin_channel_tests.cpp
│ │ ├── trading_admin_channel_tests.cpp
│ │ ├── trading_reply_channel_tests.cpp
│ │ ├── trading_request_channel_tests.cpp
│ │ └── trading_session_event_channel_tests.cpp
├── protocol
│ ├── CMakeLists.txt
│ ├── include
│ │ └── protocol
│ │ │ ├── admin
│ │ │ ├── generator.hpp
│ │ │ ├── market_state.hpp
│ │ │ └── trading_phase.hpp
│ │ │ ├── app
│ │ │ ├── business_message_reject.hpp
│ │ │ ├── execution_report.hpp
│ │ │ ├── instrument_state_request.hpp
│ │ │ ├── market_data_reject.hpp
│ │ │ ├── market_data_request.hpp
│ │ │ ├── market_data_snapshot.hpp
│ │ │ ├── market_data_update.hpp
│ │ │ ├── order_cancellation_confirmation.hpp
│ │ │ ├── order_cancellation_reject.hpp
│ │ │ ├── order_cancellation_request.hpp
│ │ │ ├── order_modification_confirmation.hpp
│ │ │ ├── order_modification_reject.hpp
│ │ │ ├── order_modification_request.hpp
│ │ │ ├── order_placement_confirmation.hpp
│ │ │ ├── order_placement_reject.hpp
│ │ │ ├── order_placement_request.hpp
│ │ │ ├── security_status.hpp
│ │ │ ├── security_status_request.hpp
│ │ │ └── session_terminated_event.hpp
│ │ │ └── types
│ │ │ ├── json
│ │ │ └── session.hpp
│ │ │ └── session.hpp
│ ├── src
│ │ ├── admin.cpp
│ │ ├── app.cpp
│ │ └── types.cpp
│ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── test_main.cpp
│ │ └── unit_tests
│ │ └── types
│ │ └── session_tests.cpp
└── trading_system
│ ├── CMakeLists.txt
│ ├── components
│ ├── common
│ │ ├── CMakeLists.txt
│ │ ├── include
│ │ │ └── common
│ │ │ │ ├── attributes.hpp
│ │ │ │ ├── events.hpp
│ │ │ │ ├── instrument.hpp
│ │ │ │ ├── json
│ │ │ │ ├── instrument.hpp
│ │ │ │ └── trade.hpp
│ │ │ │ ├── market_state
│ │ │ │ ├── json
│ │ │ │ │ ├── instrument_info.hpp
│ │ │ │ │ ├── instrument_state.hpp
│ │ │ │ │ ├── limit_order.hpp
│ │ │ │ │ ├── order_book.hpp
│ │ │ │ │ ├── session.hpp
│ │ │ │ │ └── snapshot.hpp
│ │ │ │ └── snapshot.hpp
│ │ │ │ ├── phase.hpp
│ │ │ │ ├── trade.hpp
│ │ │ │ └── trading_engine.hpp
│ │ ├── src
│ │ │ ├── attributes.cpp
│ │ │ ├── instrument.cpp
│ │ │ ├── phase.cpp
│ │ │ ├── snapshot.cpp
│ │ │ └── trade.cpp
│ │ └── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── test_main.cpp
│ │ │ ├── test_utils
│ │ │ └── matchers.hpp
│ │ │ └── unit_tests
│ │ │ ├── events_tests.cpp
│ │ │ ├── instrument_test.cpp
│ │ │ ├── market_state
│ │ │ ├── instrument_info_tests.cpp
│ │ │ ├── instrument_state_tests.cpp
│ │ │ ├── limit_order_tests.cpp
│ │ │ ├── order_book_tests.cpp
│ │ │ ├── session_tests.cpp
│ │ │ ├── session_type_tests.cpp
│ │ │ └── snapshot_tests.cpp
│ │ │ ├── phase_test.cpp
│ │ │ └── trade_tests.cpp
│ ├── idgen
│ │ ├── CMakeLists.txt
│ │ ├── benchmarks
│ │ │ ├── CMakeLists.txt
│ │ │ └── idgen_benchmarks.cpp
│ │ ├── ih
│ │ │ ├── contexts
│ │ │ │ ├── execution_id_context.hpp
│ │ │ │ ├── instrument_id_context.hpp
│ │ │ │ ├── market_entry_id_context.hpp
│ │ │ │ └── order_id_context.hpp
│ │ │ ├── generation.hpp
│ │ │ └── sequences
│ │ │ │ ├── chrono_sequence.hpp
│ │ │ │ ├── common.hpp
│ │ │ │ └── numeric_sequence.hpp
│ │ ├── include
│ │ │ └── idgen
│ │ │ │ ├── errors.hpp
│ │ │ │ ├── execution_id.hpp
│ │ │ │ ├── instrument_id.hpp
│ │ │ │ ├── market_entry_id.hpp
│ │ │ │ └── order_id.hpp
│ │ ├── src
│ │ │ ├── contexts
│ │ │ │ ├── execution_id_context.cpp
│ │ │ │ ├── instrument_id_context.cpp
│ │ │ │ ├── market_entry_id_context.cpp
│ │ │ │ └── order_id_context.cpp
│ │ │ ├── generation.cpp
│ │ │ └── idgen.cpp
│ │ └── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── api_tests
│ │ │ └── api_test.cpp
│ │ │ ├── test_main.cpp
│ │ │ └── unit_tests
│ │ │ ├── generation
│ │ │ ├── execution_id_generation_tests.cpp
│ │ │ ├── instrument_id_generation_tests.cpp
│ │ │ ├── market_entry_id_generation_tests.cpp
│ │ │ └── order_id_generation_tests.cpp
│ │ │ └── sequences
│ │ │ ├── chrono_sequence_tests.cpp
│ │ │ └── numeric_sequence_tests.cpp
│ ├── ies
│ │ ├── CMakeLists.txt
│ │ ├── ih
│ │ │ ├── controller_impl.hpp
│ │ │ ├── phases
│ │ │ │ ├── phase_scheduler.hpp
│ │ │ │ └── states.hpp
│ │ │ ├── system_tick_controller.hpp
│ │ │ ├── tick_event_factory.hpp
│ │ │ └── trading_phase_controller.hpp
│ │ ├── include
│ │ │ └── ies
│ │ │ │ ├── controller.hpp
│ │ │ │ ├── phase_record.hpp
│ │ │ │ └── phase_schedule.hpp
│ │ ├── src
│ │ │ ├── controller.cpp
│ │ │ ├── phase_schedule.cpp
│ │ │ ├── phases
│ │ │ │ └── states.cpp
│ │ │ └── trading_phase_controller.cpp
│ │ └── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── test_main.cpp
│ │ │ └── unit_tests
│ │ │ ├── phase_schedule_test.cpp
│ │ │ ├── phases
│ │ │ ├── phase_scheduler_test.cpp
│ │ │ └── states_test.cpp
│ │ │ ├── tick_event_factory_test.cpp
│ │ │ └── trading_phase_controller_test.cpp
│ ├── instruments
│ │ ├── CMakeLists.txt
│ │ ├── ih
│ │ │ ├── instruments_cache.hpp
│ │ │ ├── instruments_container.hpp
│ │ │ ├── instruments_matcher.hpp
│ │ │ └── lookup
│ │ │ │ ├── currency_category.hpp
│ │ │ │ ├── lookup.hpp
│ │ │ │ ├── match_rate.hpp
│ │ │ │ ├── matchers.hpp
│ │ │ │ └── strategies.hpp
│ │ ├── include
│ │ │ └── instruments
│ │ │ │ ├── cache.hpp
│ │ │ │ ├── lookup_error.hpp
│ │ │ │ ├── matcher.hpp
│ │ │ │ ├── sources.hpp
│ │ │ │ └── view.hpp
│ │ ├── src
│ │ │ ├── instruments.cpp
│ │ │ ├── instruments_cache.cpp
│ │ │ ├── instruments_matcher.cpp
│ │ │ ├── lookup
│ │ │ │ ├── lookup.cpp
│ │ │ │ ├── matchers.cpp
│ │ │ │ └── strategies.cpp
│ │ │ └── sources.cpp
│ │ └── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── api_tests
│ │ │ ├── cache_tests.cpp
│ │ │ └── matcher_tests.cpp
│ │ │ ├── test_main.cpp
│ │ │ ├── test_utils
│ │ │ └── utils.hpp
│ │ │ └── unit_tests
│ │ │ ├── currency_category_tests.cpp
│ │ │ ├── instruments_cache_test.cpp
│ │ │ ├── instruments_container_test.cpp
│ │ │ ├── instruments_matcher_tests.cpp
│ │ │ ├── lookup_tests.cpp
│ │ │ ├── match_rate_tests.cpp
│ │ │ ├── matchers_tests.cpp
│ │ │ ├── sources_test.cpp
│ │ │ └── strategies_tests.cpp
│ ├── matching_engine
│ │ ├── CMakeLists.txt
│ │ ├── ih
│ │ │ ├── commands
│ │ │ │ ├── client_notification_cache.hpp
│ │ │ │ └── commands.hpp
│ │ │ ├── common
│ │ │ │ ├── abstractions
│ │ │ │ │ ├── event_listener.hpp
│ │ │ │ │ ├── market_data_publisher.hpp
│ │ │ │ │ ├── market_data_request_processor.hpp
│ │ │ │ │ ├── order_event_handler.hpp
│ │ │ │ │ └── order_request_processor.hpp
│ │ │ │ ├── data
│ │ │ │ │ └── market_data_updates.hpp
│ │ │ │ ├── events
│ │ │ │ │ ├── client_notification.hpp
│ │ │ │ │ ├── event.hpp
│ │ │ │ │ ├── event_reporter.hpp
│ │ │ │ │ └── order_book_notification.hpp
│ │ │ │ └── validation
│ │ │ │ │ ├── checker_utils.hpp
│ │ │ │ │ ├── conclusion.hpp
│ │ │ │ │ └── validation.hpp
│ │ │ ├── dispatching
│ │ │ │ └── event_dispatcher.hpp
│ │ │ ├── implementation.hpp
│ │ │ ├── market_data
│ │ │ │ ├── actions
│ │ │ │ │ └── market_data_recover.hpp
│ │ │ │ ├── cache
│ │ │ │ │ ├── cache_manager.hpp
│ │ │ │ │ ├── depth_cache.hpp
│ │ │ │ │ ├── instrument_info_cache.hpp
│ │ │ │ │ ├── market_data_provider.hpp
│ │ │ │ │ └── trade_cache.hpp
│ │ │ │ ├── depth
│ │ │ │ │ ├── depth_level.hpp
│ │ │ │ │ ├── depth_node.hpp
│ │ │ │ │ ├── depth_node_comparator.hpp
│ │ │ │ │ ├── depth_quantity_list.hpp
│ │ │ │ │ ├── depth_record.hpp
│ │ │ │ │ ├── depth_sheet.hpp
│ │ │ │ │ ├── depth_stats_reader.hpp
│ │ │ │ │ ├── full_depth_update.hpp
│ │ │ │ │ └── incremental_depth_update.hpp
│ │ │ │ ├── market_data_facade.hpp
│ │ │ │ ├── streaming_settings.hpp
│ │ │ │ ├── subscriptions
│ │ │ │ │ ├── subscription.hpp
│ │ │ │ │ └── subscription_manager.hpp
│ │ │ │ ├── tools
│ │ │ │ │ ├── algorithms.hpp
│ │ │ │ │ ├── instrument_px.hpp
│ │ │ │ │ ├── market_entry_id_generator.hpp
│ │ │ │ │ └── notification_creators.hpp
│ │ │ │ └── validation
│ │ │ │ │ ├── checkers.hpp
│ │ │ │ │ ├── errors.hpp
│ │ │ │ │ ├── market_data_validator.hpp
│ │ │ │ │ └── validator.hpp
│ │ │ └── orders
│ │ │ │ ├── actions
│ │ │ │ ├── cancellation.hpp
│ │ │ │ ├── elimination.hpp
│ │ │ │ ├── limit_order_recover.hpp
│ │ │ │ ├── order_action_handler.hpp
│ │ │ │ ├── regular_amendment.hpp
│ │ │ │ ├── regular_order_action_processor.hpp
│ │ │ │ └── regular_placement.hpp
│ │ │ │ ├── book
│ │ │ │ ├── limit_order.hpp
│ │ │ │ ├── market_order.hpp
│ │ │ │ ├── order_algorithms.hpp
│ │ │ │ ├── order_book.hpp
│ │ │ │ ├── order_metadata.hpp
│ │ │ │ └── order_updates.hpp
│ │ │ │ ├── matchers
│ │ │ │ ├── order_matcher.hpp
│ │ │ │ └── regular_order_matcher.hpp
│ │ │ │ ├── order_system_facade.hpp
│ │ │ │ ├── phase_handler.hpp
│ │ │ │ ├── replies
│ │ │ │ ├── cancellation_reply_builders.hpp
│ │ │ │ ├── client_reject_reporter.hpp
│ │ │ │ ├── execution_reply_builders.hpp
│ │ │ │ ├── modification_reply_builders.hpp
│ │ │ │ ├── placement_reply_builders.hpp
│ │ │ │ └── reject_notifier.hpp
│ │ │ │ ├── requests
│ │ │ │ └── interpretation.hpp
│ │ │ │ ├── tools
│ │ │ │ ├── exec_id_generator.hpp
│ │ │ │ ├── id_conversion.hpp
│ │ │ │ ├── notification_creators.hpp
│ │ │ │ ├── order_book_state_converter.hpp
│ │ │ │ ├── order_id_generator.hpp
│ │ │ │ └── order_lookup.hpp
│ │ │ │ └── validation
│ │ │ │ ├── checkers.hpp
│ │ │ │ ├── client_request_validator.hpp
│ │ │ │ ├── errors.hpp
│ │ │ │ ├── order_book_side.hpp
│ │ │ │ └── validator.hpp
│ │ ├── include
│ │ │ └── matching_engine
│ │ │ │ ├── configuration.hpp
│ │ │ │ └── matching_engine.hpp
│ │ ├── src
│ │ │ ├── commands
│ │ │ │ ├── client_notification_cache.cpp
│ │ │ │ └── commands.cpp
│ │ │ ├── dispatching
│ │ │ │ └── event_dispatcher.cpp
│ │ │ ├── implementation.cpp
│ │ │ ├── market_data
│ │ │ │ ├── actions
│ │ │ │ │ └── market_data_recover.cpp
│ │ │ │ ├── cache
│ │ │ │ │ ├── cache_manager.cpp
│ │ │ │ │ ├── depth_cache.cpp
│ │ │ │ │ ├── instrument_info_cache.cpp
│ │ │ │ │ └── trade_cache.cpp
│ │ │ │ ├── depth
│ │ │ │ │ ├── depth_node.cpp
│ │ │ │ │ ├── depth_quantity_list.cpp
│ │ │ │ │ ├── depth_sheet.cpp
│ │ │ │ │ ├── full_depth_update.cpp
│ │ │ │ │ └── incremental_depth_update.cpp
│ │ │ │ ├── market_data_facade.cpp
│ │ │ │ ├── subscriptions
│ │ │ │ │ ├── subscription.cpp
│ │ │ │ │ └── subscription_manager.cpp
│ │ │ │ ├── tools
│ │ │ │ │ └── market_entry_id_generator.cpp
│ │ │ │ └── validation
│ │ │ │ │ ├── checkers.cpp
│ │ │ │ │ └── market_data_validator.cpp
│ │ │ ├── matching_engine.cpp
│ │ │ └── orders
│ │ │ │ ├── actions
│ │ │ │ ├── cancellation.cpp
│ │ │ │ ├── elimination.cpp
│ │ │ │ ├── limit_order_recover.cpp
│ │ │ │ ├── regular_amendment.cpp
│ │ │ │ ├── regular_order_action_processor.cpp
│ │ │ │ └── regular_placement.cpp
│ │ │ │ ├── book
│ │ │ │ ├── order_book.cpp
│ │ │ │ └── orders.cpp
│ │ │ │ ├── matchers
│ │ │ │ └── regular_order_matcher.cpp
│ │ │ │ ├── order_system_facade.cpp
│ │ │ │ ├── phase_handler.cpp
│ │ │ │ ├── replies
│ │ │ │ ├── client_reject_reporter.cpp
│ │ │ │ └── reply_builders.cpp
│ │ │ │ ├── requests
│ │ │ │ └── interpretation.cpp
│ │ │ │ ├── tools
│ │ │ │ ├── exec_id_generator.cpp
│ │ │ │ ├── id_conversion.cpp
│ │ │ │ ├── notification_creators.cpp
│ │ │ │ ├── order_book_state_converter.cpp
│ │ │ │ ├── order_id_generator.cpp
│ │ │ │ └── order_lookup.cpp
│ │ │ │ └── validation
│ │ │ │ ├── checkers.cpp
│ │ │ │ └── client_request_validator.cpp
│ │ └── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── actions
│ │ │ └── save_copy_constructible.hpp
│ │ │ ├── mocks
│ │ │ ├── event_listener_mock.hpp
│ │ │ ├── market_data_publisher_mock.hpp
│ │ │ ├── mock_client_notification_listener.hpp
│ │ │ ├── mock_execution_reports_listener.hpp
│ │ │ ├── mock_market_entry_id_generator.hpp
│ │ │ ├── mock_order_id_generator.hpp
│ │ │ ├── mocks.cpp
│ │ │ ├── order_event_handler_mock.hpp
│ │ │ └── trading_reply_receiver_mock.hpp
│ │ │ ├── test_main.cpp
│ │ │ ├── tools
│ │ │ ├── fake_depth_node.hpp
│ │ │ ├── matchers.hpp
│ │ │ ├── order_book_notification_builder.hpp
│ │ │ ├── order_test_tools.hpp
│ │ │ ├── protocol_test_tools.hpp
│ │ │ └── tools.cpp
│ │ │ └── unit_tests
│ │ │ ├── commands
│ │ │ ├── phase_transition_command_tests.cpp
│ │ │ └── tick_command_tests.cpp
│ │ │ ├── common
│ │ │ ├── data
│ │ │ │ └── market_data_updates_tests.cpp
│ │ │ └── validation
│ │ │ │ ├── checker_utils_tests.cpp
│ │ │ │ ├── conclusion_tests.cpp
│ │ │ │ └── validation_tests.cpp
│ │ │ ├── dispatching
│ │ │ └── event_dispatcher_tests.cpp
│ │ │ ├── market_data
│ │ │ ├── actions
│ │ │ │ └── market_data_recover_tests.cpp
│ │ │ ├── depth_cache_tests.cpp
│ │ │ ├── depth_node_comparator_tests.cpp
│ │ │ ├── depth_node_tests.cpp
│ │ │ ├── depth_quantity_list_tests.cpp
│ │ │ ├── depth_sheet_tests.cpp
│ │ │ ├── depth_stats_reader_tests.cpp
│ │ │ ├── full_depth_update_tests.cpp
│ │ │ ├── incremental_depth_update.cpp
│ │ │ ├── instrument_info_cache_tests.cpp
│ │ │ ├── instrument_px_tests.cpp
│ │ │ ├── streaming_settings_tests.cpp
│ │ │ ├── trade_cache_tests.cpp
│ │ │ └── validation
│ │ │ │ ├── checkers_tests.cpp
│ │ │ │ ├── errors_tests.cpp
│ │ │ │ └── market_data_validator_tests.cpp
│ │ │ └── orders
│ │ │ ├── actions
│ │ │ ├── all_orders_elimination_tests.cpp
│ │ │ ├── limit_order_recover_tests.cpp
│ │ │ └── system_elimination_tests.cpp
│ │ │ ├── book
│ │ │ ├── better_order_comparator_tests.cpp
│ │ │ ├── limit_order_tests.cpp
│ │ │ ├── market_order_tests.cpp
│ │ │ ├── order_algorithms_tests.cpp
│ │ │ └── order_book_tests.cpp
│ │ │ ├── matchers
│ │ │ └── regular_order_matcher_tests.cpp
│ │ │ ├── replies
│ │ │ ├── cancellation_reply_builders_tests.cpp
│ │ │ ├── client_reject_reporter_tests.cpp
│ │ │ ├── execution_reply_builders_tests.cpp
│ │ │ ├── modification_reply_builders_tests.cpp
│ │ │ └── placement_reply_builders_tests.cpp
│ │ │ ├── requests
│ │ │ └── interpretation_tests.cpp
│ │ │ ├── tools
│ │ │ ├── notification_creators_tests.cpp
│ │ │ └── order_book_state_converter_tests.cpp
│ │ │ └── validation
│ │ │ ├── checkers_tests.cpp
│ │ │ ├── client_request_validator_tests.cpp
│ │ │ └── errors_tests.cpp
│ └── runtime
│ │ ├── CMakeLists.txt
│ │ ├── ih
│ │ ├── chained_mux.hpp
│ │ ├── loop_impl.hpp
│ │ ├── mux_impl.hpp
│ │ ├── one_second_rate_loop.hpp
│ │ ├── simple_thread_pool.hpp
│ │ └── thread_pool_impl.hpp
│ │ ├── include
│ │ └── runtime
│ │ │ ├── loop.hpp
│ │ │ ├── mux.hpp
│ │ │ ├── service.hpp
│ │ │ └── thread_pool.hpp
│ │ ├── src
│ │ ├── chained_mux.cpp
│ │ ├── one_second_rate_loop.cpp
│ │ ├── runtime.cpp
│ │ └── simple_thread_pool.cpp
│ │ └── tests
│ │ ├── CMakeLists.txt
│ │ ├── test_main.cpp
│ │ └── unit_tests
│ │ ├── chained_mux_test.cpp
│ │ ├── one_second_rate_loop_test.cpp
│ │ └── simple_thread_pool_test.cpp
│ ├── ih
│ ├── config
│ │ ├── config.hpp
│ │ ├── phase_entry_reader.hpp
│ │ └── venue_entry_reader.hpp
│ ├── execution
│ │ ├── execution_system.hpp
│ │ └── reject_notifier.hpp
│ ├── repository
│ │ ├── repository_accessor.hpp
│ │ └── trading_engines_repository.hpp
│ ├── state_persistence
│ │ ├── market_state_persistence_controller.hpp
│ │ └── serializer.hpp
│ ├── tools
│ │ ├── instrument_resolver.hpp
│ │ ├── loaders.hpp
│ │ └── trading_engine_factory.hpp
│ ├── trading_system.hpp
│ └── trading_system_facade.hpp
│ ├── include
│ └── trading_system
│ │ └── trading_system.hpp
│ ├── src
│ ├── config.cpp
│ ├── execution
│ │ ├── execution_system.cpp
│ │ └── reject_notifier.cpp
│ ├── repository
│ │ ├── repository_accessor.cpp
│ │ └── trading_engines_repository.cpp
│ ├── state_persistence
│ │ ├── market_state_persistence_controller.cpp
│ │ └── serializer.cpp
│ ├── tools
│ │ ├── instrument_resolver.cpp
│ │ ├── loaders.cpp
│ │ └── trading_engine_factory.cpp
│ ├── trading_system.cpp
│ └── trading_system_facade.cpp
│ └── tests
│ ├── CMakeLists.txt
│ ├── mocks
│ ├── executor_mock.hpp
│ ├── instrument_resolver_mock.hpp
│ ├── repository_accessor_mock.hpp
│ ├── serializer_mock.hpp
│ ├── trading_engine_mock.hpp
│ └── trading_reply_receiver_mock.hpp
│ ├── test_main.cpp
│ └── unit_tests
│ ├── config
│ ├── phase_entry_reader_tests.cpp
│ └── venue_entry_reader_tests.cpp
│ ├── execution
│ ├── execution_system_tests.cpp
│ └── reject_notifier_tests.cpp
│ ├── repository
│ └── trading_engines_repository_tests.cpp
│ ├── state_persistence
│ ├── market_state_persistence_controller_tests.cpp
│ └── serializer_tests.cpp
│ └── tools
│ └── instrument_resolver_tests.cpp
├── script
└── entrypoint_os.sh
└── template
└── cfg
├── configSim.txt
├── default
├── FIX50SP2_marketsimulator.xml
└── FIXT11_marketsimulator.xml
└── market_simulator.xml
/.clang-format:
--------------------------------------------------------------------------------
1 | Language: Cpp
2 | Standard: c++20
3 | BasedOnStyle: Google
4 | ColumnLimit: 80
5 | BinPackArguments: false
6 | BinPackParameters: false
7 | DerivePointerAlignment: false
8 | PointerAlignment: Left
9 | ReferenceAlignment: Left
10 | BreakAfterAttributes: Leave
11 | QualifierAlignment: Left
--------------------------------------------------------------------------------
/.clang-tidy:
--------------------------------------------------------------------------------
1 | ---
2 | Checks: >
3 | -*,
4 | bugprone-*,
5 | cert-*,
6 | clang-analyzer-*,
7 | concurrency-*,
8 | cppcoreguidelines-*,
9 | google-*,
10 | modernize-*,
11 | performance-*,
12 | portability-*,
13 | readability-*,
14 | -modernize-use-nodiscard
15 | WarningsAsErrors: '*'
16 | FormatStyle: none
17 |
--------------------------------------------------------------------------------
/.github/docker/Build_Marketsim.Dockerfile:
--------------------------------------------------------------------------------
1 | FROM rockylinux:8
2 |
3 | RUN dnf --refresh makecache
4 |
5 | RUN dnf install -y \
6 | gcc-toolset-12 \
7 | git \
8 | make \
9 | openssl-devel \
10 | perl \
11 | python3-pip
12 |
13 | RUN pip3 install --upgrade pip
14 |
15 | RUN pip3 install cmake==3.21 conan==1.59 gcovr
16 |
17 | # Hardcoding env variables to allow a container to use gcc 12,
18 | # located in /opt/rh/gcc-toolset-12, without additional scripting
19 | ENV PATH="/opt/rh/gcc-toolset-12/root/usr/bin:${PATH}"
20 | ENV LD_LIBRARY_PATH="/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:${LD_LIBRARY_PATH}"
--------------------------------------------------------------------------------
/.github/docker/Deploy_Marketsim.Dockerfile:
--------------------------------------------------------------------------------
1 | FROM rockylinux:8
2 |
3 | RUN dnf --refresh makecache
4 | RUN dnf install -y gcc-toolset-12
5 |
6 | RUN groupadd -g 1000 quantreplay-user && \
7 | useradd -m -u 1000 -g quantreplay-user quantreplay-user
8 |
9 | # Set environment variables
10 | ENV LOG_DIR=/market-simulator/quod/data/log
11 | ENV LD_LIBRARY_PATH="/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:${LD_LIBRARY_PATH}"
12 |
13 | RUN mkdir -p /market-simulator/quod/data/cfg
14 | RUN mkdir /template
15 | COPY template/ /template/
16 |
17 | COPY package/quod /market-simulator/quod
18 |
19 | RUN chmod +x /market-simulator/quod/bin/marketsimulator
20 |
21 | # Remove specific files from the cfg folder
22 | RUN rm -f /market-simulator/quod/cfg/market_simulator.xml \
23 | && rm -f /market-simulator/quod/cfg/configSim.txt
24 |
25 | COPY script/entrypoint_os.sh /entrypoint_os.sh
26 | RUN chmod +x /entrypoint_os.sh
27 |
28 | RUN chown -R quantreplay-user:quantreplay-user /market-simulator /entrypoint_os.sh
29 |
30 | USER quantreplay-user
31 |
32 | WORKDIR /market-simulator/quod
33 |
34 | ENTRYPOINT ["/entrypoint_os.sh"]
35 |
--------------------------------------------------------------------------------
/.github/docker/Postgres_Marketsim.Dockerfile:
--------------------------------------------------------------------------------
1 | FROM postgres:13.4
2 |
3 | COPY init.sql /docker-entrypoint-initdb.d/init.sql
--------------------------------------------------------------------------------
/.github/docker/init.sql:
--------------------------------------------------------------------------------
1 | CREATE USER sim WITH PASSWORD 'sim' NOSUPERUSER NOCREATEDB NOCREATEROLE LOGIN;
2 | CREATE SCHEMA AUTHORIZATION sim;
3 | REVOKE USAGE ON SCHEMA public FROM sim;
--------------------------------------------------------------------------------
/.github/docker/liquibase_custom.Dockerfile:
--------------------------------------------------------------------------------
1 | FROM liquibase/liquibase
2 |
3 | COPY db /liquibase/project/
4 |
5 | ENV SIMULATOR_DATABASE_HOST="market-simulator-database"
6 | ENV SIMULATOR_DATABASE_PORT="5432"
7 | ENV SIMULATOR_DATABASE_DBNAME="simdb"
8 | ENV SIMULATOR_DATABASE_APP_USER="sim"
9 | ENV SIMULATOR_DATABASE_APP_PASSWORD="sim"
10 | ENV SIMULATOR_LIQUIBASE_CONTEXT="market-simulator,schema,demo"
11 | ENV CHANGELOG_FILE="root-changelog.yml"
12 |
13 | ENTRYPOINT sh -c "liquibase \
14 | --url=jdbc:postgresql://${SIMULATOR_DATABASE_HOST}:${SIMULATOR_DATABASE_PORT}/${SIMULATOR_DATABASE_DBNAME} \
15 | --username=${SIMULATOR_DATABASE_APP_USER} \
16 | --password=${SIMULATOR_DATABASE_APP_PASSWORD} \
17 | --classpath=/liquibase/project \
18 | --changelog-file=${CHANGELOG_FILE} \
19 | --contexts=${SIMULATOR_LIQUIBASE_CONTEXT} \
20 | update"
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore all directories, and all sub-directories, and it's contents:
2 |
3 | */*
4 | # Now ignore all files in the current directory. This fails to ignore files without a ".".
5 | # For example 'file.txt' works, but 'file' doesn't.
6 |
7 | *.*
8 |
9 | # But don't ignore these specific directories and subdirectories:
10 |
11 | !/conan
12 | !/hooks
13 | !/script
14 | !/test
15 |
16 | # But don't ignore these specific files:
17 |
18 | !CMakeLists.txt
19 | !CMakePresets.json
20 | !README.md
21 |
22 | !**.adoc
23 | !**.bat
24 | !**.cmake
25 | !**.cpp
26 | !**.Dockerfile
27 | !**.err
28 | !**.hpp
29 | !**.html
30 | !**.ico
31 | !**.json
32 | !**.odt
33 | !**.pdf
34 | !**.png
35 | !**.properties
36 | !**.py
37 | !**.sh
38 | !**.sky
39 | !**.txt
40 | !**.xml
41 | !**.yml
42 | !**.yml.example
43 |
44 | # ...even if they are in subdirectories
45 | !*/
46 |
47 | # But make git ignore all cmake dev build directories,
48 | cmake-build-*/
49 |
50 | # cmake dev install directories,
51 | cmake-install-*/
52 |
53 | # and local development environment
54 | devenv/*
55 |
56 | # Ignore PySys output files
57 | **/Output/**
58 | .idea/*
59 |
60 | # Ignore Python virtual environment
61 | env/*
62 |
--------------------------------------------------------------------------------
/cfg/configSim.txt:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 | ConnectionType=acceptor
3 | SocketAcceptPort=9001
4 | SocketReuseAddress=Y
5 | SocketNodelay=Y
6 | AppDataDictionary=FIX50SP2_marketsimulator.xml
7 | TransportDataDictionary=FIXT11_marketsimulator.xml
8 | StartTime=00:00:00
9 | EndTime=00:00:00
10 | TimestampPrecision=6
11 | HeartBtInt=30
12 |
13 | [SESSION]
14 | BeginString=FIXT.1.1
15 | SenderCompID=MktSimulator
16 | TargetCompID=MyGateway
17 | DefaultApplVerID=9
18 | PersistMessages=Y
19 | FileStorePath=quickfix_MktSimulator_MyGateway
20 | ResetOnLogon=N
21 | RefreshOnLogon=Y
22 |
23 | [SESSION]
24 | BeginString=FIXT.1.1
25 | SenderCompID=MktSimulator
26 | TargetCompID=MyFeedhandler
27 | DefaultApplVerID=9
28 | PersistMessages=N
29 | FileStorePath=quickfix_MktSimulator_MyFeedhandler
30 | ResetOnLogon=Y
31 | RefreshOnLogon=N
32 |
--------------------------------------------------------------------------------
/cmake/CheckDependencyExist.cmake:
--------------------------------------------------------------------------------
1 | function(ensure_dependency_target_exist TARGET_NAME DEPENDENT_NAME)
2 | if(NOT TARGET ${TARGET_NAME})
3 | string(CONCAT ERROR_MESSAGE
4 | "Failed to configure ${DEPENDENT_NAME}, "
5 | "required dependency target ${TARGET_NAME} does not exits")
6 | message(FATAL_ERROR ${ERROR_MESSAGE})
7 | else()
8 | message(DEBUG "Found ${DEPENDENT_NAME} dependency - ${TARGET_NAME}")
9 | endif()
10 | endfunction()
11 |
12 | macro(ensure_project_dependency_exist TARGET_NAME)
13 | ensure_dependency_target_exist(${TARGET_NAME} ${PROJECT_NAME})
14 | endmacro()
--------------------------------------------------------------------------------
/cmake/build/PreventInSourceBuilds.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # This function will prevent in-source builds
3 | function(AssureOutOfSourceBuilds)
4 | # make sure the user doesn't play dirty with symlinks
5 | get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
6 | get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
7 |
8 | # disallow in-source builds
9 | if("${srcdir}" STREQUAL "${bindir}")
10 | message("######################################################")
11 | message("Warning: in-source builds are disabled")
12 | message("Please create a separate build directory and run cmake from there")
13 | message("######################################################")
14 | message(FATAL_ERROR "Quitting configuration")
15 | endif()
16 | endfunction()
17 |
18 | assureoutofsourcebuilds()
19 |
--------------------------------------------------------------------------------
/cmake/utils/Git.cmake:
--------------------------------------------------------------------------------
1 | find_package(Git QUIET)
2 |
3 |
4 | macro(call_git)
5 | set(single_value_args OUT)
6 | set(multi_value_args ARGS)
7 | cmake_parse_arguments(git "" "${single_value_args}" "${multi_value_args}" ${ARGN})
8 |
9 | if (NOT Git_FOUND)
10 | message(FATAL_ERROR "Can not call git: git executable was not found")
11 | endif ()
12 |
13 | execute_process(
14 | COMMAND ${GIT_EXECUTABLE} ${git_ARGS}
15 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
16 | RESULT_VARIABLE GIT_CALL_CODE
17 | OUTPUT_VARIABLE GIT_CALL_OUTPUT
18 | OUTPUT_STRIP_TRAILING_WHITESPACE
19 | )
20 |
21 | string(REPLACE ";" " " GIT_ARGS "${git_ARGS}")
22 | if (${GIT_CALL_CODE} EQUAL "0")
23 | set(${git_OUT} ${GIT_CALL_OUTPUT})
24 | message(DEBUG "\"${GIT_EXECUTABLE} ${GIT_ARGS}\" exited with code ${GIT_CALL_CODE}")
25 | else ()
26 | message(FATAL_ERROR
27 | "\"${GIT_EXECUTABLE} ${GIT_ARGS}\" exited with code ${GIT_CALL_CODE}")
28 | endif ()
29 | endmacro()
30 |
--------------------------------------------------------------------------------
/cmake/utils/TimeTrace.cmake:
--------------------------------------------------------------------------------
1 | if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
2 | option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
3 | endif()
4 |
5 | function(enable_time_trace project_name)
6 |
7 | if(ENABLE_BUILD_WITH_TIME_TRACE)
8 | add_compile_definitions(${project_name} INTERFACE -ftime-trace)
9 | endif()
10 |
11 | endfunction()
12 |
--------------------------------------------------------------------------------
/db/external-price-seed/root-changelog.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - context: external-price-seed
3 | - include:
4 | file: schema/changelog.yml
5 | relativeToChangelogFile: true
--------------------------------------------------------------------------------
/db/external-price-seed/schema/changelog.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - include:
3 | file: tables/price_seed.yml
4 | relativeToChangelogFile: true
--------------------------------------------------------------------------------
/db/market-simulator/root-changelog.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - context: market-simulator
3 | - include:
4 | file: schema/changelog.yml
5 | relativeToChangelogFile: true
6 | - include:
7 | file: sample-data/changelog.yml
8 | relativeToChangelogFile: true
--------------------------------------------------------------------------------
/db/market-simulator/sample-data/changelog.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - include:
3 | context: "schema"
4 | file: common/changelog.yml
5 | relativeToChangelogFile: true
6 | - include:
7 | context: "schema AND demo"
8 | file: demo/changelog.yml
9 | relativeToChangelogFile: true
10 |
--------------------------------------------------------------------------------
/db/market-simulator/sample-data/common/changelog.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - include:
3 | file: setting.yml
4 | relativeToChangelogFile: true
--------------------------------------------------------------------------------
/db/market-simulator/sample-data/demo/xetra/changelog.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - include:
3 | file: venue.yml
4 | relativeToChangelogFile: true
5 | - includeAll:
6 | path: listings/
7 | relativeToChangelogFile: true
8 | - includeAll:
9 | path: price_seeds/
10 | relativeToChangelogFile: true
11 | - includeAll:
12 | path: setting/
13 | relativeToChangelogFile: true
--------------------------------------------------------------------------------
/db/market-simulator/schema/constraints/market_phase.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - changeSet:
3 | author: avovchen
4 | id: market_simulator_schema_constraint_market_phase_1
5 | labels: schema,v4
6 | comment: Add NOT NULL constraint market_phase_phase_idx on market_phase.phase
7 | preConditions:
8 | - onFail: MARK_RAN
9 | - tableExists:
10 | tableName: market_phase
11 | - columnExists:
12 | tableName: market_phase
13 | columnName: phase
14 | changes:
15 | - addNotNullConstraint:
16 | constraintName: market_phase_phase_idx
17 | tableName: market_phase
18 | columnName: phase
19 | validate: true
--------------------------------------------------------------------------------
/db/market-simulator/schema/keys/price_seed.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - changeSet:
3 | author: avovchen
4 | id: market_simulator_schema_key_price_seed_1
5 | labels: schema,v4
6 | comment: Add price_seed_pkey (price_seed_id) for price_seed table
7 | preConditions:
8 | - onFail: MARK_RAN
9 | - tableExists:
10 | tableName: price_seed
11 | - columnExists:
12 | tableName: price_seed
13 | columnName: price_seed_id
14 | - not:
15 | - primaryKeyExists:
16 | tableName: price_seed
17 | primaryKeyName: price_seed_pkey
18 | changes:
19 | - addPrimaryKey:
20 | constraintName: price_seed_pkey
21 | tableName: price_seed
22 | columnNames: price_seed_id
23 | validate: true
--------------------------------------------------------------------------------
/db/market-simulator/schema/keys/setting.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - changeSet:
3 | author: avovchen
4 | id: market_simulator_schema_key_setting_1
5 | labels: schema,v4
6 | comment: Add setting_pkey (key) for setting table
7 | preConditions:
8 | - onFail: MARK_RAN
9 | - tableExists:
10 | tableName: setting
11 | - columnExists:
12 | tableName: setting
13 | columnName: key
14 | - not:
15 | - primaryKeyExists:
16 | tableName: setting
17 | primaryKeyName: setting_pkey
18 | changes:
19 | - addPrimaryKey:
20 | constraintName: setting_pkey
21 | tableName: setting
22 | columnNames: key
23 | validate: true
--------------------------------------------------------------------------------
/db/market-simulator/schema/keys/venue.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - changeSet:
3 | author: avovchen
4 | id: market_simulator_schema_key_venue_1
5 | labels: schema,v4
6 | comment: Add venue_pkey (venue_id) for venue table
7 | preConditions:
8 | - onFail: MARK_RAN
9 | - tableExists:
10 | tableName: venue
11 | - columnExists:
12 | tableName: venue
13 | columnName: venue_id
14 | - not:
15 | - primaryKeyExists:
16 | tableName: venue
17 | primaryKeyName: venue_pkey
18 | changes:
19 | - addPrimaryKey:
20 | tableName: venue
21 | columnNames: venue_id
22 | constraintName: venue_pkey
23 | validate: true
--------------------------------------------------------------------------------
/db/market-simulator/schema/sequences/data_source.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - changeSet:
3 | author: avovchen
4 | id: market_simulator_schema_sequence_data_source_1
5 | labels: schema,v4
6 | comment: Add auto-increment sequence for data_source.data_source_id column
7 | preConditions:
8 | - onFail: MARK_RAN
9 | - tableExists:
10 | tableName: data_source
11 | - columnExists:
12 | tableName: data_source
13 | columnName: data_source_id
14 | changes:
15 | - addAutoIncrement:
16 | tableName: data_source
17 | columnName: data_source_id
18 | columnDataType: int
19 | startWith: 1
20 | incrementBy: 1
21 | generationType: BY DEFAULT
--------------------------------------------------------------------------------
/db/market-simulator/schema/sequences/listing.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - changeSet:
3 | author: avovchen
4 | id: market_simulator_schema_sequence_listing_1
5 | labels: schema,v4
6 | comment: Add auto-increment sequence for listing.listing_id column
7 | preConditions:
8 | - onFail: MARK_RAN
9 | - tableExists:
10 | tableName: listing
11 | - columnExists:
12 | tableName: listing
13 | columnName: listing_id
14 | changes:
15 | - addAutoIncrement:
16 | tableName: listing
17 | columnName: listing_id
18 | columnDataType: int
19 | startWith: 1
20 | incrementBy: 1
21 | generationType: BY DEFAULT
--------------------------------------------------------------------------------
/db/market-simulator/schema/sequences/price_seed.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - changeSet:
3 | author: avovchen
4 | id: market_simulator_schema_sequence_price_seed_1
5 | labels: schema,v4
6 | comment: Add auto-increment sequence for price_seed.price_seed_id column
7 | preConditions:
8 | - onFail: MARK_RAN
9 | - tableExists:
10 | tableName: price_seed
11 | - columnExists:
12 | tableName: price_seed
13 | columnName: price_seed_id
14 | changes:
15 | - addAutoIncrement:
16 | tableName: price_seed
17 | columnName: price_seed_id
18 | columnDataType: int
19 | startWith: 1
20 | incrementBy: 1
21 | generationType: BY DEFAULT
--------------------------------------------------------------------------------
/db/market-simulator/schema/tables/setting.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - changeSet:
3 | author: avovchen
4 | id: market_simulator_schema_table_listing_1
5 | labels: schema,v4
6 | comment: Create listing table
7 | preConditions:
8 | - not:
9 | - tableExists:
10 | tableName: setting
11 | changes:
12 | - createTable:
13 | tableName: setting
14 | columns:
15 | - column:
16 | name: key
17 | type: text
18 | - column:
19 | name: value
20 | type: text
--------------------------------------------------------------------------------
/db/root-changelog.yml:
--------------------------------------------------------------------------------
1 | databaseChangeLog:
2 | - include:
3 | file: market-simulator/root-changelog.yml
4 | relativeToChangelogFile: true
5 | - include:
6 | file: external-price-seed/root-changelog.yml
7 | relativeToChangelogFile: true
8 |
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/FIXRulesOfEngagement.adoc:
--------------------------------------------------------------------------------
1 | :maintitle: FIX Rules of Engagement
2 | include::../common/adoc/titleblock.adoc[]
3 | :docinfo: shared
4 | :docinfodir: ../common/adoc
5 | :toc: left
6 | :toclevels: 4
7 | :table-stripes: even
8 | :front-cover-image: Introduction/Cover.pdf
9 |
10 | ifndef::imagesDir[]
11 | :imagesDir: images
12 | endif::[]
13 |
14 | include::../common/adoc/header.adoc[]
15 |
16 | <<<
17 |
18 | include::Introduction/Introduction.adoc[]
19 |
20 | <<<
21 |
22 | include::CommonComponents/CommonComponents.adoc[]
23 |
24 | <<<
25 |
26 | include::AdminMessages/AdminMessages.adoc[]
27 |
28 |
29 | <<<
30 |
31 | include::PreTradeMessages/PreTradeMessages.adoc[]
32 |
33 | <<<
34 |
35 | include::TradeMessages/TradeMessages.adoc[]
36 |
37 | <<<
38 |
39 | include::PhaseReportingMessages/PhaseReportingMessages.adoc[]
40 |
41 | <<<
42 |
43 | include::MessageFlows/MessageFlows.adoc[]
44 |
45 | <<<
46 |
47 |
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/Introduction/Cover.odt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/Introduction/Cover.odt
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/Introduction/Cover.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/Introduction/Cover.pdf
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/build.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | echo Generate Documentation...
4 | if not exist "output" mkdir "output"
5 | del "output\*.html" >nul 2>&1
6 |
7 | call asciidoctor "FIXRulesOfEngagement.adoc" -a imagesDir="../images" -D "output"
8 | echo HTML Done
9 |
10 | call asciidoctor-pdf -a allow-uri-read -a pdf-theme="../common/pdf/PDFTheme.yml" "FIXRulesOfEngagement.adoc" -D "output"
11 | echo PDF Done
12 |
13 | IF %0 == "%~0" pause
14 |
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo Generate Documentation...
4 | if [ ! -d "output" ]; then
5 | mkdir "output"
6 | fi
7 | rm -f output/*.html
8 |
9 | asciidoctor "FIXRulesOfEngagement.adoc" -a imagesDir="../images" -D "output"
10 | echo HTML Done
11 |
12 | asciidoctor-pdf -a allow-uri-read -a pdf-theme="../common/pdf/PDFTheme.yml" "FIXRulesOfEngagement.adoc" -D "output"
13 | echo PDF Done
14 |
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/01MktDataIncrementalMsg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/01MktDataIncrementalMsg.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/02MktDataStreamingMsg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/02MktDataStreamingMsg.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/03MktDataSnapReqRsp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/03MktDataSnapReqRsp.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/04MktDataReqRct.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/04MktDataReqRct.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/05MktDataNewOrderSgl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/05MktDataNewOrderSgl.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/06MktDataNewOrderRct.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/06MktDataNewOrderRct.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/07MktDataExeRpt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/07MktDataExeRpt.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/08MktDataCancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/08MktDataCancel.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/09MktDataPartialCancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/09MktDataPartialCancel.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/10MktDataOrderReplace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/10MktDataOrderReplace.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/11MktDataCancelReject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/11MktDataCancelReject.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/12MktDataCancelSuccess.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/12MktDataCancelSuccess.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/13MktDataCancelReplaceReject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/13MktDataCancelReplaceReject.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/14MktDataStsReport.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/14MktDataStsReport.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/15MktDataStsSnapSht.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/15MktDataStsSnapSht.png
--------------------------------------------------------------------------------
/docs/FIXRulesOfEngagement/images/16MktDataStsReject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/FIXRulesOfEngagement/images/16MktDataStsReject.png
--------------------------------------------------------------------------------
/docs/Overview/Overview.adoc:
--------------------------------------------------------------------------------
1 | :maintitle: Documentation Overview
2 | include::../common/adoc/titleblock.adoc[]
3 | :docinfo: shared
4 | :nofooter:
5 |
6 | See below for user documentation for the {orgname} Market Simulator project at https://github.com/Quod-Financial/quantreplay
7 |
8 | == User Guides
9 |
10 | |===
11 |
12 | | <<../FIXRulesOfEngagement/FIXRulesOfEngagement.adoc#, FIX Rules of Engagement>> | Rules of Engagement for the FIX trading API.
13 | | <<../RESTAPI/RESTAPI.adoc#, REST API User Guide>> | User guide for the REST administrative API.
14 |
15 | |===
16 |
--------------------------------------------------------------------------------
/docs/Overview/build.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | echo Generate Documentation...
4 | if not exist "output" mkdir "output"
5 | del "output\*.html" >nul 2>&1
6 |
7 | call asciidoctor "Overview.adoc" -D "output"
8 | echo HTML Done
9 |
10 | call asciidoctor-pdf -a allow-uri-read -a pdf-theme="../common/pdf/PDFTheme.yml" "Overview.adoc" -D "output"
11 | echo PDF Done
12 |
13 | IF %0 == "%~0" pause
14 |
--------------------------------------------------------------------------------
/docs/Overview/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo Generate Documentation...
4 | if [ ! -d "output" ]; then
5 | mkdir "output"
6 | fi
7 | rm -f output/*.html
8 |
9 | asciidoctor "Overview.adoc" -D "output"
10 | echo HTML Done
11 |
12 | asciidoctor-pdf -a allow-uri-read -a pdf-theme="../common/pdf/PDFTheme.yml" "Overview.adoc" -D "output"
13 | echo PDF Done
14 |
--------------------------------------------------------------------------------
/docs/RESTAPI/Introduction/Cover.odt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/RESTAPI/Introduction/Cover.odt
--------------------------------------------------------------------------------
/docs/RESTAPI/Introduction/Cover.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/RESTAPI/Introduction/Cover.pdf
--------------------------------------------------------------------------------
/docs/RESTAPI/Introduction/Introduction.adoc:
--------------------------------------------------------------------------------
1 | ifndef::imagesDir[]
2 | :imagesDir: images
3 | endif::[]
4 |
5 | [[introduction]]
6 | == Introduction
7 | This reference document provides details of the {orgname} Market Simulator Representational State Transfer (REST) API.
8 |
9 | [[introduction-scope]]
10 | === Scope
11 |
12 | This document provides technical-level details of using the administrative functions through the REST API of the {orgname} Market Simulator,
13 | for modifying administrative settings and sending administrative requests to market simulator instances.
--------------------------------------------------------------------------------
/docs/RESTAPI/RESTAPI.adoc:
--------------------------------------------------------------------------------
1 | :maintitle: REST API
2 | include::../common/adoc/titleblock.adoc[]
3 | :docinfo: shared
4 | :docinfodir: ../common/adoc
5 | :toc: left
6 | :toclevels: 4
7 | :table-stripes: even
8 | :front-cover-image: Introduction/Cover.pdf
9 |
10 | ifndef::imagesDir[]
11 | :imagesDir: images
12 | endif::[]
13 |
14 | include::../common/adoc/header.adoc[]
15 |
16 | <<<
17 |
18 | include::Introduction/Introduction.adoc[]
19 |
20 | <<<
21 |
22 | include::General/General.adoc[]
23 |
24 | <<<
25 |
26 | include::AdministrativeSettings/AdministrativeSettings.adoc[]
27 |
28 |
29 | <<<
30 |
31 | include::AdministrativeCommands/AdministrativeCommands.adoc[]
32 |
33 | <<<
34 |
35 |
36 |
--------------------------------------------------------------------------------
/docs/RESTAPI/build.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | echo Generate Documentation...
4 | if not exist "output" mkdir "output"
5 | del "output\*.html" >nul 2>&1
6 |
7 | call asciidoctor "RESTAPI.adoc" -a imagesDir="../images" -D "output"
8 | echo HTML Done
9 |
10 | call asciidoctor-pdf -a allow-uri-read -a pdf-theme="../common/pdf/PDFTheme.yml" "RESTAPI.adoc" -D "output"
11 | echo PDF Done
12 |
13 | IF %0 == "%~0" pause
14 |
--------------------------------------------------------------------------------
/docs/RESTAPI/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo Generate Documentation...
4 | if [ ! -d "output" ]; then
5 | mkdir "output"
6 | fi
7 | rm -f output/*.html
8 |
9 | asciidoctor "RESTAPI.adoc" -a imagesDir="../images" -D "output"
10 | echo HTML Done
11 |
12 | asciidoctor-pdf -a allow-uri-read -a pdf-theme="../common/pdf/PDFTheme.yml" "RESTAPI.adoc" -D "output"
13 | echo PDF Done
14 |
--------------------------------------------------------------------------------
/docs/RESTAPI/images/17pricebook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/RESTAPI/images/17pricebook.png
--------------------------------------------------------------------------------
/docs/common/adoc/docinfo-footer.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/common/adoc/docinfo.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/common/adoc/header.adoc:
--------------------------------------------------------------------------------
1 | ifdef::backend-html5[]
2 | [frame=none,grid=none,cols="<,>"]
3 | |===
4 |
5 | a| ifndef::hide-overview[link:../Overview/Overview.html[[gray]#All Documents /#]] |
6 |
7 | ifndef::hide-pdf[]
8 | link:{docname}.pdf[[gray]#Download#]
9 | image:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABmJLR0QA/wD/AP+gvaeTAAABbklEQVRIib3WPUscURTG8d8aBMFAKm1cQQOxthTEXgjEVoRYaZsiTap0qUzwA1hpJ66SxqwfwMJKQVIpFlskiCFb7IZYiMtazCzI7Muduys+cBgYnnP+59y5c2doVxEl1NEMRAUrHWoEVUQ1ByAbn2JBpTTxEBMB70IG9iUG1FquYg7viPbJNvOCWgmx/sfx9blATXx+LlAT758SdNwDVHlKUFajeJunTsiwg1+YDgAHBt3iB9ZiQUOBhKxOJS9qPTIv3ElGq2hgPLZO7ES/UcDryLxwJxl9kzyjn3gVU6fQwdDpPgzjCu8wj2V8xCxeoozLHHU6d/JI6zjBB3zHfeptSDbJn5x1ehqmcI3/2MKSZEPMYRfn2BgENIZt3EmWJrTb+gad4QJ/JVPlVfT2vsELLAockrEa9FDtWic70b/0mudT3k2T6bXWy3SQdlLuEzaJo7TGfi/jjP5+t7JRxZtQV0XsSUaPBdTSSdogD7GVvK6jtRJgAAAAAElFTkSuQmCC[link="{docname}.pdf"]
10 | endif::[]
11 |
12 | |===
13 | endif::[]
--------------------------------------------------------------------------------
/docs/common/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/common/favicon.ico
--------------------------------------------------------------------------------
/docs/common/pdf/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/docs/common/pdf/Logo.png
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/images/image01_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/images/image01_dark.png
--------------------------------------------------------------------------------
/images/image01_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/images/image01_light.png
--------------------------------------------------------------------------------
/images/image02_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/images/image02_dark.png
--------------------------------------------------------------------------------
/images/image02_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quod-Financial/quantreplay/0c82e58e76c5ec803bea397396f18bdf9cae9b6d/images/image02_light.png
--------------------------------------------------------------------------------
/project/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(core)
2 | add_subdirectory(protocol)
3 | add_subdirectory(cfg)
4 | add_subdirectory(log)
5 | add_subdirectory(data_layer)
6 | add_subdirectory(middleware)
7 | add_subdirectory(trading_system)
8 | add_subdirectory(fix)
9 | add_subdirectory(generator)
10 | add_subdirectory(http)
11 | add_subdirectory(app)
12 |
--------------------------------------------------------------------------------
/project/app/ih/application.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_APP_IH_APPLICATION_HPP_
2 | #define SIMULATOR_APP_IH_APPLICATION_HPP_
3 |
4 | #include
5 |
6 | #include "ih/platforms/platform.hpp"
7 |
8 | namespace simulator {
9 |
10 | class Application {
11 | public:
12 | Application(const Application&) = delete;
13 |
14 | Application(Application&&) noexcept = default;
15 | ~Application() noexcept;
16 |
17 | auto operator=(const Application&) -> Application& = delete;
18 | auto operator=(Application&&) noexcept -> Application& = default;
19 |
20 | static auto start() -> Application;
21 |
22 | private:
23 | Application();
24 |
25 | auto launch() -> void;
26 |
27 | auto terminate() noexcept -> void;
28 |
29 | static auto create_venue_simulation_platform() -> std::unique_ptr;
30 |
31 | std::unique_ptr platform_;
32 | };
33 |
34 | } // namespace simulator
35 |
36 | #endif // SIMULATOR_APP_IH_APPLICATION_HPP_
--------------------------------------------------------------------------------
/project/app/ih/components/http_server.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_APP_IH_COMPONENTS_HTTP_SERVER_HPP_
2 | #define SIMULATOR_APP_IH_COMPONENTS_HTTP_SERVER_HPP_
3 |
4 | #include "data_layer/api/database/context.hpp"
5 | #include "http/http.hpp"
6 |
7 | namespace simulator {
8 |
9 | class HttpServer {
10 | public:
11 | explicit HttpServer(data_layer::database::Context database)
12 | : http_server_(http::create_http_server(std::move(database))) {}
13 |
14 | auto launch() -> void { http::launch_http_server(http_server_); }
15 |
16 | auto terminate() -> void { http::terminate_http_server(http_server_); }
17 |
18 | private:
19 | http::Server http_server_;
20 | };
21 |
22 | } // namespace simulator
23 |
24 | #endif // SIMULATOR_APP_IH_COMPONENTS_HTTP_SERVER_HPP_
--------------------------------------------------------------------------------
/project/app/ih/loading.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_APP_IH_LOADING_HPP_
2 | #define SIMULATOR_APP_IH_LOADING_HPP_
3 |
4 | #include "cfg/api/cfg.hpp"
5 | #include "ih/command_options.hpp"
6 |
7 | namespace simulator {
8 |
9 | auto load_configuration(const simulator::CommandOptions& options) -> void;
10 |
11 | auto load_logger(const simulator::CommandOptions& options,
12 | const simulator::cfg::LogConfiguration& config) -> void;
13 |
14 | } // namespace simulator
15 |
16 | #endif // SIMULATOR_APP_IH_LOADING_HPP_
17 |
--------------------------------------------------------------------------------
/project/app/ih/loop.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_APP_LOOP_HPP_
2 | #define SIMULATOR_APP_LOOP_HPP_
3 |
4 | namespace simulator {
5 |
6 | struct Loop {
7 | static auto suspend_main_thread() -> void;
8 |
9 | static auto release_main_thread() -> void;
10 | };
11 |
12 | } // namespace simulator
13 |
14 | #endif // SIMULATOR_APP_LOOP_HPP_
--------------------------------------------------------------------------------
/project/app/ih/platforms/platform.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_APP_IH_PLATFORMS_PLATFORM_HPP_
2 | #define SIMULATOR_APP_IH_PLATFORMS_PLATFORM_HPP_
3 |
4 | namespace simulator {
5 |
6 | struct Platform {
7 | Platform() = default;
8 | Platform(const Platform&) = default;
9 | Platform(Platform&&) noexcept = default;
10 | virtual ~Platform() = default;
11 |
12 | auto operator=(const Platform&) -> Platform& = default;
13 | auto operator=(Platform&&) noexcept -> Platform& = default;
14 |
15 | virtual auto launch() -> void = 0;
16 |
17 | virtual auto terminate() -> void = 0;
18 | };
19 |
20 | } // namespace simulator
21 |
22 | #endif // SIMULATOR_APP_IH_PLATFORMS_PLATFORM_HPP_
--------------------------------------------------------------------------------
/project/app/ih/platforms/venue_simulation_platform.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_APP_IH_PLATFORMS_VENUE_SIMULATION_PLATFORM_HPP_
2 | #define SIMULATOR_APP_IH_PLATFORMS_VENUE_SIMULATION_PLATFORM_HPP_
3 |
4 | #include
5 |
6 | #include "data_layer/api/database/context.hpp"
7 | #include "ih/components/fix_acceptor.hpp"
8 | #include "ih/components/generator.hpp"
9 | #include "ih/components/http_server.hpp"
10 | #include "ih/components/trading_engine.hpp"
11 | #include "ih/platforms/platform.hpp"
12 |
13 | namespace simulator {
14 |
15 | class VenueSimulationPlatform final : public Platform {
16 | public:
17 | explicit VenueSimulationPlatform(
18 | const data_layer::database::Context& database);
19 |
20 | auto launch() -> void override;
21 |
22 | auto terminate() -> void override;
23 |
24 | private:
25 | std::shared_ptr trading_engine_;
26 | std::shared_ptr fix_acceptor_;
27 | std::shared_ptr generator_;
28 | std::shared_ptr http_server_;
29 | };
30 |
31 | } // namespace simulator
32 |
33 | #endif // SIMULATOR_APP_IH_PLATFORMS_VENUE_SIMULATION_PLATFORM_HPP_
--------------------------------------------------------------------------------
/project/app/src/loop.cpp:
--------------------------------------------------------------------------------
1 | #include "ih/loop.hpp"
2 |
3 | #include
4 | #include
5 |
6 | #include "log/logging.hpp"
7 |
8 | namespace simulator {
9 |
10 | static std::mutex loop_mutex; // NOLINT - global application mutex
11 | static std::condition_variable loop_cv; // NOLINT - global main stop condition
12 |
13 | auto Loop::suspend_main_thread() -> void {
14 | log::info("blocking main thread");
15 | std::unique_lock app_main_lock{loop_mutex};
16 | loop_cv.wait(app_main_lock);
17 | }
18 |
19 | auto Loop::release_main_thread() -> void {
20 | loop_cv.notify_one();
21 | log::info("main thread was requested to be released");
22 | }
23 |
24 | } // namespace simulator
--------------------------------------------------------------------------------
/project/app/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_target_tests(
2 | TARGET ${PROJECT_NAME}
3 | UNIT_TESTS
4 | unit_tests/command_options_tests.cpp)
--------------------------------------------------------------------------------
/project/app/tests/test_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "cfg/api/cfg.hpp"
4 |
5 | auto main(int argc, char **argv) -> int {
6 | testing::InitGoogleTest(&argc, argv);
7 |
8 | simulator::cfg::init();
9 |
10 | return RUN_ALL_TESTS();
11 | }
--------------------------------------------------------------------------------
/project/cfg/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(cfg
2 | LANGUAGES CXX
3 | DESCRIPTION
4 | "Global configuration component")
5 |
6 | #------------------------------------------------------------------------------#
7 |
8 | ensure_project_dependency_exist(date::date)
9 | ensure_project_dependency_exist(tinyxml2::tinyxml2)
10 |
11 | #------------------------------------------------------------------------------#
12 |
13 | add_static_library(
14 | NAME ${PROJECT_NAME}
15 | ALIAS simulator::cfg
16 | HEADERS
17 | include/cfg/api/cfg.hpp
18 | src/cfg_impl.hpp
19 | SOURCES
20 | src/cfg_impl.cpp
21 | PUBLIC_INCLUDE_DIRECTORIES
22 | ${PROJECT_SOURCE_DIR}/include
23 | PRIVATE_INCLUDE_DIRECTORIES
24 | ${PROJECT_SOURCE_DIR}/include/cfg
25 | ${PROJECT_SOURCE_DIR}
26 | PUBLIC_DEPENDENCIES
27 | simulator::core
28 | PRIVATE_DEPENDENCIES
29 | date::date
30 | tinyxml2::tinyxml2
31 | fmt::fmt)
--------------------------------------------------------------------------------
/project/core/include/core/common/json/field.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_COMMON_JSON_FIELD_HPP_
2 | #define SIMULATOR_CORE_COMMON_JSON_FIELD_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::core::json {
7 |
8 | template
9 | struct Field {
10 | using value_type = T;
11 |
12 | constexpr Field(T S::* field_pointer, std::string_view field_name)
13 | : ptr{field_pointer}, name{field_name} {}
14 |
15 | T S::* ptr;
16 | std::string_view name;
17 | };
18 |
19 | template
20 | struct Struct {};
21 |
22 | } // namespace simulator::core::json
23 |
24 | #endif // SIMULATOR_CORE_COMMON_JSON_FIELD_HPP_
25 |
--------------------------------------------------------------------------------
/project/core/include/core/common/json/type_enum.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_COMMON_JSON_TYPE_ENUM_HPP_
2 | #define SIMULATOR_CORE_COMMON_JSON_TYPE_ENUM_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "core/common/enum_converter.hpp"
8 | #include "core/common/json/type.hpp"
9 | #include "core/common/meta.hpp"
10 |
11 | namespace simulator::core::json {
12 |
13 | template
14 | struct Type {
15 | [[nodiscard]]
16 | static auto read_json_value(const rapidjson::Value& json_value) -> E {
17 | return EnumConverter::value(
18 | Type::read_json_value(json_value));
19 | }
20 |
21 | static auto write_json_value(rapidjson::Value& json_value,
22 | rapidjson::Document::AllocatorType& allocator,
23 | const E& value) -> void {
24 | Type::write_json_value(
25 | json_value, allocator, EnumConverter::str(value));
26 | }
27 | };
28 |
29 | } // namespace simulator::core::json
30 |
31 | #endif // SIMULATOR_CORE_COMMON_JSON_TYPE_ENUM_HPP_
32 |
--------------------------------------------------------------------------------
/project/core/include/core/common/std_formatter.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_COMMON_STD_FORMATTER_HPP_
2 | #define SIMULATOR_CORE_COMMON_STD_FORMATTER_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | template
10 | requires fmt::is_formattable::value
11 | struct fmt::formatter> {
12 | private:
13 | static constexpr std::string_view none{"none"};
14 |
15 | public:
16 | constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); };
17 |
18 | auto format(const std::optional& value, format_context& context) const
19 | -> decltype(context.out()) {
20 | return value.has_value() ? format_to(context.out(), "{}", *value)
21 | : format_to(context.out(), none);
22 | }
23 | };
24 |
25 | #endif // SIMULATOR_CORE_COMMON_STD_FORMATTER_HPP_
26 |
--------------------------------------------------------------------------------
/project/core/include/core/domain/json/market_phase.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_DOMAIN_JSON_MARKET_PHASE_HPP_
2 | #define SIMULATOR_CORE_DOMAIN_JSON_MARKET_PHASE_HPP_
3 |
4 | #include "core/common/json/type.hpp"
5 | #include "core/domain/market_phase.hpp"
6 |
7 | namespace simulator::core::json {
8 |
9 | template <>
10 | struct Type {
11 | [[nodiscard]]
12 | static auto read_json_value(const rapidjson::Value& json_value)
13 | -> simulator::MarketPhase;
14 |
15 | static auto write_json_value(rapidjson::Value& json_value,
16 | rapidjson::Document::AllocatorType& allocator,
17 | const simulator::MarketPhase& value) -> void;
18 | };
19 |
20 | } // namespace simulator::core::json
21 |
22 | #endif // SIMULATOR_CORE_DOMAIN_JSON_MARKET_PHASE_HPP_
23 |
--------------------------------------------------------------------------------
/project/core/include/core/tools/format.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_TOOLS_FORMAT_HPP_
2 | #define SIMULATOR_CORE_TOOLS_FORMAT_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | namespace simulator::core {
10 |
11 | template
12 | auto format_collection(const std::vector& vector) -> std::string {
13 | return vector.empty() ? "[]" : fmt::format("[ {} ]", fmt::join(vector, ", "));
14 | }
15 |
16 | } // namespace simulator::core
17 |
18 | #endif // SIMULATOR_CORE_TOOLS_FORMAT_HPP_
19 |
--------------------------------------------------------------------------------
/project/core/include/core/tools/overload.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_TOOLS_OVERLOAD_HPP_
2 | #define SIMULATOR_CORE_TOOLS_OVERLOAD_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::core {
7 |
8 | template
9 | [[nodiscard]]
10 | constexpr auto overload(Overloads&&... overloads) {
11 | struct Overload : Overloads... {
12 | using Overloads::operator()...;
13 | };
14 | return Overload{std::forward(overloads)...};
15 | }
16 |
17 | } // namespace simulator::core
18 |
19 | #endif // SIMULATOR_CORE_TOOLS_OVERLOAD_HPP_
20 |
--------------------------------------------------------------------------------
/project/core/include/core/tools/string_checkers.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_TOOLS_STRING_CHECKERS_HPP_
2 | #define SIMULATOR_CORE_TOOLS_STRING_CHECKERS_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::core {
7 |
8 | [[nodiscard]] auto represents_base10_unsigned_int(
9 | std::string_view string) noexcept -> bool;
10 |
11 | } // namespace simulator::core
12 |
13 | #endif // SIMULATOR_CORE_TOOLS_STRING_CHECKERS_HPP_
14 |
--------------------------------------------------------------------------------
/project/core/include/core/version.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_VERSION_HPP_
2 | #define SIMULATOR_CORE_VERSION_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::core {
7 |
8 | [[nodiscard]]
9 | auto version() noexcept -> std::string_view;
10 |
11 | [[nodiscard]]
12 | auto major_version() noexcept -> std::string_view;
13 |
14 | } // namespace simulator::core
15 |
16 | #endif // SIMULATOR_CORE_VERSION_HPP_
--------------------------------------------------------------------------------
/project/core/src/domain/market_phase.cpp:
--------------------------------------------------------------------------------
1 | #include "core/domain/json/market_phase.hpp"
2 |
3 | #include "core/domain/market_phase.hpp"
4 |
5 | namespace simulator::core::json {
6 |
7 | auto Type::read_json_value(
8 | const rapidjson::Value& json_value) -> simulator::MarketPhase {
9 | auto phase = json::read_json_value(json_value, "trading_phase");
10 | auto status =
11 | json::read_json_value(json_value, "trading_status");
12 | return simulator::MarketPhase{std::move(phase), std::move(status)};
13 | }
14 |
15 | auto Type::write_json_value(
16 | rapidjson::Value& json_value,
17 | rapidjson::Document::AllocatorType& allocator,
18 | const simulator::MarketPhase& value) -> void {
19 | json_value = rapidjson::Value(rapidjson::Type::kObjectType);
20 | json_value.MemberReserve(2, allocator);
21 | json::write_json_value(
22 | json_value, allocator, value.trading_phase(), "trading_phase");
23 | json::write_json_value(
24 | json_value, allocator, value.trading_status(), "trading_status");
25 | }
26 |
27 | } // namespace simulator::core::json
28 |
--------------------------------------------------------------------------------
/project/core/src/tools/string_checkers.cpp:
--------------------------------------------------------------------------------
1 | #include "core/tools/string_checkers.hpp"
2 |
3 | #include
4 | #include
5 |
6 | namespace simulator::core {
7 | namespace {
8 |
9 | [[nodiscard]] auto is_base10_digit(unsigned char character) noexcept -> bool {
10 | return std::isdigit(character) != 0;
11 | }
12 |
13 | } // namespace
14 |
15 | auto represents_base10_unsigned_int(std::string_view string) noexcept -> bool {
16 | return !string.empty() &&
17 | std::all_of(std::begin(string), std::end(string), is_base10_digit);
18 | }
19 |
20 | } // namespace simulator::core
--------------------------------------------------------------------------------
/project/core/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_target_tests(
2 | TARGET ${PROJECT_NAME}
3 | HEADERS
4 | test_definitions/test_attributes.hpp
5 | test_utils/matchers.hpp
6 | fixtures/given_expected_fixture.hpp
7 | UNIT_TESTS
8 | unit_tests/common/json/attribute_tests.cpp
9 | unit_tests/common/json/attributes_tests.cpp
10 | unit_tests/common/json/type_container_tests.cpp
11 | unit_tests/common/json/type_enum_tests.cpp
12 | unit_tests/common/json/type_struct_tests.cpp
13 | unit_tests/common/json/type_tests.cpp
14 | unit_tests/common/attributes_tests.cpp
15 | unit_tests/common/enum_converter_tests.cpp
16 | unit_tests/common/return_code_tests.cpp
17 | unit_tests/domain/enumerators_tests.cpp
18 | unit_tests/domain/instrument_descriptor_tests.cpp
19 | unit_tests/domain/market_phase_tests.cpp
20 | unit_tests/domain/party_tests.cpp
21 | unit_tests/tools/numeric_tests.cpp
22 | unit_tests/tools/string_checkers_tests.cpp
23 | unit_tests/tools/time_tests.cpp)
--------------------------------------------------------------------------------
/project/core/tests/fixtures/given_expected_fixture.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_CORE_TESTS_FIXTURES_GIVEN_EXPECTED_FIXTURE_HPP_
2 | #define SIMULATOR_CORE_TESTS_FIXTURES_GIVEN_EXPECTED_FIXTURE_HPP_
3 |
4 | #include
5 |
6 | #include
7 |
8 | namespace simulator::core::test {
9 |
10 | template
11 | struct GivenExpectedFixture
12 | : public testing::TestWithParam> {
13 | auto given() const -> GivenType { return this->GetParam().first; }
14 |
15 | auto expected() const -> ExpectedType { return this->GetParam().second; }
16 | };
17 |
18 | } // namespace simulator::core::test
19 |
20 | #endif // SIMULATOR_CORE_TESTS_FIXTURES_GIVEN_EXPECTED_FIXTURE_HPP_
21 |
--------------------------------------------------------------------------------
/project/core/tests/test_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | auto main(int argc, char** argv) -> int {
4 | testing::InitGoogleTest(&argc, argv);
5 | return RUN_ALL_TESTS();
6 | }
--------------------------------------------------------------------------------
/project/core/tests/unit_tests/tools/string_checkers_tests.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "core/tools/string_checkers.hpp"
4 |
5 | namespace simulator::core::test {
6 | namespace {
7 |
8 | using namespace testing; // NOLINT
9 |
10 | TEST(CoreRepresentsBase10UnsignedIntCheck, DetectsEmptyString) {
11 | ASSERT_THAT(represents_base10_unsigned_int(""), IsFalse());
12 | }
13 |
14 | TEST(CoreRepresentsBase10UnsignedIntCheck, DetectsMinusSign) {
15 | ASSERT_THAT(represents_base10_unsigned_int("-123456789"), IsFalse());
16 | }
17 |
18 | TEST(CoreRepresentsBase10UnsignedIntCheck, DetectsStringWithSpecialSymbol) {
19 | ASSERT_THAT(represents_base10_unsigned_int("12345@6789"), IsFalse());
20 | }
21 |
22 | TEST(CoreRepresentsBase10UnsignedIntCheck, DetectsStringWithLetter) {
23 | ASSERT_THAT(represents_base10_unsigned_int("1A23456789"), IsFalse());
24 | }
25 |
26 | TEST(CoreRepresentsBase10UnsignedIntCheck, DetectsUnsignedInteger) {
27 | ASSERT_THAT(represents_base10_unsigned_int("123456789"), IsTrue());
28 | }
29 |
30 | } // namespace
31 | } // namespace simulator::core::test
--------------------------------------------------------------------------------
/project/data_layer/ih/common/database/context_resolver.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_PROJECT_DATA_LAYER_IH_COMMON_CONTEXT_RESOLVER_HPP_
2 | #define SIMULATOR_PROJECT_DATA_LAYER_IH_COMMON_CONTEXT_RESOLVER_HPP_
3 |
4 | #include "api/database/context.hpp"
5 | #include "ih/pqxx/context.hpp"
6 |
7 | namespace simulator::data_layer::database {
8 |
9 | class ContextResolver {
10 | friend class database::Context::Implementation;
11 |
12 | public:
13 | ContextResolver() = default;
14 |
15 | ContextResolver(const ContextResolver&) = default;
16 | auto operator=(const ContextResolver&) -> ContextResolver& = default;
17 |
18 | ContextResolver(ContextResolver&&) = default;
19 | auto operator=(ContextResolver&&) -> ContextResolver& = default;
20 |
21 | virtual ~ContextResolver() = default;
22 |
23 | protected:
24 | auto resolve(const database::Context& dbms_context) -> void {
25 | dbms_context.accept(*this);
26 | }
27 |
28 | private:
29 | virtual void execute_with(const internal_pqxx::Context& pqxx_context) = 0;
30 | };
31 |
32 | } // namespace simulator::data_layer::database
33 |
34 | #endif // SIMULATOR_PROJECT_DATA_LAYER_IH_COMMON_CONTEXT_RESOLVER_HPP_
35 |
--------------------------------------------------------------------------------
/project/data_layer/ih/common/database/driver.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_IH_COMMON_DRIVER_HPP_
2 | #define SIMULATOR_DATA_LAYER_IH_COMMON_DRIVER_HPP_
3 |
4 | #include "api/database/context.hpp"
5 | #include "cfg/api/cfg.hpp"
6 | #include "ih/common/database/context_resolver.hpp"
7 | #include "ih/pqxx/context.hpp"
8 |
9 | namespace simulator::data_layer::database {
10 |
11 | class Driver final {
12 | public:
13 | [[nodiscard]]
14 | static auto configure(const cfg::DbConfiguration& cfg)
15 | -> database::Context;
16 |
17 | [[nodiscard]]
18 | static auto make_database_context(internal_pqxx::Context pqxx)
19 | -> database::Context;
20 |
21 | private:
22 | Driver() = default;
23 |
24 | [[nodiscard]]
25 | static auto setup_pqxx_backend(const cfg::DbConfiguration& cfg)
26 | -> database::Context;
27 | };
28 |
29 | } // namespace simulator::data_layer::database
30 |
31 | #endif // SIMULATOR_DATA_LAYER_IH_COMMON_DRIVER_HPP_
32 |
--------------------------------------------------------------------------------
/project/data_layer/ih/common/database/ping_agent.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_IH_COMMON_DATABASE_PING_AGENT_HPP_
2 | #define SIMULATOR_DATA_LAYER_IH_COMMON_DATABASE_PING_AGENT_HPP_
3 |
4 | #include
5 |
6 | #include "api/database/context.hpp"
7 | #include "ih/common/database/context_resolver.hpp"
8 | #include "ih/pqxx/database/connector.hpp"
9 |
10 | namespace simulator::data_layer::database {
11 |
12 | class PingAgent final : public ContextResolver {
13 | public:
14 | using PqxxAgentStrategy = std::function;
15 |
16 | static auto ping(const database::Context& context) noexcept -> bool;
17 |
18 | PingAgent() = delete;
19 |
20 | explicit PingAgent(PqxxAgentStrategy pqxx_agent) noexcept;
21 |
22 | auto ping_with_context(const database::Context& context) noexcept -> bool;
23 |
24 | private:
25 | auto execute_with(const internal_pqxx::Context& pqxx_context)
26 | -> void override;
27 |
28 | PqxxAgentStrategy pqxx_agent_;
29 | };
30 |
31 | } // namespace simulator::data_layer::database
32 |
33 | #endif // SIMULATOR_DATA_LAYER_IH_COMMON_DATABASE_PING_AGENT_HPP_
34 |
--------------------------------------------------------------------------------
/project/data_layer/ih/pqxx/database/value_sanitizer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_IH_PQXX_DATABASE_VALUE_SANITIZER_HPP_
2 | #define SIMULATOR_DATA_LAYER_IH_PQXX_DATABASE_VALUE_SANITIZER_HPP_
3 |
4 | #include
5 | #include
6 |
7 | namespace simulator::data_layer::internal_pqxx {
8 |
9 | class ValueSanitizer {
10 | public:
11 | explicit ValueSanitizer(const pqxx::connection& connection) noexcept
12 | : connection_(connection) {}
13 |
14 | template
15 | auto operator()(const T& value) -> std::string {
16 | return connection_.get().quote(value);
17 | }
18 |
19 | private:
20 | std::reference_wrapper connection_;
21 | };
22 |
23 | } // namespace simulator::data_layer::internal_pqxx
24 |
25 | #endif // SIMULATOR_DATA_LAYER_IH_PQXX_DATABASE_VALUE_SANITIZER_HPP_
26 |
--------------------------------------------------------------------------------
/project/data_layer/include/data_layer/api/database/context.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_DATABASE_CONTEXT_HPP_
2 | #define SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_DATABASE_CONTEXT_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::data_layer::database {
7 |
8 | class ContextResolver;
9 |
10 | class Context final {
11 | friend class Driver;
12 | friend class ContextResolver;
13 | class Implementation;
14 |
15 | public:
16 | Context(const Context&) = default;
17 | auto operator=(const Context&) -> Context& = default;
18 |
19 | Context(Context&&) = default;
20 | auto operator=(Context&&) -> Context& = default;
21 |
22 | ~Context() = default;
23 |
24 | private:
25 | Context() = default;
26 |
27 | auto accept(ContextResolver& resolver) const -> void;
28 |
29 | std::shared_ptr implementation_;
30 | };
31 |
32 | } // namespace simulator::data_layer::database
33 |
34 | #endif // SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_DATABASE_CONTEXT_HPP_
35 |
--------------------------------------------------------------------------------
/project/data_layer/include/data_layer/api/predicate/definitions.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_PREDICATE_DEFINITIONS_HPP_
2 | #define SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_PREDICATE_DEFINITIONS_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | namespace simulator::data_layer::predicate {
10 |
11 | enum class BasicOperation { Eq, Neq, Less, Greater, LessEq, GreaterEq };
12 |
13 | enum class CompositeOperation { And, Or };
14 |
15 | // A tuple of standard types, that can be stored by any predicate expression.
16 | using StandardTypes =
17 | std::tuple;
18 |
19 | // A pre-declaration of a generic predicate expression.
20 | template
21 | class Expression;
22 |
23 | } // namespace simulator::data_layer::predicate
24 |
25 | #endif // SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_PREDICATE_DEFINITIONS_HPP_
26 |
--------------------------------------------------------------------------------
/project/data_layer/include/data_layer/api/validations/column_mapping.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_VALIDATIONS_COLUMN_MAPPING_HPP_
2 | #define SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_VALIDATIONS_COLUMN_MAPPING_HPP_
3 |
4 | #include "data_layer/api/models/column_mapping.hpp"
5 |
6 | namespace simulator::data_layer::validation {
7 |
8 | auto valid_variable_depth(const ColumnMapping& column_mapping) -> bool;
9 | auto valid_variable_depth(const ColumnMapping::Patch& column_mapping) -> bool;
10 |
11 | } // namespace simulator::data_layer::validation
12 |
13 | #endif // SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_VALIDATIONS_COLUMN_MAPPING_HPP_
14 |
--------------------------------------------------------------------------------
/project/data_layer/include/data_layer/api/validations/datasource.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_VALIDATIONS_DATASOURCE_HPP_
2 | #define SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_VALIDATIONS_DATASOURCE_HPP_
3 |
4 | #include
5 |
6 | #include "data_layer/api/models/datasource.hpp"
7 |
8 | namespace simulator::data_layer::validation {
9 |
10 | [[nodiscard]]
11 | auto valid(const Datasource& datasource) -> tl::expected;
12 |
13 | [[nodiscard]]
14 | auto valid(const Datasource::Patch& datasource)
15 | -> tl::expected;
16 |
17 | } // namespace simulator::data_layer::validation
18 |
19 | #endif // SIMULATOR_DATA_LAYER_INCLUDE_DATA_LAYER_API_VALIDATIONS_DATASOURCE_HPP_
20 |
--------------------------------------------------------------------------------
/project/data_layer/src/api/validations/column_mapping.cpp:
--------------------------------------------------------------------------------
1 | #include "api/validations/column_mapping.hpp"
2 |
3 | #include "api/converters/column_mapping.hpp"
4 |
5 | namespace simulator::data_layer::validation {
6 |
7 | namespace {
8 |
9 | template
10 | auto variable_depth_validation(const T& column_mapping) -> bool {
11 | const auto column_from = converter::extract_column_name_from_variable_depth(
12 | column_mapping.column_from());
13 | const auto column_to = converter::extract_column_name_from_variable_depth(
14 | column_mapping.column_to());
15 | return column_from.has_value() && column_to.has_value();
16 | }
17 |
18 | } // namespace
19 |
20 | auto valid_variable_depth(const ColumnMapping& column_mapping) -> bool {
21 | return variable_depth_validation(column_mapping);
22 | }
23 |
24 | auto valid_variable_depth(const ColumnMapping::Patch& column_mapping) -> bool {
25 | return variable_depth_validation(column_mapping);
26 | }
27 |
28 | } // namespace simulator::data_layer::validation
29 |
--------------------------------------------------------------------------------
/project/data_layer/tests/test_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "cfg/api/cfg.hpp"
4 |
5 | int main(int argc, char** argv) {
6 | simulator::cfg::init();
7 | testing::InitGoogleTest(&argc, argv);
8 | return RUN_ALL_TESTS();
9 | }
10 |
--------------------------------------------------------------------------------
/project/data_layer/tests/test_utils/matchers.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_TESTS_TEST_UTILS_MATCHERS_HPP_
2 | #define SIMULATOR_DATA_LAYER_TESTS_TEST_UTILS_MATCHERS_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::data_layer {
7 |
8 | using namespace ::testing;
9 |
10 | MATCHER_P(IsUnexpected, error_message, "") {
11 | return ExplainMatchResult(IsFalse(), arg.has_value(), result_listener) &&
12 | ExplainMatchResult(StrEq(error_message), arg.error(), result_listener);
13 | }
14 |
15 | } // namespace simulator::data_layer
16 |
17 | #endif // SIMULATOR_DATA_LAYER_TESTS_TEST_UTILS_MATCHERS_HPP_
18 |
--------------------------------------------------------------------------------
/project/data_layer/tests/test_utils/sanitizer_stub.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_DATA_LAYER_TESTS_TEST_UTILS_SANITIZER_STUB_HPP_
2 | #define SIMULATOR_DATA_LAYER_TESTS_TEST_UTILS_SANITIZER_STUB_HPP_
3 |
4 | #include
5 |
6 | #include
7 |
8 | namespace simulator::data_layer {
9 |
10 | struct SanitizerStub {
11 | template
12 | auto operator()(T&& value) -> std::string {
13 | return fmt::format("`{}`", std::forward(value));
14 | }
15 | };
16 |
17 | } // namespace simulator::data_layer
18 |
19 | #endif // SIMULATOR_DATA_LAYER_TESTS_TEST_UTILS_SANITIZER_STUB_HPP_
20 |
--------------------------------------------------------------------------------
/project/fix/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(fix
2 | LANGUAGES CXX
3 | DESCRIPTION
4 | "Market Simulator FIX protocol module")
5 |
6 | #------------------------------------------------------------------------------#
7 | # Internal components #
8 | #------------------------------------------------------------------------------#
9 |
10 | add_subdirectory(common)
11 | add_subdirectory(acceptor)
--------------------------------------------------------------------------------
/project/fix/acceptor/ih/communicators/fix_reply_sender.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_IH_COMMUNICATORS_FIX_REPLY_SENDER_HPP_
2 | #define SIMULATOR_ACCEPTOR_IH_COMMUNICATORS_FIX_REPLY_SENDER_HPP_
3 |
4 | #include "ih/communicators/reply_sender.hpp"
5 |
6 | namespace simulator::fix::acceptor {
7 |
8 | class FixReplySender : public ReplySender {
9 | public:
10 | auto send_reply_message(FIX::Message& fix_message,
11 | const FIX::SessionID& fix_session) const noexcept
12 | -> void override;
13 | };
14 |
15 | } // namespace simulator::fix::acceptor
16 |
17 | #endif // SIMULATOR_ACCEPTOR_IH_COMMUNICATORS_FIX_REPLY_SENDER_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/ih/communicators/reply_sender.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_IH_COMMUNICATORS_REPLY_SENDER_HPP_
2 | #define SIMULATOR_ACCEPTOR_IH_COMMUNICATORS_REPLY_SENDER_HPP_
3 |
4 | #include
5 | #include
6 |
7 | namespace simulator::fix::acceptor {
8 |
9 | class ReplySender {
10 | public:
11 | ReplySender() = default;
12 | ReplySender(const ReplySender&) = default;
13 | ReplySender(ReplySender&&) noexcept = default;
14 | virtual ~ReplySender() = default;
15 |
16 | auto operator=(const ReplySender&) -> ReplySender& = default;
17 | auto operator=(ReplySender&&) noexcept -> ReplySender& = default;
18 |
19 | virtual auto send_reply_message(
20 | FIX::Message& fix_message,
21 | const FIX::SessionID& fix_session) const noexcept -> void = 0;
22 | };
23 |
24 | } // namespace simulator::fix::acceptor
25 |
26 | #endif // SIMULATOR_ACCEPTOR_IH_COMMUNICATORS_REPLY_SENDER_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/ih/processors/app_event_processor.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_IH_PROCESSORS_APP_EVENT_PROCESSOR_HPP_
2 | #define SIMULATOR_ACCEPTOR_IH_PROCESSORS_APP_EVENT_PROCESSOR_HPP_
3 |
4 | #include
5 |
6 | #include "common/session_conversion.hpp"
7 | #include "ih/processors/event_processor.hpp"
8 | #include "middleware/routing/trading_session_event_channel.hpp"
9 |
10 | namespace simulator::fix::acceptor {
11 |
12 | class AppEventProcessor : public EventProcessor {
13 | public:
14 | auto process_session_disconnection(const FIX::SessionID& fix_session) const
15 | -> void override {
16 | middleware::emit_trading_session_event(
17 | protocol::SessionTerminatedEvent{decode_session(fix_session)});
18 | }
19 | };
20 |
21 | } // namespace simulator::fix::acceptor
22 |
23 | #endif // SIMULATOR_ACCEPTOR_IH_PROCESSORS_APP_EVENT_PROCESSOR_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/ih/processors/event_processor.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_IH_PROCESSORS_EVENT_PROCESSOR_HPP_
2 | #define SIMULATOR_ACCEPTOR_IH_PROCESSORS_EVENT_PROCESSOR_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::fix::acceptor {
7 |
8 | class EventProcessor {
9 | public:
10 | EventProcessor() = default;
11 | EventProcessor(const EventProcessor&) = default;
12 | EventProcessor(EventProcessor&&) noexcept = default;
13 | virtual ~EventProcessor() = default;
14 |
15 | auto operator=(const EventProcessor&) -> EventProcessor& = default;
16 | auto operator=(EventProcessor&&) noexcept -> EventProcessor& = default;
17 |
18 | virtual auto process_session_disconnection(
19 | const FIX::SessionID& fix_session) const -> void = 0;
20 | };
21 |
22 | } // namespace simulator::fix::acceptor
23 |
24 | #endif // SIMULATOR_ACCEPTOR_IH_PROCESSORS_EVENT_PROCESSOR_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/ih/processors/request_processor.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_IH_PROCESSORS_REQUEST_PROCESSOR_HPP_
2 | #define SIMULATOR_ACCEPTOR_IH_PROCESSORS_REQUEST_PROCESSOR_HPP_
3 |
4 | #include
5 | #include
6 |
7 | namespace simulator::fix::acceptor {
8 |
9 | class RequestProcessor {
10 | public:
11 | RequestProcessor() = default;
12 | RequestProcessor(const RequestProcessor&) = default;
13 | RequestProcessor(RequestProcessor&&) noexcept = default;
14 | virtual ~RequestProcessor() = default;
15 |
16 | auto operator=(const RequestProcessor&) -> RequestProcessor& = default;
17 | auto operator=(RequestProcessor&&) noexcept -> RequestProcessor& = default;
18 |
19 | virtual auto process_fix_request(const FIX::Message& fix_message,
20 | const FIX::SessionID& fix_session) const
21 | -> void = 0;
22 | };
23 |
24 | } // namespace simulator::fix::acceptor
25 |
26 | #endif // SIMULATOR_ACCEPTOR_IH_PROCESSORS_REQUEST_PROCESSOR_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/include/acceptor/acceptor.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_ACCEPTOR_ACCEPTOR_HPP_
2 | #define SIMULATOR_FIX_ACCEPTOR_ACCEPTOR_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::fix {
7 |
8 | struct Acceptor {
9 | struct Implementation;
10 |
11 | explicit Acceptor(std::unique_ptr impl) noexcept;
12 | Acceptor(const Acceptor&) = delete;
13 | Acceptor(Acceptor&&) noexcept;
14 | ~Acceptor() noexcept;
15 |
16 | auto operator=(const Acceptor&) -> Acceptor& = delete;
17 | auto operator=(Acceptor&&) noexcept -> Acceptor&;
18 |
19 | auto implementation() noexcept -> Implementation&;
20 |
21 | private:
22 | std::unique_ptr impl_;
23 | };
24 |
25 | } // namespace simulator::fix
26 |
27 | #endif // SIMULATOR_FIX_ACCEPTOR_ACCEPTOR_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/include/acceptor/lifetime.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_ACCEPTOR_LIFETIME_HPP_
2 | #define SIMULATOR_FIX_ACCEPTOR_LIFETIME_HPP_
3 |
4 | #include
5 |
6 | #include "acceptor/acceptor.hpp"
7 |
8 | namespace simulator::fix {
9 |
10 | [[nodiscard]] auto create_fix_acceptor(const std::filesystem::path& config_path)
11 | -> Acceptor;
12 |
13 | auto start_fix_acceptor(Acceptor& acceptor) -> void;
14 |
15 | auto stop_fix_acceptor(Acceptor& acceptor) noexcept -> void;
16 |
17 | } // namespace simulator::fix
18 |
19 | #endif // SIMULATOR_FIX_ACCEPTOR_LIFETIME_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/src/communicators/fix_reply_sender.cpp:
--------------------------------------------------------------------------------
1 | #include "ih/communicators/fix_reply_sender.hpp"
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | #include "log/logging.hpp"
9 |
10 | namespace simulator::fix::acceptor {
11 |
12 | auto FixReplySender::send_reply_message(
13 | FIX::Message& fix_message, const FIX::SessionID& fix_session) const noexcept
14 | -> void try {
15 | log::debug("sending fix reply message");
16 | FIX::Session::sendToTarget(fix_message, fix_session);
17 | } catch (const FIX::SessionNotFound& exception) {
18 | log::err("failed to send reply message: session not found: {}",
19 | exception.detail);
20 | } catch (const std::exception& exception) {
21 | log::err("failed to send reply message: an error occurred: {}",
22 | exception.what());
23 | } catch (...) {
24 | log::err("failed to send reply message: unknown error occurred");
25 | }
26 |
27 | } // namespace simulator::fix::acceptor
--------------------------------------------------------------------------------
/project/fix/acceptor/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_target_tests(
2 | TARGET ${COMPONENT_NAME}
3 | HEADERS
4 | mocks/event_processor_mock.hpp
5 | mocks/from_fix_mapper_stub.hpp
6 | mocks/reply_sender_mock.hpp
7 | mocks/request_processor_mock.hpp
8 | mocks/to_fix_mapper_stub.hpp
9 | mocks/trading_request_receiver_mock.hpp
10 | UNIT_TESTS
11 | unit_tests/communicators/application_tests.cpp
12 | unit_tests/mapping/from_fix_mapper_tests.cpp
13 | unit_tests/mapping/to_fix_mapper_tests.cpp
14 | unit_tests/processors/app_reply_processor_tests.cpp
15 | unit_tests/processors/app_request_processor_tests.cpp)
--------------------------------------------------------------------------------
/project/fix/acceptor/tests/mocks/event_processor_mock.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_TESTS_MOCKS_EVENT_PROCESSOR_MOCK_HPP_
2 | #define SIMULATOR_ACCEPTOR_TESTS_MOCKS_EVENT_PROCESSOR_MOCK_HPP_
3 |
4 | #include
5 |
6 | #include "ih/processors/event_processor.hpp"
7 |
8 | namespace simulator::fix::acceptor::test {
9 |
10 | struct EventProcessorMock : public EventProcessor {
11 | MOCK_METHOD(void,
12 | process_session_disconnection,
13 | (const FIX::SessionID&),
14 | (const, override));
15 | };
16 |
17 | } // namespace simulator::fix::acceptor::test
18 |
19 | #endif // SIMULATOR_ACCEPTOR_TESTS_MOCKS_EVENT_PROCESSOR_MOCK_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/tests/mocks/reply_sender_mock.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_TESTS_MOCKS_REPLY_SENDER_MOCK_HPP_
2 | #define SIMULATOR_ACCEPTOR_TESTS_MOCKS_REPLY_SENDER_MOCK_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "ih/communicators/reply_sender.hpp"
9 |
10 | namespace simulator::fix::acceptor::test {
11 |
12 | struct ReplySenderMock : public ReplySender {
13 | MOCK_METHOD(void,
14 | send_reply_message,
15 | (FIX::Message&, const FIX::SessionID&),
16 | (const, noexcept, override));
17 | };
18 |
19 | } // namespace simulator::fix::acceptor::test
20 |
21 | #endif // SIMULATOR_ACCEPTOR_TESTS_MOCKS_REPLY_SENDER_MOCK_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/tests/mocks/request_processor_mock.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_TESTS_MOCKS_REQUEST_PROCESSOR_MOCK_HPP_
2 | #define SIMULATOR_ACCEPTOR_TESTS_MOCKS_REQUEST_PROCESSOR_MOCK_HPP_
3 |
4 | #include
5 |
6 | #include "ih/processors/request_processor.hpp"
7 |
8 | namespace simulator::fix::acceptor::test {
9 |
10 | struct RequestProcessorMock : public RequestProcessor {
11 | MOCK_METHOD(void,
12 | process_fix_request,
13 | (const FIX::Message&, const FIX::SessionID&),
14 | (const, override));
15 | };
16 |
17 | } // namespace simulator::fix::acceptor::test
18 |
19 | #endif // SIMULATOR_ACCEPTOR_TESTS_MOCKS_REQUEST_PROCESSOR_MOCK_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/tests/mocks/trading_request_receiver_mock.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_ACCEPTOR_TESTS_MOCKS_TRADING_REQUEST_RECEIVER_MOCK_HPP_
2 | #define SIMULATOR_ACCEPTOR_TESTS_MOCKS_TRADING_REQUEST_RECEIVER_MOCK_HPP_
3 |
4 | #include
5 |
6 | #include "middleware/channels/trading_request_channel.hpp"
7 |
8 | namespace simulator::fix::acceptor::test {
9 |
10 | struct TradingRequestReceiverMock : public middleware::TradingRequestReceiver {
11 | // clang-format off
12 | MOCK_METHOD(void, process, (protocol::OrderPlacementRequest));
13 | MOCK_METHOD(void, process, (protocol::OrderModificationRequest));
14 | MOCK_METHOD(void, process, (protocol::OrderCancellationRequest));
15 | MOCK_METHOD(void, process, (protocol::MarketDataRequest));
16 | MOCK_METHOD(void, process, (protocol::SecurityStatusRequest));
17 | MOCK_METHOD(void, process, (const protocol::InstrumentStateRequest&, protocol::InstrumentState&));
18 | // clang-format on
19 | };
20 |
21 | } // namespace simulator::fix::acceptor::test
22 |
23 | #endif // SIMULATOR_ACCEPTOR_TESTS_MOCKS_TRADING_REQUEST_RECEIVER_MOCK_HPP_
--------------------------------------------------------------------------------
/project/fix/acceptor/tests/test_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | auto main(int argc, char** argv) -> int {
4 | testing::InitGoogleTest(&argc, argv);
5 | return RUN_ALL_TESTS();
6 | }
--------------------------------------------------------------------------------
/project/fix/common/include/common/custom_fields.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_FIX_CUSTOM_FIELDS_HPP_
2 | #define SIMULATOR_FIX_COMMON_FIX_CUSTOM_FIELDS_HPP_
3 |
4 | #include
5 |
6 | namespace FIX {
7 |
8 | USER_DEFINE_INT(ShortSaleExemptionReason, 1688);
9 | USER_DEFINE_CHAR(AggressorSide, 2446);
10 |
11 | } // namespace FIX
12 |
13 | #endif // SIMULATOR_FIX_COMMON_FIX_CUSTOM_FIELDS_HPP_
14 |
--------------------------------------------------------------------------------
/project/fix/common/include/common/fix_logger.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_FIX_LOGGER_HPP_
2 | #define SIMULATOR_FIX_COMMON_FIX_LOGGER_HPP_
3 |
4 | #include
5 |
6 | #include
7 |
8 | namespace simulator::fix {
9 |
10 | [[nodiscard]] auto create_log_factory() -> std::unique_ptr;
11 |
12 | } // namespace simulator::fix
13 |
14 | #endif // SIMULATOR_FIX_COMMON_INCLUDE_FIX_COMMON_FIX_LOGGER_HPP_
15 |
--------------------------------------------------------------------------------
/project/fix/common/include/common/mapping/checks.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_MAPPING_CHECKS_HPP_
2 | #define SIMULATOR_FIX_COMMON_MAPPING_CHECKS_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::fix {
7 |
8 | template
9 | auto contains(const FIX::FieldMap& fix_source) -> bool {
10 | static_assert(sizeof...(FixFieldTags) > 0,
11 | "No FIX field tags are provided to check their presence");
12 | return (fix_source.isSetField(FixFieldTags) && ...);
13 | }
14 |
15 | } // namespace simulator::fix
16 |
17 | #endif // SIMULATOR_FIX_COMMON_MAPPING_CHECKS_HPP_
--------------------------------------------------------------------------------
/project/fix/common/include/common/mapping/detail/definitions.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_MAPPING_DETAIL_DEFINITIONS_HPP_
2 | #define SIMULATOR_FIX_COMMON_MAPPING_DETAIL_DEFINITIONS_HPP_
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "core/common/attribute.hpp"
9 | #include "core/common/meta.hpp"
10 |
11 | namespace simulator::fix::detail {
12 |
13 | // Each FIX field is represented by a type derived from FIX::FieldBase.
14 | template
15 | concept FixFieldConcept = std::derived_from;
16 |
17 | // Each internal field is represented by an internal attribute-based type.
18 | template
19 | concept InternalFieldConcept = core::attribute::RepresentsAttribute;
20 |
21 | template
22 | concept NonBooleanArithmetic = core::Arithmetic && !std::same_as;
23 |
24 | } // namespace simulator::fix::detail
25 |
26 | #endif // SIMULATOR_FIX_COMMON_MAPPING_DETAIL_DEFINITIONS_HPP_
--------------------------------------------------------------------------------
/project/fix/common/include/common/mapping/setting/mapping_settings.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_MAPPING_SETTING_MAPPING_SETTINGS_HPP_
2 | #define SIMULATOR_FIX_COMMON_MAPPING_SETTING_MAPPING_SETTINGS_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "common/mapping/setting/timestamp_precision.hpp"
10 |
11 | namespace simulator::fix {
12 |
13 | class MappingSettings {
14 | public:
15 | explicit MappingSettings(const std::vector& sessions);
16 |
17 | struct Setting {
18 | TimestampPrecision timestamp_precision{TimestampPrecision::Milliseconds};
19 | };
20 |
21 | auto get_setting(const FIX::SessionID& session_id) const -> Setting;
22 |
23 | private:
24 | std::map settings_;
25 | };
26 |
27 | } // namespace simulator::fix
28 |
29 | #endif // SIMULATOR_FIX_COMMON_MAPPING_SETTING_MAPPING_SETTINGS_HPP_
30 |
--------------------------------------------------------------------------------
/project/fix/common/include/common/message_store.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_MESSAGE_STORE_HPP_
2 | #define SIMULATOR_FIX_COMMON_MESSAGE_STORE_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 | #include
9 |
10 | namespace simulator::fix {
11 |
12 | struct MessageStoreInitializationError : public std::exception {};
13 |
14 | [[nodiscard]] auto create_message_store_factory(
15 | const FIX::SessionSettings& settings)
16 | -> std::unique_ptr;
17 |
18 | } // namespace simulator::fix
19 |
20 | #endif // SIMULATOR_FIX_COMMON_MESSAGE_STORE_HPP_
--------------------------------------------------------------------------------
/project/fix/common/include/common/meta.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_META_HPP_
2 | #define SIMULATOR_FIX_COMMON_META_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::fix {
7 |
8 | template
9 | concept RequestMessageMapper = requires(
10 | const Mapper& mapper, const SourceMessage& source, TargetMessage& target) {
11 | { mapper.map(source, target) } -> std::same_as;
12 | };
13 |
14 | template
18 | concept ReplyMessageMapper = requires(const Mapper& mapper,
19 | const SourceMessage& source,
20 | TargetMessage& target,
21 | const Setting& settings) {
22 | { mapper.map(source, target, settings) } -> std::same_as;
23 | };
24 |
25 | } // namespace simulator::fix
26 |
27 | #endif // SIMULATOR_FIX_COMMON_COMMON_META_HPP_
--------------------------------------------------------------------------------
/project/fix/common/include/common/session_conversion.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_SESSION_CONVERSION_HPP_
2 | #define SIMULATOR_FIX_COMMON_SESSION_CONVERSION_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "protocol/types/session.hpp"
10 |
11 | namespace simulator::fix {
12 |
13 | struct InvalidSessionCategoryError : std::invalid_argument {
14 | explicit InvalidSessionCategoryError(const std::string& message);
15 | };
16 |
17 | [[nodiscard]]
18 | auto decode_session(const FIX::SessionID& session_id) -> protocol::Session;
19 |
20 | [[nodiscard]]
21 | auto encode_session(const protocol::fix::Session& session) -> FIX::SessionID;
22 |
23 | [[nodiscard]]
24 | auto encode_session(const protocol::Session& session) -> FIX::SessionID;
25 |
26 | auto map_sender_sub_id(const FIX::Message& source,
27 | protocol::Session& destination) -> void;
28 |
29 | auto map_target_sub_id(const protocol::Session& source,
30 | FIX::Message& destination) -> void;
31 |
32 | } // namespace simulator::fix
33 |
34 | #endif // SIMULATOR_FIX_COMMON_SESSION_CONVERSION_HPP_
--------------------------------------------------------------------------------
/project/fix/common/include/common/session_settings.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_FIX_COMMON_SESSION_SETTINGS_HPP_
2 | #define SIMULATOR_FIX_COMMON_SESSION_SETTINGS_HPP_
3 |
4 | #include
5 |
6 | #include
7 |
8 | namespace simulator::fix {
9 |
10 | [[nodiscard]] auto read_settings_from_file(
11 | const std::filesystem::path& file_path) -> FIX::SessionSettings;
12 |
13 | } // namespace simulator::fix
14 |
15 | #endif // SIMULATOR_FIX_COMMON_SESSION_SETTINGS_HPP_
--------------------------------------------------------------------------------
/project/fix/common/src/mapping/setting/mapping_settings.cpp:
--------------------------------------------------------------------------------
1 | #include "common/mapping/setting/mapping_settings.hpp"
2 |
3 | #include "log/logging.hpp"
4 |
5 | namespace simulator::fix {
6 |
7 | MappingSettings::MappingSettings(const std::vector& sessions) {
8 | for (const auto& session : sessions) {
9 | if (session != nullptr) {
10 | auto& setting = settings_[session->getSessionID()];
11 | setting.timestamp_precision =
12 | TimestampPrecision{session->getTimestampPrecision()};
13 | }
14 | }
15 | }
16 |
17 | auto MappingSettings::get_setting(const FIX::SessionID& session_id) const
18 | -> Setting {
19 | if (const auto iter = settings_.find(session_id); iter != settings_.end()) {
20 | return iter->second;
21 | }
22 | return {};
23 | }
24 |
25 | } // namespace simulator::fix
--------------------------------------------------------------------------------
/project/fix/common/tests/test_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "cfg/api/cfg.hpp"
4 |
5 | auto main(int argc, char **argv) -> int {
6 | testing::InitGoogleTest(&argc, argv);
7 |
8 | simulator::cfg::init();
9 |
10 | return RUN_ALL_TESTS();
11 | }
--------------------------------------------------------------------------------
/project/generator/ih/context/component_context.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_CONTEXT_COMPONENT_CONTEXT_HPP_
2 | #define SIMULATOR_GENERATOR_IH_CONTEXT_COMPONENT_CONTEXT_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "data_layer/api/models/venue.hpp"
8 |
9 | namespace simulator::generator {
10 |
11 | class ComponentContext {
12 | public:
13 | using OnStartupCallback = std::function;
14 |
15 | virtual ~ComponentContext() = default;
16 |
17 | [[nodiscard]]
18 | virtual auto is_component_running() const noexcept -> bool = 0;
19 |
20 | [[nodiscard]]
21 | virtual auto get_venue() const noexcept -> const data_layer::Venue& = 0;
22 |
23 | virtual auto generate_identifier() noexcept -> std::string = 0;
24 |
25 | virtual auto next_generated_order_message_number() noexcept
26 | -> std::size_t = 0;
27 |
28 | virtual auto call_on_launch(const OnStartupCallback& callback) -> void = 0;
29 | };
30 |
31 | } // namespace simulator::generator
32 |
33 | #endif // SIMULATOR_GENERATOR_IH_CONTEXT_COMPONENT_CONTEXT_HPP_
34 |
--------------------------------------------------------------------------------
/project/generator/ih/context/order_generation_context.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_CONTEXT_ORDER_GENERATION_CONTEXT_HPP_
2 | #define SIMULATOR_GENERATOR_IH_CONTEXT_ORDER_GENERATION_CONTEXT_HPP_
3 |
4 | #include "data_layer/api/models/price_seed.hpp"
5 | #include "ih/context/instrument_context.hpp"
6 | #include "ih/context/order_market_data_provider.hpp"
7 |
8 | namespace simulator::generator {
9 |
10 | class OrderGenerationContext : public OrderInstrumentContext {
11 | public:
12 | [[nodiscard]]
13 | virtual auto get_price_seed() const noexcept
14 | -> const data_layer::PriceSeed& = 0;
15 |
16 | [[nodiscard]]
17 | virtual auto get_current_market_state() const -> MarketState = 0;
18 | };
19 |
20 | } // namespace simulator::generator
21 |
22 | #endif // SIMULATOR_GENERATOR_IH_CONTEXT_ORDER_GENERATION_CONTEXT_HPP_
23 |
--------------------------------------------------------------------------------
/project/generator/ih/context/order_market_data_provider.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_CONTEXT_ORDER_MARKET_DATA_PROVIDER_HPP_
2 | #define SIMULATOR_GENERATOR_IH_CONTEXT_ORDER_MARKET_DATA_PROVIDER_HPP_
3 |
4 | #include "core/domain/instrument_descriptor.hpp"
5 |
6 | namespace simulator::generator {
7 |
8 | struct MarketState {
9 | std::optional best_bid_price;
10 | std::optional best_offer_price;
11 | std::optional bid_depth_levels;
12 | std::optional offer_depth_levels;
13 | };
14 |
15 | class OrderMarketDataProvider {
16 | public:
17 | explicit OrderMarketDataProvider(InstrumentDescriptor order_instrument);
18 |
19 | [[nodiscard]] auto get_market_state() const -> MarketState;
20 |
21 | private:
22 | InstrumentDescriptor instrument_descriptor_;
23 | };
24 |
25 | } // namespace simulator::generator
26 |
27 | #endif // SIMULATOR_GENERATOR_IH_CONTEXT_ORDER_MARKET_DATA_PROVIDER_HPP_
28 |
--------------------------------------------------------------------------------
/project/generator/ih/historical/mapping/column_mapping_filter.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_HISTORICAL_MAPPING_COLUMN_MAPPING_FILTER_HPP_
2 | #define SIMULATOR_GENERATOR_IH_HISTORICAL_MAPPING_COLUMN_MAPPING_FILTER_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "data_layer/api/converters/column_mapping.hpp"
8 | #include "data_layer/api/models/column_mapping.hpp"
9 |
10 | namespace simulator::generator::historical::mapping {
11 |
12 | auto filter(const std::vector& mapping_configs,
13 | std::uint32_t depth_to_parse)
14 | -> std::vector;
15 |
16 | } // namespace simulator::generator::historical::mapping
17 |
18 | #endif // SIMULATOR_GENERATOR_IH_HISTORICAL_MAPPING_COLUMN_MAPPING_FILTER_HPP_
19 |
--------------------------------------------------------------------------------
/project/generator/ih/historical/mapping/datasource_params.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_HISTORICAL_MAPPING_DATASOURCE_PARAMS_HPP_
2 | #define SIMULATOR_GENERATOR_IH_HISTORICAL_MAPPING_DATASOURCE_PARAMS_HPP_
3 |
4 | #include
5 |
6 | #include "data_layer/api/models/datasource.hpp"
7 |
8 | namespace simulator::generator::historical {
9 |
10 | class DatasourceParams {
11 | public:
12 | static const DatasourceParams Postgres;
13 | static const DatasourceParams CsvNoHeader;
14 | static const DatasourceParams CsvHasHeader;
15 |
16 | [[nodiscard]]
17 | auto operator==(const DatasourceParams& other) const noexcept
18 | -> bool = default;
19 |
20 | private:
21 | constexpr DatasourceParams(data_layer::Datasource::Format format,
22 | std::optional has_header_row) noexcept
23 | : format_(format), has_header_row_(has_header_row) {}
24 |
25 | data_layer::Datasource::Format format_;
26 | std::optional has_header_row_;
27 | };
28 |
29 | } // namespace simulator::generator::historical
30 |
31 | #endif // SIMULATOR_GENERATOR_IH_HISTORICAL_MAPPING_DATASOURCE_PARAMS_HPP_
32 |
--------------------------------------------------------------------------------
/project/generator/ih/random/algorithm/generation_algorithm.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_RANDOM_ALGORITHM_GENERATION_ALGORITHM_HPP_
2 | #define SIMULATOR_GENERATOR_IH_RANDOM_ALGORITHM_GENERATION_ALGORITHM_HPP_
3 |
4 | #include "ih/adaptation/generated_message.hpp"
5 |
6 | namespace simulator::generator::random {
7 |
8 | class GenerationAlgorithm {
9 | public:
10 | virtual ~GenerationAlgorithm() = default;
11 |
12 | // Fills the message with a generated data.
13 | // - `target_message` is considered as finished and valid when `generate`
14 | // returns `true`
15 | // - `target_message` content has to be ignored in case `false`
16 | // is returned
17 | virtual auto generate(GeneratedMessage& target_message) -> bool = 0;
18 | };
19 |
20 | } // namespace simulator::generator::random
21 |
22 | #endif // SIMULATOR_GENERATOR_IH_RANDOM_ALGORITHM_GENERATION_ALGORITHM_HPP_
23 |
--------------------------------------------------------------------------------
/project/generator/ih/random/generators/value_generator_impl.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_RANDOM_GENERATORS_VALUE_GENERATOR_IMPL_HPP_
2 | #define SIMULATOR_GENERATOR_IH_RANDOM_GENERATORS_VALUE_GENERATOR_IMPL_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "ih/random/generators/value_generator.hpp"
8 |
9 | namespace simulator::generator::random {
10 |
11 | class ValueGeneratorImpl final : public random::ValueGenerator {
12 | public:
13 | ValueGeneratorImpl();
14 |
15 | static auto create() -> std::shared_ptr;
16 |
17 | private:
18 | auto generate_uniform(RandomInt min, RandomInt max) -> RandomInt override;
19 |
20 | auto generate_uniform(RandomUnsignedInt min, RandomUnsignedInt max)
21 | -> RandomUnsignedInt override;
22 |
23 | auto generate_uniform(RandomFloat min, RandomFloat max)
24 | -> RandomFloat override;
25 |
26 | std::mt19937 engine_;
27 | };
28 |
29 | } // namespace simulator::generator::random
30 |
31 | #endif // SIMULATOR_GENERATOR_IH_RANDOM_GENERATORS_VALUE_GENERATOR_IMPL_HPP_
32 |
--------------------------------------------------------------------------------
/project/generator/ih/random/utils.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_RANDOM_UTILS_HPP_
2 | #define SIMULATOR_GENERATOR_IH_RANDOM_UTILS_HPP_
3 |
4 | #include "core/domain/attributes.hpp"
5 | #include "ih/context/order_market_data_provider.hpp"
6 |
7 | namespace simulator::generator::random::Utils {
8 |
9 | inline auto opposite(Side side) -> Side {
10 | return side == Side::Option::Buy ? Side::Option::Sell : Side::Option::Buy;
11 | }
12 |
13 | inline auto select_price(const MarketState& mkt_state, Side side)
14 | -> std::optional {
15 | return side == Side::Option::Buy ? mkt_state.best_bid_price
16 | : mkt_state.best_offer_price;
17 | }
18 |
19 | } // namespace simulator::generator::random::Utils
20 |
21 | #endif // SIMULATOR_GENERATOR_IH_RANDOM_UTILS_HPP_
22 |
--------------------------------------------------------------------------------
/project/generator/ih/tracing/null_tracer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_TRACING_NULL_TRACER_HPP_
2 | #define SIMULATOR_GENERATOR_IH_TRACING_NULL_TRACER_HPP_
3 |
4 | namespace simulator::generator::trace {
5 |
6 | class NullTracer {
7 | public:
8 | class Step {};
9 |
10 | template
11 | static auto make_step(Ts&&... /*args*/) noexcept -> NullTracer::Step {
12 | return NullTracer::Step{};
13 | }
14 | };
15 |
16 | } // namespace simulator::generator::trace
17 |
18 | #endif // SIMULATOR_GENERATOR_IH_TRACING_NULL_TRACER_HPP_
19 |
--------------------------------------------------------------------------------
/project/generator/ih/utils/executable.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_UTILS_EXECUTABLE_HPP_
2 | #define SIMULATOR_GENERATOR_IH_UTILS_EXECUTABLE_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::generator {
7 |
8 | class Executable {
9 | public:
10 | virtual ~Executable() = default;
11 |
12 | virtual void prepare() noexcept = 0;
13 |
14 | virtual void execute() = 0;
15 |
16 | [[nodiscard]]
17 | virtual auto finished() const noexcept -> bool = 0;
18 |
19 | [[nodiscard]]
20 | virtual auto next_exec_timeout() const -> std::chrono::microseconds = 0;
21 | };
22 |
23 | } // namespace simulator::generator
24 |
25 | #endif // SIMULATOR_GENERATOR_IH_UTILS_EXECUTABLE_HPP_
26 |
--------------------------------------------------------------------------------
/project/generator/ih/utils/parsers.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_UTILS_PARSERS_HPP_
2 | #define SIMULATOR_GENERATOR_IH_UTILS_PARSERS_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | namespace simulator::generator::parsing {
9 |
10 | // YYYY-mm-dd HH:MM:SS.MS
11 | constexpr std::string_view DefaultTimestampFormat{"%F %T"};
12 |
13 | auto parse(std::stringstream& buffer,
14 | std::chrono::system_clock::time_point& dest,
15 | std::string_view format = DefaultTimestampFormat) -> bool;
16 |
17 | auto parse(std::string_view timestamp,
18 | std::chrono::system_clock::time_point& dest,
19 | std::stringstream& buffer,
20 | std::string_view format = DefaultTimestampFormat) -> bool;
21 |
22 | auto parse(std::string_view timestamp,
23 | std::chrono::system_clock::time_point& dest,
24 | std::string_view format = DefaultTimestampFormat) -> bool;
25 |
26 | } // namespace simulator::generator::parsing
27 |
28 | #endif // SIMULATOR_GENERATOR_IH_UTILS_PARSERS_HPP_
29 |
--------------------------------------------------------------------------------
/project/generator/ih/utils/validator.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_IH_UTILS_VALIDATOR_HPP_
2 | #define SIMULATOR_GENERATOR_IH_UTILS_VALIDATOR_HPP_
3 |
4 | #include "data_layer/api/models/listing.hpp"
5 | #include "data_layer/api/models/price_seed.hpp"
6 |
7 | namespace simulator::generator {
8 |
9 | class Validator {
10 | public:
11 | static auto is_acceptable(const data_layer::Listing& listing) -> bool;
12 |
13 | static auto is_acceptable_for_random_generation(
14 | const data_layer::Listing& listing) -> bool;
15 |
16 | static auto is_acceptable(const data_layer::PriceSeed& price_seed) -> bool;
17 | };
18 |
19 | } // namespace simulator::generator
20 |
21 | #endif // SIMULATOR_GENERATOR_IH_UTILS_VALIDATOR_HPP_
22 |
--------------------------------------------------------------------------------
/project/generator/src/historical/mapping/datasource_params.cpp:
--------------------------------------------------------------------------------
1 | #include "ih/historical/mapping/datasource_params.hpp"
2 |
3 | namespace simulator::generator::historical {
4 |
5 | const DatasourceParams DatasourceParams::Postgres{
6 | data_layer::Datasource::Format::Postgres, std::nullopt};
7 | const DatasourceParams DatasourceParams::CsvNoHeader{
8 | data_layer::Datasource::Format::Csv, false};
9 | const DatasourceParams DatasourceParams::CsvHasHeader{
10 | data_layer::Datasource::Format::Csv, true};
11 |
12 | } // namespace simulator::generator::historical
13 |
--------------------------------------------------------------------------------
/project/generator/src/random/generators/event_generator.cpp:
--------------------------------------------------------------------------------
1 | #include "ih/random/generators/event_generator.hpp"
2 |
3 | #include
4 | #include
5 |
6 | #include "ih/random/generators/value_generator.hpp"
7 | #include "ih/random/values/event.hpp"
8 |
9 | namespace simulator::generator::random {
10 |
11 | EventGeneratorImpl::EventGeneratorImpl(
12 | std::shared_ptr random_int_generator) noexcept
13 | : random_int_generator_{std::move(random_int_generator)} {
14 | assert(random_int_generator_);
15 | }
16 |
17 | auto EventGeneratorImpl::create(
18 | std::shared_ptr random_int_generator)
19 | -> std::unique_ptr {
20 | return std::make_unique(std::move(random_int_generator));
21 | }
22 |
23 | auto EventGeneratorImpl::generate_choice_integer() -> Event::RandomInteger {
24 | constexpr auto min = Event::min_random_integer();
25 | constexpr auto max = Event::max_random_integer();
26 | static_assert(min <= max);
27 |
28 | return random_int_generator_->generate_uniform_value(min, max);
29 | }
30 |
31 | } // namespace simulator::generator::random
32 |
--------------------------------------------------------------------------------
/project/generator/src/utils/parsers.cpp:
--------------------------------------------------------------------------------
1 | #include "ih/utils/parsers.hpp"
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace simulator::generator::parsing {
8 |
9 | auto parse(std::stringstream& buffer,
10 | std::chrono::system_clock::time_point& dest,
11 | std::string_view format) -> bool {
12 | buffer >> date::parse(std::string{format}, dest);
13 | return !buffer.fail() && !buffer.bad();
14 | }
15 |
16 | auto parse(std::string_view timestamp,
17 | std::chrono::system_clock::time_point& dest,
18 | std::stringstream& buffer,
19 | std::string_view format) -> bool {
20 | buffer.clear();
21 | buffer << timestamp;
22 |
23 | const bool parsed = parse(buffer, dest, format);
24 |
25 | buffer.clear();
26 | return parsed;
27 | }
28 |
29 | auto parse(std::string_view timestamp,
30 | std::chrono::system_clock::time_point& dest,
31 | std::string_view format) -> bool {
32 | std::stringstream buffer{};
33 | return parse(timestamp, dest, buffer, format);
34 | }
35 |
36 | } // namespace simulator::generator::parsing
37 |
--------------------------------------------------------------------------------
/project/generator/tests/mocks/historical/provider.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_MOCKS_HISTORICAL_PROVIDER_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_MOCKS_HISTORICAL_PROVIDER_HPP_
3 |
4 | #include
5 |
6 | #include "ih/historical/data/provider.hpp"
7 | #include "ih/historical/data/record.hpp"
8 | #include "ih/historical/data/time.hpp"
9 |
10 | namespace simulator::generator::mock {
11 |
12 | class DataProvider : public historical::DataProvider {
13 | public:
14 | MOCK_METHOD(bool, is_empty, (), (const, noexcept, override));
15 |
16 | MOCK_METHOD(void, initialize_time_offset, (), (noexcept, override));
17 |
18 | MOCK_METHOD(void, add, (historical::Record), (override));
19 |
20 | MOCK_METHOD(void, pull_into, (historical::Action::Builder&), (override));
21 |
22 | auto assign_time_offset(historical::Duration offset) -> void {
23 | set_time_offset(offset);
24 | }
25 | };
26 |
27 | } // namespace simulator::generator::mock
28 |
29 | #endif // SIMULATOR_GENERATOR_TESTS_MOCKS_HISTORICAL_PROVIDER_HPP_
30 |
--------------------------------------------------------------------------------
/project/generator/tests/mocks/random/counterparty_generator.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_COUNTERPARTY_GENERATOR_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_COUNTERPARTY_GENERATOR_HPP_
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "ih/random/generators/counterparty_generator.hpp"
9 |
10 | namespace simulator::generator::mock {
11 |
12 | class CounterpartyGenerator : public generator::random::CounterpartyGenerator {
13 | public:
14 | MOCK_METHOD(unsigned int, generate_counterparty_number, (), (override));
15 | };
16 |
17 | } // namespace simulator::generator::mock
18 |
19 | #endif // SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_COUNTERPARTY_GENERATOR_HPP_
20 |
--------------------------------------------------------------------------------
/project/generator/tests/mocks/random/price_generator.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_PRICE_GENERATOR_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_PRICE_GENERATOR_HPP_
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "data_layer/api/models/price_seed.hpp"
9 | #include "ih/random/generators/price_generator.hpp"
10 | #include "ih/random/values/event.hpp"
11 |
12 | namespace simulator::generator::mock {
13 |
14 | class PriceGenerator : public generator::random::PriceGenerator {
15 | public:
16 | using GenerationOutput = std::pair;
17 |
18 | static auto make_output(double price) -> GenerationOutput {
19 | return std::make_pair(price, GenerationDetails{});
20 | }
21 |
22 | MOCK_METHOD(GenerationOutput,
23 | generate_px,
24 | (const random::PriceGenerationParams&,
25 | const MarketState&,
26 | const simulator::data_layer::PriceSeed&,
27 | random::Event),
28 | (override));
29 | };
30 |
31 | } // namespace simulator::generator::mock
32 |
33 | #endif // SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_PRICE_GENERATOR_HPP_
34 |
--------------------------------------------------------------------------------
/project/generator/tests/mocks/random/quantity_generator.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_QUANTITY_GENERATOR_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_QUANTITY_GENERATOR_HPP_
3 |
4 | #include
5 |
6 | #include "ih/random/generators/quantity_generator.hpp"
7 |
8 | namespace simulator::generator::mock {
9 |
10 | class QuantityGenerator : public generator::random::QuantityGenerator {
11 | public:
12 | static auto make_output(double qty) -> GenerationOutput {
13 | return GenerationOutput{qty, 0};
14 | }
15 |
16 | MOCK_METHOD(GenerationOutput,
17 | generate_random_qty,
18 | (const random::QuantityGenerationParams&),
19 | (override));
20 | };
21 |
22 | } // namespace simulator::generator::mock
23 |
24 | #endif // SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_QUANTITY_GENERATOR_HPP_
25 |
--------------------------------------------------------------------------------
/project/generator/tests/mocks/random/random_event_generator.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_RANDOM_EVENT_GENERATOR_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_RANDOM_EVENT_GENERATOR_HPP_
3 |
4 | #include
5 |
6 | #include "ih/random/generators/event_generator.hpp"
7 | #include "ih/random/values/event.hpp"
8 |
9 | namespace simulator::generator::mock {
10 |
11 | class EventGenerator : public generator::random::EventGenerator {
12 | public:
13 | MOCK_METHOD(random::Event::RandomInteger,
14 | generate_choice_integer,
15 | (),
16 | (override));
17 | };
18 |
19 | } // namespace simulator::generator::mock
20 |
21 | #endif // SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_RANDOM_EVENT_GENERATOR_HPP_
22 |
--------------------------------------------------------------------------------
/project/generator/tests/mocks/random/resting_order_action_generator.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_RESTING_ORDER_ACTION_GENERATOR_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_RESTING_ORDER_ACTION_GENERATOR_HPP_
3 |
4 | #include
5 |
6 | #include "ih/random/generators/resting_order_action_generator.hpp"
7 | #include "ih/random/values/resting_order_action.hpp"
8 |
9 | namespace simulator::generator::mock {
10 |
11 | class RestingOrderActionGenerator
12 | : public generator::random::RestingOrderActionGenerator {
13 | public:
14 | MOCK_METHOD(random::RestingOrderAction::RandomInteger,
15 | generate_integer,
16 | (),
17 | (override));
18 | };
19 |
20 | } // namespace simulator::generator::mock
21 |
22 | #endif // SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_RESTING_ORDER_ACTION_GENERATOR_HPP_
23 |
--------------------------------------------------------------------------------
/project/generator/tests/mocks/random/value_generator.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_VALUE_GENERATOR_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_VALUE_GENERATOR_HPP_
3 |
4 | #include
5 |
6 | #include "ih/random/generators/value_generator.hpp"
7 |
8 | namespace simulator::generator::mock {
9 |
10 | class ValueGenerator : public generator::random::ValueGenerator {
11 | public:
12 | MOCK_METHOD(RandomInt, generate_uniform, (RandomInt, RandomInt), (override));
13 |
14 | MOCK_METHOD(RandomUnsignedInt,
15 | generate_uniform,
16 | (RandomUnsignedInt, RandomUnsignedInt),
17 | (override));
18 |
19 | MOCK_METHOD(RandomFloat,
20 | generate_uniform,
21 | (RandomFloat, RandomFloat),
22 | (override));
23 | };
24 |
25 | } // namespace simulator::generator::mock
26 |
27 | #endif // SIMULATOR_GENERATOR_TESTS_MOCKS_RANDOM_VALUE_GENERATOR_HPP_
28 |
--------------------------------------------------------------------------------
/project/generator/tests/mocks/trading_request_channel.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_MOCKS_TRADING_REQUEST_CHANNEL_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_MOCKS_TRADING_REQUEST_CHANNEL_HPP_
3 |
4 | #include
5 |
6 | #include "middleware/channels/trading_request_channel.hpp"
7 |
8 | namespace simulator::generator::mock {
9 |
10 | struct TradingRequestReceiver
11 | : public simulator::middleware::TradingRequestReceiver {
12 | // clang-format off
13 | MOCK_METHOD(void, process, (simulator::protocol::OrderPlacementRequest));
14 | MOCK_METHOD(void, process, (simulator::protocol::OrderModificationRequest));
15 | MOCK_METHOD(void, process, (simulator::protocol::OrderCancellationRequest));
16 | MOCK_METHOD(void, process, (simulator::protocol::MarketDataRequest));
17 | MOCK_METHOD(void, process, (simulator::protocol::SecurityStatusRequest));
18 | MOCK_METHOD(void, process, (const simulator::protocol::InstrumentStateRequest&, simulator::protocol::InstrumentState&));
19 | // clang-format on
20 | };
21 |
22 | // clang-format on
23 |
24 | } // namespace simulator::generator::mock
25 |
26 | #endif // SIMULATOR_GENERATOR_TESTS_MOCKS_TRADING_REQUEST_CHANNEL_HPP_
27 |
--------------------------------------------------------------------------------
/project/generator/tests/test_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "cfg/api/cfg.hpp"
4 |
5 | int main(int argc, char** argv) {
6 | simulator::cfg::init();
7 | testing::InitGoogleTest(&argc, argv);
8 | return RUN_ALL_TESTS();
9 | }
10 |
--------------------------------------------------------------------------------
/project/generator/tests/test_utils/generated_message_utils.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_GENERATOR_TESTS_TEST_UTILS_GENERATED_MESSAGE_UTILS_HPP_
2 | #define SIMULATOR_GENERATOR_TESTS_TEST_UTILS_GENERATED_MESSAGE_UTILS_HPP_
3 |
4 | #include
5 |
6 | #include "core/domain/party.hpp"
7 |
8 | namespace simulator::generator {
9 |
10 | using namespace ::testing;
11 |
12 | MATCHER_P(GeneratedParty, party_id, "") {
13 | return ExplainMatchResult(
14 | Eq(party_id), arg.party_id(), result_listener) &&
15 | ExplainMatchResult(Eq(PartyRole::Option::ExecutingFirm),
16 | arg.role().value(),
17 | result_listener) &&
18 | ExplainMatchResult(Eq(PartyIdSource::Option::Proprietary),
19 | arg.source().value(),
20 | result_listener);
21 | }
22 |
23 | } // namespace simulator::generator
24 |
25 | #endif // SIMULATOR_GENERATOR_TESTS_TEST_UTILS_GENERATED_MESSAGE_UTILS_HPP_
26 |
--------------------------------------------------------------------------------
/project/generator/tests/unit_tests/historical/mapping/source_column_tests.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "ih/historical/mapping/specification.hpp"
4 |
5 | namespace simulator::generator::historical::mapping::test {
6 | namespace {
7 |
8 | TEST(GeneratorHistoricalMappingSourceColumn, StoresAssignedIndex) {
9 | constexpr SourceColumn source_column{42};
10 | ASSERT_EQ(source_column.index(), 42);
11 | }
12 |
13 | TEST(GeneratorHistoricalMappingSourceColumn, NumberIsOneMoreThanIndex) {
14 | constexpr SourceColumn source_column{42};
15 | ASSERT_EQ(source_column.number(), 43);
16 | }
17 |
18 | } // namespace
19 | } // namespace simulator::generator::historical::mapping::test
--------------------------------------------------------------------------------
/project/http/ih/constants.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_CONSTANTS_HPP_
2 | #define SIMULATOR_HTTP_IH_CONSTANTS_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::http::constant {
7 |
8 | constexpr std::string_view PxSeedDbConnSetting{"SeedPriceDatabaseConnection"};
9 |
10 | } // namespace simulator::http::constant
11 |
12 | #endif // SIMULATOR_HTTP_IH_CONSTANTS_HPP_
13 |
--------------------------------------------------------------------------------
/project/http/ih/controllers/trading_controller.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_CONTROLLERS_TRADING_CONTROLLER_HPP_
2 | #define SIMULATOR_HTTP_IH_CONTROLLERS_TRADING_CONTROLLER_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | namespace simulator::http {
10 |
11 | class TradingController {
12 | public:
13 | using Result = std::pair;
14 |
15 | [[nodiscard]]
16 | auto halt(const std::string& body) const -> Result;
17 |
18 | [[nodiscard]]
19 | auto resume() const -> Result;
20 |
21 | [[nodiscard]]
22 | auto store_market_state() const -> Result;
23 |
24 | [[nodiscard]]
25 | auto recover_market_state() const -> Result;
26 | };
27 |
28 | } // namespace simulator::http
29 |
30 | #endif // SIMULATOR_HTTP_IH_CONTROLLERS_TRADING_CONTROLLER_HPP_
31 |
--------------------------------------------------------------------------------
/project/http/ih/data_bridge/operation_failure.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_DATA_BRIDGE_OPERATION_FAILURE_HPP_
2 | #define SIMULATOR_HTTP_IH_DATA_BRIDGE_OPERATION_FAILURE_HPP_
3 |
4 | namespace simulator::http::data_bridge {
5 |
6 | enum class Failure : std::uint8_t {
7 | MalformedInput,
8 | DatabaseConnectionError,
9 | ResponseDecodingError,
10 | ResponseCardinalityError,
11 | DataIntegrityViolationError,
12 | UnknownError
13 | };
14 |
15 | struct FailureInfo {
16 | Failure failure;
17 | std::string message;
18 | };
19 |
20 | } // namespace simulator::http::data_bridge
21 |
22 | #endif // SIMULATOR_HTTP_IH_DATA_BRIDGE_OPERATION_FAILURE_HPP_
23 |
--------------------------------------------------------------------------------
/project/http/ih/headers/x_api_version.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_HEADERS_X_API_VERSION_HPP_
2 | #define SIMULATOR_HTTP_IH_HEADERS_X_API_VERSION_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | namespace simulator::http {
10 |
11 | class XApiVersion final : public Pistache::Http::Header::Header {
12 | public:
13 | NAME("X-API-Version")
14 |
15 | auto parse(const std::string& data) -> void override {
16 | if (!data.empty()) {
17 | version_ = data;
18 | }
19 | }
20 |
21 | auto write(std::ostream& ostream) const -> void override {
22 | if (version_) {
23 | ostream << version_.value();
24 | }
25 | }
26 |
27 | auto version() const -> std::optional { return version_; }
28 |
29 | private:
30 | std::optional version_;
31 | };
32 |
33 | } // namespace simulator::http
34 | #endif // SIMULATOR_HTTP_IH_HEADERS_X_API_VERSION_HPP_
35 |
--------------------------------------------------------------------------------
/project/http/ih/marshalling/json/detail/utils.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_MARSHALLING_JSON_DETAIL_UTILS_HPP_
2 | #define SIMULATOR_HTTP_IH_MARSHALLING_JSON_DETAIL_UTILS_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | namespace simulator::http::json {
11 |
12 | inline auto encode(const rapidjson::Document& document) -> std::string {
13 | rapidjson::StringBuffer buffer{};
14 | rapidjson::Writer writer{buffer};
15 |
16 | document.Accept(writer);
17 |
18 | return {buffer.GetString(), buffer.GetSize()};
19 | }
20 |
21 | inline auto make_key(std::string_view key) {
22 | return rapidjson::StringRef(key.data(), key.size());
23 | }
24 |
25 | } // namespace simulator::http::json
26 |
27 | #endif // SIMULATOR_HTTP_IH_MARSHALLING_JSON_DETAIL_UTILS_HPP_
28 |
--------------------------------------------------------------------------------
/project/http/ih/marshalling/json/halt.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_MARSHALLING_JSON_HALT_HPP_
2 | #define SIMULATOR_HTTP_IH_MARSHALLING_JSON_HALT_HPP_
3 |
4 | #include
5 |
6 | #include "protocol/admin/trading_phase.hpp"
7 |
8 | namespace simulator::http::json {
9 |
10 | class HaltUnmarshaller {
11 | public:
12 | static auto unmarshall(std::string_view json,
13 | protocol::HaltPhaseRequest& request) -> void;
14 | };
15 |
16 | } // namespace simulator::http::json
17 |
18 | #endif // SIMULATOR_HTTP_IH_MARSHALLING_JSON_HALT_HPP_
19 |
--------------------------------------------------------------------------------
/project/http/ih/marshalling/json/listing.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_MARSHALLING_JSON_LISTING_HPP_
2 | #define SIMULATOR_HTTP_IH_MARSHALLING_JSON_LISTING_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include "data_layer/api/models/listing.hpp"
11 |
12 | namespace simulator::http::json {
13 |
14 | class ListingMarshaller {
15 | public:
16 | static auto marshall(const data_layer::Listing& listing) -> std::string;
17 |
18 | static auto marshall(const std::vector& listings)
19 | -> std::string;
20 |
21 | private:
22 | static auto marshall(const data_layer::Listing& listing,
23 | rapidjson::Document& dest) -> void;
24 | };
25 |
26 | class ListingUnmarshaller {
27 | public:
28 | static auto unmarshall(std::string_view json,
29 | data_layer::Listing::Patch& dest) -> void;
30 | };
31 |
32 | } // namespace simulator::http::json
33 |
34 | #endif // SIMULATOR_HTTP_IH_MARSHALLING_JSON_LISTING_HPP_
35 |
--------------------------------------------------------------------------------
/project/http/ih/marshalling/json/price_seed.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_MARSHALLING_JSON_PRICE_SEED_HPP_
2 | #define SIMULATOR_HTTP_IH_MARSHALLING_JSON_PRICE_SEED_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include "data_layer/api/models/price_seed.hpp"
11 |
12 | namespace simulator::http::json {
13 |
14 | class PriceSeedMarshaller {
15 | public:
16 | static auto marshall(const data_layer::PriceSeed& seed) -> std::string;
17 |
18 | static auto marshall(const std::vector& seeds)
19 | -> std::string;
20 |
21 | private:
22 | static auto marshall(const data_layer::PriceSeed& seed,
23 | rapidjson::Document& dest) -> void;
24 | };
25 |
26 | class PriceSeedUnmarshaller {
27 | public:
28 | static auto unmarshall(std::string_view json,
29 | data_layer::PriceSeed::Patch& dest) -> void;
30 | };
31 |
32 | } // namespace simulator::http::json
33 |
34 | #endif // SIMULATOR_HTTP_IH_MARSHALLING_JSON_PRICE_SEED_HPP_
35 |
--------------------------------------------------------------------------------
/project/http/ih/marshalling/json/setting.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_MARSHALLING_JSON_SETTING_HPP_
2 | #define SIMULATOR_HTTP_IH_MARSHALLING_JSON_SETTING_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "data_layer/api/models/setting.hpp"
9 |
10 | namespace simulator::http::json {
11 |
12 | class SettingMarshaller {
13 | public:
14 | static auto marshall(const std::vector& settings)
15 | -> std::string;
16 | };
17 |
18 | class SettingUnmarshaller {
19 | public:
20 | static auto unmarshall(std::string_view json,
21 | std::vector& dest) -> void;
22 | };
23 |
24 | } // namespace simulator::http::json
25 |
26 | #endif // SIMULATOR_HTTP_IH_MARSHALLING_JSON_SETTING_HPP_
27 |
--------------------------------------------------------------------------------
/project/http/ih/processors/delete_processor.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_PROCESSORS_DELETE_PROCESSOR_HPP_
2 | #define SIMULATOR_HTTP_IH_PROCESSORS_DELETE_PROCESSOR_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "ih/controllers/price_seed_controller.hpp"
10 |
11 | namespace simulator::http {
12 |
13 | class DeleteProcessor {
14 | public:
15 | explicit DeleteProcessor(
16 | const PriceSeedController& price_seed_controller) noexcept;
17 |
18 | auto delete_price_seed(const Pistache::Rest::Request& request,
19 | Pistache::Http::ResponseWriter response) -> void;
20 |
21 | private:
22 | static auto respond(const Pistache::Rest::Request& request,
23 | Pistache::Http::ResponseWriter& response,
24 | Pistache::Http::Code code,
25 | const std::string& body) -> void;
26 |
27 | std::reference_wrapper price_seed_controller_;
28 | };
29 |
30 | } // namespace simulator::http
31 |
32 | #endif // SIMULATOR_HTTP_IH_PROCESSORS_DELETE_PROCESSOR_HPP_
33 |
--------------------------------------------------------------------------------
/project/http/ih/redirect/destination.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_REDIRECT_DESTINATION_HPP_
2 | #define SIMULATOR_HTTP_IH_REDIRECT_DESTINATION_HPP_
3 |
4 | #include
5 | #include
6 |
7 | namespace simulator::http::redirect {
8 |
9 | class Destination {
10 | public:
11 | Destination() = delete;
12 |
13 | Destination(std::string host, int port) noexcept
14 | : host_{std::move(host)}, port_{port} {}
15 |
16 | auto host() const noexcept -> const std::string& { return host_; }
17 |
18 | auto port() const noexcept -> int { return port_; }
19 |
20 | private:
21 | std::string host_;
22 | int port_;
23 | };
24 |
25 | } // namespace simulator::http::redirect
26 |
27 | #endif // SIMULATOR_HTTP_IH_REDIRECT_DESTINATION_HPP_
28 |
--------------------------------------------------------------------------------
/project/http/ih/redirect/redirector.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_REDIRECT_REDIRECTOR_HPP_
2 | #define SIMULATOR_HTTP_IH_REDIRECT_REDIRECTOR_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "ih/redirect/request.hpp"
8 | #include "ih/redirect/result.hpp"
9 |
10 | namespace simulator::http::redirect {
11 |
12 | class Redirector {
13 | public:
14 | enum class Status : std::uint8_t { Success, ConnectionFailed, UnknownError };
15 |
16 | virtual ~Redirector() = default;
17 |
18 | using RedirectionResult = std::pair, Status>;
19 |
20 | virtual auto redirect(const Request& request) const noexcept
21 | -> RedirectionResult = 0;
22 | };
23 |
24 | } // namespace simulator::http::redirect
25 |
26 | #endif // SIMULATOR_HTTP_IH_REDIRECT_REDIRECTOR_HPP_
27 |
--------------------------------------------------------------------------------
/project/http/ih/redirect/request_redirector.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_REDIRECT_REQUEST_REDIRECTOR_HPP_
2 | #define SIMULATOR_HTTP_IH_REDIRECT_REQUEST_REDIRECTOR_HPP_
3 |
4 | #include
5 |
6 | #include "ih/redirect/redirector.hpp"
7 |
8 | namespace simulator::http::redirect {
9 |
10 | class RequestRedirector final : public Redirector {
11 | public:
12 | auto redirect(const Request& request) const noexcept
13 | -> RedirectionResult override;
14 |
15 | static auto create() -> std::shared_ptr;
16 | };
17 |
18 | } // namespace simulator::http::redirect
19 |
20 | #endif // SIMULATOR_HTTP_IH_REDIRECT_REQUEST_REDIRECTOR_HPP_
21 |
--------------------------------------------------------------------------------
/project/http/ih/redirect/resolver.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_REDIRECT_RESOLVER_HPP_
2 | #define SIMULATOR_HTTP_IH_REDIRECT_RESOLVER_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "ih/redirect/destination.hpp"
8 |
9 | namespace simulator::http::redirect {
10 |
11 | class Resolver {
12 | public:
13 | enum class Status : std::uint8_t {
14 | Success,
15 | NonexistentInstance,
16 | ResolvingFailed,
17 | UnknownError
18 | };
19 |
20 | using ResolvingResult = std::pair, Status>;
21 |
22 | virtual ~Resolver() = default;
23 |
24 | virtual auto resolve_by_venue_id(const std::string& venue_id) const noexcept
25 | -> ResolvingResult = 0;
26 | };
27 |
28 | } // namespace simulator::http::redirect
29 |
30 | #endif // SIMULATOR_HTTP_IH_REDIRECT_RESOLVER_HPP_
31 |
--------------------------------------------------------------------------------
/project/http/ih/redirect/result.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_REDIRECT_RESPONSE_HPP_
2 | #define SIMULATOR_HTTP_IH_REDIRECT_RESPONSE_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | namespace simulator::http::redirect {
10 |
11 | class Result {
12 | public:
13 | Result() = delete;
14 |
15 | explicit Result(Pistache::Http::Code code) noexcept : code_{code} {}
16 |
17 | auto http_code() const noexcept { return code_; }
18 |
19 | auto has_body_content() const noexcept -> bool { return !body_.empty(); }
20 |
21 | auto body_content() const noexcept -> const std::string& { return body_; }
22 |
23 | void set_body_content(std::string body_content) noexcept {
24 | body_ = std::move(body_content);
25 | }
26 |
27 | private:
28 | std::string body_;
29 | Pistache::Http::Code code_;
30 | };
31 |
32 | } // namespace simulator::http::redirect
33 |
34 | #endif // SIMULATOR_HTTP_IH_REDIRECT_RESPONSE_HPP_
35 |
--------------------------------------------------------------------------------
/project/http/ih/server.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_IH_SERVER_HPP_
2 | #define SIMULATOR_HTTP_IH_SERVER_HPP_
3 |
4 | #include
5 |
6 | #include "data_layer/api/database/context.hpp"
7 | #include "http/http.hpp"
8 |
9 | namespace simulator::http {
10 |
11 | struct Server::Implementation {
12 | public:
13 | Implementation(std::uint16_t accept_port,
14 | data_layer::database::Context database);
15 |
16 | auto launch() -> void;
17 |
18 | auto terminate() -> void;
19 |
20 | private:
21 | static auto create_endpoint(std::uint16_t accept_port)
22 | -> std::unique_ptr;
23 |
24 | auto setup_handler(data_layer::database::Context database) -> void;
25 |
26 | std::unique_ptr endpoint_;
27 | };
28 |
29 | } // namespace simulator::http
30 |
31 | #endif // SIMULATOR_HTTP_IH_SERVER_HPP_
32 |
--------------------------------------------------------------------------------
/project/http/include/http/http.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_HTTP_HPP_
2 | #define SIMULATOR_HTTP_HTTP_HPP_
3 |
4 | #include
5 |
6 | #include "data_layer/api/database/context.hpp"
7 |
8 | namespace simulator::http {
9 |
10 | struct Server {
11 | struct Implementation;
12 |
13 | explicit Server(std::unique_ptr impl) noexcept;
14 | Server(const Server&) = delete;
15 | Server(Server&&) noexcept;
16 | ~Server() noexcept;
17 |
18 | auto operator=(const Server&) -> Server& = delete;
19 | auto operator=(Server&&) noexcept -> Server&;
20 |
21 | auto implementation() noexcept -> Implementation&;
22 |
23 | private:
24 | std::unique_ptr impl_;
25 | };
26 |
27 | auto create_http_server(data_layer::database::Context db) -> Server;
28 |
29 | auto launch_http_server(Server& server) -> void;
30 |
31 | auto terminate_http_server(Server& server) noexcept -> void;
32 |
33 | } // namespace simulator::http
34 |
35 | #endif // SIMULATOR_HTTP_HTTP_HPP_
36 |
--------------------------------------------------------------------------------
/project/http/src/marshalling/json/halt.cpp:
--------------------------------------------------------------------------------
1 | #include "ih/marshalling/json/halt.hpp"
2 |
3 | #include
4 |
5 | #include "ih/marshalling/json/detail/unmarshaller.hpp"
6 |
7 | namespace simulator::http::json {
8 |
9 | auto HaltUnmarshaller::unmarshall(
10 | std::string_view json, protocol::HaltPhaseRequest& request)
11 | -> void {
12 | rapidjson::Document document;
13 | document.Parse(json.data());
14 | if (!document.IsObject()) {
15 | throw std::runtime_error{"failed to parse Halt JSON object"};
16 | }
17 |
18 | Unmarshaller unmarshaller{document};
19 | if (!unmarshaller("allowCancels", request.allow_cancels)) {
20 | throw std::invalid_argument{"missing required field \"allowCancels\""};
21 | }
22 | }
23 |
24 | } // namespace simulator::http::json
25 |
--------------------------------------------------------------------------------
/project/http/tests/mocks/redirector.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_TESTS_MOCKS_REDIRECTOR_HPP_
2 | #define SIMULATOR_HTTP_TESTS_MOCKS_REDIRECTOR_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | #include "ih/redirect/redirector.hpp"
10 | #include "ih/redirect/result.hpp"
11 |
12 | namespace simulator::http::mock {
13 |
14 | class Redirector : public redirect::Redirector {
15 | public:
16 | MOCK_METHOD(RedirectionResult,
17 | redirect,
18 | (const redirect::Request&),
19 | (const, noexcept, override));
20 |
21 | static auto make_output(redirect::Result result) -> RedirectionResult {
22 | return std::make_pair(std::make_optional(std::move(result)),
23 | Redirector::Status::Success);
24 | }
25 |
26 | static auto make_output(Redirector::Status status) -> RedirectionResult {
27 | return std::make_pair(std::nullopt, status);
28 | }
29 | };
30 |
31 | } // namespace simulator::http::mock
32 |
33 | #endif // SIMULATOR_HTTP_TESTS_MOCKS_REDIRECTOR_HPP_
34 |
--------------------------------------------------------------------------------
/project/http/tests/mocks/resolver.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_HTTP_TESTS_MOCKS_RESOLVER_HPP_
2 | #define SIMULATOR_HTTP_TESTS_MOCKS_RESOLVER_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | #include "ih/redirect/destination.hpp"
10 | #include "ih/redirect/resolver.hpp"
11 |
12 | namespace simulator::http::mock {
13 |
14 | class Resolver : public redirect::Resolver {
15 | public:
16 | MOCK_METHOD(ResolvingResult,
17 | resolve_by_venue_id,
18 | (const std::string&),
19 | (const, noexcept, override));
20 |
21 | static auto make_output(redirect::Destination destination)
22 | -> redirect::Resolver::ResolvingResult {
23 | return std::make_pair(std::make_optional(std::move(destination)),
24 | redirect::Resolver::Status::Success);
25 | }
26 |
27 | static auto make_output(redirect::Resolver::Status status)
28 | -> redirect::Resolver::ResolvingResult {
29 | return std::make_pair(std::nullopt, status);
30 | }
31 | };
32 |
33 | } // namespace simulator::http::mock
34 |
35 | #endif // SIMULATOR_HTTP_TESTS_MOCKS_RESOLVER_HPP_
36 |
--------------------------------------------------------------------------------
/project/http/tests/test_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "cfg/api/cfg.hpp"
4 |
5 | int main(int argc, char** argv) {
6 | simulator::cfg::init();
7 | testing::InitGoogleTest(&argc, argv);
8 | return RUN_ALL_TESTS();
9 | }
--------------------------------------------------------------------------------
/project/http/tests/unit_tests/headers/x_api_version_tests.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #include "ih/headers/x_api_version.hpp"
6 |
7 | namespace simulator::http::test {
8 | namespace {
9 |
10 | using namespace ::testing; // NOLINT
11 |
12 | TEST(XApiVersion, StoresNoValueIfHeaderIsAbsent) {
13 | XApiVersion header;
14 |
15 | header.parse(std::string{});
16 |
17 | ASSERT_FALSE(header.version().has_value());
18 | }
19 |
20 | TEST(XApiVersion, ParsesToString) {
21 | XApiVersion header;
22 |
23 | header.parse("version_42");
24 |
25 | ASSERT_THAT(header.version(), Optional(Eq("version_42")));
26 | }
27 |
28 | } // namespace
29 | } // namespace simulator::http::test
30 |
--------------------------------------------------------------------------------
/project/http/tests/unit_tests/marshalling/json/halt_unmarshalling_tests.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "ih/marshalling/json/halt.hpp"
4 | #include "protocol/admin/trading_phase.hpp"
5 |
6 | namespace simulator::http::json::test {
7 | namespace {
8 |
9 | TEST(HttpMarshallingJsonHalt, ThrowsExceptionOnAllowCancelsNotSet) {
10 | const std::string json = R"({"notAllowCancels": true})";
11 | protocol::HaltPhaseRequest request;
12 |
13 | EXPECT_ANY_THROW(HaltUnmarshaller::unmarshall(json, request));
14 | }
15 |
16 | TEST(HttpMarshallingJsonHalt, UnmarshallsAllowCancels) {
17 | const std::string json = R"({"allowCancels": true})";
18 | protocol::HaltPhaseRequest request;
19 |
20 | HaltUnmarshaller::unmarshall(json, request);
21 | EXPECT_TRUE(request.allow_cancels);
22 | }
23 |
24 | } // namespace
25 | } // namespace simulator::http::json::test
26 |
--------------------------------------------------------------------------------
/project/http/tests/unit_tests/redirect/result_tests.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "ih/redirect/result.hpp"
4 |
5 | namespace simulator::http::redirect::test {
6 | namespace {
7 |
8 | TEST(HttpRedirectResult, StoresHttpCode) {
9 | const Result result{Pistache::Http::Code::Ok};
10 | ASSERT_EQ(result.http_code(), Pistache::Http::Code::Ok);
11 | }
12 |
13 | TEST(HttpRedirectResult, StoresBodyContent) {
14 | Result result{Pistache::Http::Code::Ok};
15 | const std::string body_content{"Test body content"};
16 | result.set_body_content(body_content);
17 |
18 | ASSERT_TRUE(result.has_body_content());
19 | ASSERT_EQ(result.body_content(), body_content);
20 | }
21 |
22 | TEST(HttpRedirectResult, DoesNotHaveBodyContentIfItIsNotSet) {
23 | const Result result{Pistache::Http::Code::Ok};
24 | ASSERT_FALSE(result.has_body_content());
25 | }
26 |
27 | TEST(HttpRedirectResult, DoesNotHaveBodyContentIfItIsEmpty) {
28 | Result result{Pistache::Http::Code::Ok};
29 | result.set_body_content("");
30 | ASSERT_FALSE(result.has_body_content());
31 | }
32 |
33 | } // namespace
34 | } // namespace simulator::http::redirect::test
35 |
--------------------------------------------------------------------------------
/project/log/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(log
2 | LANGUAGES CXX
3 | DESCRIPTION
4 | "Logger for the whole project")
5 |
6 | #------------------------------------------------------------------------------#
7 |
8 | ensure_project_dependency_exist(spdlog::spdlog)
9 | ensure_project_dependency_exist(simulator::cfg)
10 |
11 | #------------------------------------------------------------------------------#
12 |
13 | add_static_library(
14 | NAME ${PROJECT_NAME}
15 | ALIAS simulator::log
16 | HEADERS
17 | ih/factories/logger_factory.hpp
18 | ih/factories/sink_factory.hpp
19 | ih/custom_spd_flags.hpp
20 | ih/util.hpp
21 | include/log/logging.hpp
22 | include/log/logger.hpp
23 | SOURCES
24 | src/factories/logger_factory.cpp
25 | src/custom_spd_flags.cpp
26 | src/logger.cpp
27 | src/util.cpp
28 | PUBLIC_INCLUDE_DIRECTORIES
29 | ${PROJECT_SOURCE_DIR}/include
30 | PRIVATE_INCLUDE_DIRECTORIES
31 | ${PROJECT_SOURCE_DIR}/include/log
32 | ${PROJECT_SOURCE_DIR}
33 | PUBLIC_DEPENDENCIES
34 | fmt::fmt
35 | spdlog::spdlog)
36 |
37 | #------------------------------------------------------------------------------#
38 |
39 | add_subdirectory(tests)
--------------------------------------------------------------------------------
/project/log/ih/custom_spd_flags.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_LOG_IH_CUSTOM_SPD_FLAGS_HPP_
2 | #define SIMULATOR_LOG_IH_CUSTOM_SPD_FLAGS_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::log {
7 |
8 | class EscapedPayloadFlag final : public spdlog::custom_flag_formatter {
9 | public:
10 | auto format(const spdlog::details::log_msg& msg,
11 | const std::tm& tm_time,
12 | spdlog::memory_buf_t& dest) -> void override;
13 |
14 | [[nodiscard]]
15 | auto clone() const -> std::unique_ptr override;
16 | };
17 |
18 | } // namespace simulator::log
19 |
20 | #endif // SIMULATOR_LOG_IH_CUSTOM_SPD_FLAGS_HPP_
21 |
--------------------------------------------------------------------------------
/project/log/ih/factories/logger_factory.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_LOG_IH_FACTORIES_LOGGER_FACTORY_HPP_
2 | #define SIMULATOR_LOG_IH_FACTORIES_LOGGER_FACTORY_HPP_
3 |
4 | #include
5 |
6 | namespace simulator::log {
7 |
8 | auto create_default_logger(spdlog::sink_ptr sink)
9 | -> std::shared_ptr;
10 |
11 | auto create_app_logger(std::string_view log_level, spdlog::sink_ptr sink)
12 | -> std::shared_ptr;
13 |
14 | } // namespace simulator::log
15 |
16 | #endif // SIMULATOR_LOG_IH_FACTORIES_LOGGER_FACTORY_HPP_
17 |
--------------------------------------------------------------------------------
/project/log/ih/util.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SIMULATOR_LOG_IH_UTIL_HPP_
2 | #define SIMULATOR_LOG_IH_UTIL_HPP_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | namespace simulator::log::util {
10 |
11 | auto get_app_logger_name() -> const std::string&;
12 |
13 | auto get_log_pattern() -> const std::string&;
14 |
15 | auto get_default_filename() -> const std::string&;
16 |
17 | inline auto env_logging_dir = []() -> const char* {
18 | return std::getenv("LOG_DIR");
19 | };
20 |
21 | auto get_logging_dir(const char* (*func)() = env_logging_dir)
22 | -> std::filesystem::path;
23 |
24 | auto make_log_file_path(const std::filesystem::path& directory,
25 | std::string_view file_prefix,
26 | std::string_view file_name) -> std::filesystem::path;
27 |
28 | auto make_level(std::string_view level) -> spdlog::level::level_enum;
29 |
30 | } // namespace simulator::log::util
31 |
32 | #endif // SIMULATOR_LOG_IH_UTIL_HPP_
33 |
--------------------------------------------------------------------------------
/project/log/src/custom_spd_flags.cpp:
--------------------------------------------------------------------------------
1 | #include "ih/custom_spd_flags.hpp"
2 |
3 | #include
4 |
5 | namespace simulator::log {
6 |
7 | auto EscapedPayloadFlag::format(const spdlog::details::log_msg& msg,
8 | const std::tm& tm_time,
9 | spdlog::memory_buf_t& dest) -> void {
10 | // Debug fmt format. The string is quoted and special characters escaped:
11 | // a message with "quotation marks" -> "a message with \"quotation marks\""
12 | const auto quoted_escaped_payload = fmt::format("{:?}", msg.payload);
13 | // Append without quotation marks at the beginning and end of the string that
14 | // fmt adds.
15 | dest.append(
16 | quoted_escaped_payload.data() + 1,
17 | quoted_escaped_payload.data() + quoted_escaped_payload.size() - 1);
18 | }
19 |
20 | auto EscapedPayloadFlag::clone() const
21 | -> std::unique_ptr {
22 | return spdlog::details::make_unique