Merge branch 'spartan_tas' of bitbucket.org:bluetradesys/spark into spartan_tas

This commit is contained in:
Taha Afzal committed 2021-02-03 14:46:35 -05:00
commit c10bf44bfc
28 files changed
+240356 -249

No files matched your search

+1 -1
View File
@@ -1 +1 @@
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/AlgoTypes.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spartan.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/sample_fix.cpp;jetfix/tests/store_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/Product.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/service/MarketDataServiceServer.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;mercury/actors/IPollableActor.cpp;mercury/broker/Broker.cpp;mercury/broker/BrokerProxy.cpp;mercury/broker/ILocalBroker.cpp;mercury/broker/IRemoteBroker.cpp;mercury/common/mercury_common.cpp;mercury/events/TimerEvent.cpp;mercury/executor/ExecutoLine truncated
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/AlgoTypes.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spartan.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/sample_fix.cpp;jetfix/tests/store_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/Product.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/service/MarketDataServiceServer.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;mercury/actors/IPollableActor.cpp;mercury/broker/Broker.cpp;mercury/broker/BrokerProxy.cpp;mercury/broker/ILocalBroker.cpp;mercury/broker/IRemoteBroker.cpp;mercury/common/mercury_common.cpp;mercury/events/TimerEvent.cpp;mercury/executor/ExecutoLine truncated
+1 -1
View File
@@ -1 +1 @@
set(sources algo/AlgoDefinitionServiceServer.cpp;cmds/AdminReport.cpp;cmds/AutoCert.cpp;cmds/Benchmark.cpp;cmds/CMECert.cpp;cmds/ConfigCheck.cpp;cmds/FIXSim.cpp;cmds/KeyCode.cpp;cmds/Md.cpp;cmds/ParseHistoricalFIX.cpp;cmds/PrintHedgeOrders.cpp;cmds/QuickTest.cpp;cmds/Run.cpp;cmds/Span.cpp;cmds/Spartan.cpp;cmds/Web.cpp;cmds/spartan/algoman/IAlgo.cpp;cmds/spartan/algoman/IAlgoExecutionServices.cpp;cmds/spartan/algoman/IAlgoSetupServices.cpp;cmds/spartan/algoman/algos/tas/RunTAS.cpp;cmds/spartan/algoman/algos/tas/TASOrderReactor.cpp;cmds/spartan/algoman/algos/tas/TASTriggerDef.cpp;cmds/spartan/back_testing/algos/PolyObserver.cpp;cmds/spartan/back_testing/algos/SniperModel.cpp;cmds/spartan/back_testing/algos/spreader/SimOrderGateway.cpp;cmds/spartan/back_testing/algos/spreader/SimSpreader.cpp;cmds/spartan/back_testing/algos/spreader/tests/sim_spreader_tests.cpp;cmds/spartan/back_testing/db/SimDB.cpp;cmds/spartan/back_testing/matcher/FifoImpliedSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/FifoMatcherContext.cpp;cmds/spartan/back_testing/matcher/FifoMergedSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/FifoPriceLevelMatcher.cpp;cmds/spartan/back_testing/matcher/FifoSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/Matcher.cpp;cmds/spartan/back_testing/matcher/MatchingCommon.cpp;cmds/spartan/back_testing/matcher/fill_depot.cpp;cmds/spartan/back_testing/matcher/iceberg_helper.cpp;cmds/spartan/back_testing/matcher/tests/matcher_tests.cpp;cmds/spartan/back_testing/matcher/validation/iceberg_file_cache.cpp;cmds/spartan/back_testing/matcher/validation/matcher_validation_observer.cpp;cmds/spartan/back_testing/run/SimSessionOptions.proto;cmds/spartan/back_testing/run/run_sim.cpp;cmds/spartan/back_testing/sim/ISim.cpp;cmds/spartan/back_testing/sim/Sim.cpp;cmds/spartan/back_testing/sim/pandl/PandL.cpp;cmds/spartan/back_testing/sim/pcap/PCapEventGenerator.cpp;cmds/spartan/back_testing/sim/pcap/PCapEventSource.cpp;cmds/spartan/back_testing/sim/pcap/PCapOrderChangeBootstrapper.cpp;cmds/spartan/back_testing/sim/spark_bridge/AlgoServicesBridge.cpp;cmds/spartan/back_testing/sim/spark_bridge/BeforeLaunchBridge.cpp;cmds/spartan/cmds/BookStats.cpp;cmds/spartan/cmds/CSV.cpp;cmds/spartan/cmds/Compress.cpp;cmds/spartan/cmds/FindPolys.cpp;cmds/spartan/cmds/Icebergs.cpp;cmds/spartan/cmds/Json.cpp;cmds/spartan/cmds/ListSec.cpp;cmds/spartan/cmds/PolygonBooks.cpp;cmds/spartan/cmds/SQL.cpp;cmds/spartan/cmds/Sim.cpp;cmds/spartan/cmds/SimBooks.cpp;cmds/spartan/cmds/Stats.cpp;cmds/spartan/cmds/Test.cpp;cmds/spartan/cmds/ValidateFifo.cpp;cmds/spartan/cmds/ValuePolys.cpp;cmds/spartan/common/EndPoint.cpp;cmds/spartan/common/TimeInterval.cpp;cmds/spartan/common/TimeStamp.cpp;cmds/spartan/domain/IcebergQuantity.cpp;cmds/spartan/domain/OrderKey.cpp;cmds/spartan/domain/Price.cpp;cmds/spartan/domain/Quantity.cpp;cmds/spartan/domain/SecurityCriteria.cpp;cmds/spartan/domain/SecurityDefinition.cpp;cmds/spartan/domain/SecurityID.cpp;cmds/spartan/domain/SecuritySnapshot.cpp;cmds/spartan/domain/TradeSummarySignal.cpp;cmds/spartan/domain/book/BookLevel.cpp;cmds/spartan/execution/Cancel.cpp;cmds/spartan/execution/CancelReplace.cpp;cmds/spartan/execution/GatewayError.cpp;cmds/spartan/execution/NewOrder.cpp;cmds/spartan/execution/OrderUpdate.cpp;cmds/spartan/execution/il3/IL3Gateway.cpp;cmds/spartan/execution/il3/common/IL3MsgFramer.cpp;cmds/spartan/execution/il3/handlers/init/InitHandler.cpp;cmds/spartan/execution/il3/handlers/party_details/SetPartyDetailsHandler.cpp;cmds/spartan/execution/il3/handlers/realtime/RealTimeHandler.cpp;cmds/spartan/execution/il3/parsing/IL3Parser.cpp;cmds/spartan/execution/il3/store/IL3SessionFileStore.cpp;cmds/spartan/execution/il3/tests/order_execution_tests.cpp;cmds/spartan/market_data/common/MDP3Event.cpp;cmds/spartan/market_data/common/mdp3_common.cpp;cmds/spartan/market_data/common/tests/book_merging_tests.cpp;cmds/spartan/market_data/feed_control/IFeedController.cpp;cmds/spartan/market_data/feed_observers/BookStatRecorder.cpp;cmds/spartan/market_data/feed_observers/DefinitionCollector.cpp;cmds/spartan/market_data/feed_observers/FillCounter.cpp;cmds/spartan/market_data/feed_observers/IcebergFinder.cpp;cmds/spartan/market_data/feed_observers/PolygonFinder.cpp;cmds/spartan/market_data/feed_observers/PolygonOpportunityFinder.cpp;cmds/spartan/market_data/feed_observers/SyntheticBookRecorder.cpp;cmds/spartan/market_data/feed_observers/recorders/MatcherBookRecorder.cpp;cmds/spartan/market_data/handler/MDP3FeedHandler.cpp;cmds/spartan/market_data/handler/ReactorMDP3FeedHandler.cpp;cmds/spartan/market_data/implied/implied_market.cpp;cmds/spartan/market_data/parsing/MDP3MsgBox.cpp;cmds/spartan/market_data/parsing/MDP3Parser.cpp;cmds/spartan/market_data/realtime/RealTimeHandler.cpp;cmds/spartan/market_data/recovery/BookSnapshot.cpp;cmds/spartan/market_data/recovery/DefinitionSnapshot.cpp;cmds/spartan/market_data/recovery/IncrementalQueue.cpp;cmds/spartan/market_data/recovery/RecoveryHandler.cpp;cmds/spartan/market_dLine truncated
set(sources algo/AlgoDefinitionServiceServer.cpp;cmds/AdminReport.cpp;cmds/AutoCert.cpp;cmds/Benchmark.cpp;cmds/CMECert.cpp;cmds/ConfigCheck.cpp;cmds/FIXSim.cpp;cmds/KeyCode.cpp;cmds/Md.cpp;cmds/ParseHistoricalFIX.cpp;cmds/PrintHedgeOrders.cpp;cmds/QuickTest.cpp;cmds/Run.cpp;cmds/Span.cpp;cmds/Spartan.cpp;cmds/Web.cpp;cmds/md/cmds/Channels.cpp;cmds/md/cmds/Cleanup.cpp;cmds/md/cmds/Dump.cpp;cmds/md/cmds/DumpSecurity.cpp;cmds/md/cmds/RecTool.cpp;cmds/md/cmds/Record.cpp;cmds/md/cmds/Relay.cpp;cmds/md/cmds/Replay.cpp;cmds/md/cmds/Run.cpp;cmds/md/cmds/Tail.cpp;cmds/md/cmds/rec_tool/cmds/Print.cpp;cmds/md/cmds/rec_tool/cmds/Trace.cpp;cmds/md/cmds/rec_tool/cmds/Unprint.cpp;cmds/md/common/PlatformOption.cpp;cmds/md/common/SecurityTypeOption.cpp;cmds/md/common/VenueOption.cpp;cmds/spartan/algoman/IAlgo.cpp;cmds/spartan/algoman/IAlgoExecutionServices.cpp;cmds/spartan/algoman/IAlgoSetupServices.cpp;cmds/spartan/algoman/algos/tas/RunTAS.cpp;cmds/spartan/algoman/algos/tas/TASOrderReactor.cpp;cmds/spartan/algoman/algos/tas/TASTriggerDef.cpp;cmds/spartan/back_testing/algos/PolyObserver.cpp;cmds/spartan/back_testing/algos/SniperModel.cpp;cmds/spartan/back_testing/algos/TestObserver.cpp;cmds/spartan/back_testing/algos/spreader/SimOrderGateway.cpp;cmds/spartan/back_testing/algos/spreader/SimSpreader.cpp;cmds/spartan/back_testing/algos/spreader/tests/sim_spreader_tests.cpp;cmds/spartan/back_testing/common/Trace.cpp;cmds/spartan/back_testing/db/SimDB.cpp;cmds/spartan/back_testing/matcher/FifoImpliedSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/FifoMatcherContext.cpp;cmds/spartan/back_testing/matcher/FifoMergedSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/FifoPriceLevelMatcher.cpp;cmds/spartan/back_testing/matcher/FifoSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/FillDepot.cpp;cmds/spartan/back_testing/matcher/Matcher.cpp;cmds/spartan/back_testing/matcher/MatchingCommon.cpp;cmds/spartan/back_testing/matcher/common/IcebergFileCache.cpp;cmds/spartan/back_testing/matcher/common/MatcherOneof.cpp;cmds/spartan/back_testing/matcher/common/MatcherOrder.cpp;cmds/spartan/back_testing/matcher/common/MatchingSession.cpp;cmds/spartan/back_testing/matcher/iceberg_helper.cpp;cmds/spartan/back_testing/matcher/tests/matcher_tests.cpp;cmds/spartan/back_testing/matcher/validation/matcher_validation_observer.cpp;cmds/spartan/back_testing/run/SimSessionOptions.proto;cmds/spartan/back_testing/run/run_sim.cpp;cmds/spartan/back_testing/sim/ISim.cpp;cmds/spartan/back_testing/sim/Sim.cpp;cmds/spartan/back_testing/sim/pandl/PandL.cpp;cmds/spartan/back_testing/sim/pcap/PCapEventGenerator.cpp;cmds/spartan/back_testing/sim/pcap/PCapEventSource.cpp;cmds/spartan/back_testing/sim/pcap/PCapOrderChangeBootstrapper.cpp;cmds/spartan/back_testing/sim/spark_bridge/AlgoServicesBridge.cpp;cmds/spartan/back_testing/sim/spark_bridge/BeforeLaunchBridge.cpp;cmds/spartan/cmds/BookStats.cpp;cmds/spartan/cmds/CSV.cpp;cmds/spartan/cmds/Compress.cpp;cmds/spartan/cmds/FindPolys.cpp;cmds/spartan/cmds/Icebergs.cpp;cmds/spartan/cmds/Json.cpp;cmds/spartan/cmds/ListSec.cpp;cmds/spartan/cmds/MatcherCmd.cpp;cmds/spartan/cmds/PolygonBooks.cpp;cmds/spartan/cmds/SQL.cpp;cmds/spartan/cmds/Sim.cpp;cmds/spartan/cmds/Stats.cpp;cmds/spartan/cmds/Test.cpp;cmds/spartan/cmds/ValidateFifo.cpp;cmds/spartan/cmds/ValuePolys.cpp;cmds/spartan/cmds/matcher/cmds/BooksCmd.cpp;cmds/spartan/cmds/matcher/cmds/FillsCmd.cpp;cmds/spartan/cmds/matcher/cmds/ProcTimeCmd.cpp;cmds/spartan/cmds/matcher/common/InitData.cpp;cmds/spartan/common/EndPoint.cpp;cmds/spartan/common/Stopwatch.cpp;cmds/spartan/common/TimeInterval.cpp;cmds/spartan/common/TimeStamp.cpp;cmds/spartan/common/cli/RangeArg.cpp;cmds/spartan/domain/IcebergQuantity.cpp;cmds/spartan/domain/Price.cpp;cmds/spartan/domain/Quantity.cpp;cmds/spartan/domain/SecurityCriteria.cpp;cmds/spartan/domain/SecurityDefinition.cpp;cmds/spartan/domain/SecurityID.cpp;cmds/spartan/domain/SecuritySnapshot.cpp;cmds/spartan/domain/SideQuantity.cpp;cmds/spartan/domain/TradeSummarySignal.cpp;cmds/spartan/domain/book/BookLevel.cpp;cmds/spartan/domain/order/OrderChange.cpp;cmds/spartan/domain/order/OrderKey.cpp;cmds/spartan/execution/Cancel.cpp;cmds/spartan/execution/CancelReplace.cpp;cmds/spartan/execution/GatewayError.cpp;cmds/spartan/execution/NewOrder.cpp;cmds/spartan/execution/OrderUpdate.cpp;cmds/spartan/execution/il3/IL3Gateway.cpp;cmds/spartan/execution/il3/common/IL3MsgFramer.cpp;cmds/spartan/execution/il3/handlers/init/IL3InitHandler.cpp;cmds/spartan/execution/il3/handlers/party_details/IL3PartyDetailsHandler.cpp;cmds/spartan/execution/il3/handlers/realtime/IL3RealTimeHandler.cpp;cmds/spartan/execution/il3/parsing/IL3Parser.cpp;cmds/spartan/execution/il3/store/IL3SessionFileStore.cpp;cmds/spartan/execution/il3/tests/order_execution_tests.cpp;cmds/spartan/market_data/common/EventRangeMonitor.cpp;cmds/spartan/market_data/common/IcebergQuantityModification.cpp;cmds/spartan/market_data/common/MDP3Event.cpp;cmds/spartan/market_data/common/OrderModifiLine truncated
@@ -19,6 +19,13 @@ CME Globex will automatically terminate and close both the primary and backup po
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Session+Layer][Session Layer]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Binary+Order+Entry+-+Business+Layer][Business Layer]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+FIX+Tag+Library][Tag Library]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+New+Order+-+Single][NewOrderSingle]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Order+Cancel+Replace+Request][CancelReplace]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Order+Cancel+Request][Cancel]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Execution+Report+-+Trade+Outright][ExecutionReport (Outright)]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Execution+Report+-+Trade+Spread][ExecutionReport (Spread)]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Execution+Report+-+Reject][Execution Report Reject]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Execution+Report+-+Elimination][Execution Report Elimination]]
** [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+-+Simple+Binary+Encoding][Encoding]]
*** Structure
- [[file:cme_notes.org_20210112_124836_Hgt1aF.png][Diagram]]
@@ -46,20 +53,13 @@ CME Globex will automatically terminate and close both the primary and backup po
- configuration:
- get /MSGW/[NRCert|Cert|Production]/Configuration/MSGW_Config.xml
** [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Binary+Order+Entry+-+Session+Layer][Session Protocol]]
** Preregistration of party details
** [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Binary+Order+Entry+-+Business+Layer#iLink3BinaryOrderEntryBusinessLayer-PartyDetails][Party Details]]
- CME allows the registration of bundles of order properties so that orders can simply refer to a registration id rather than include every property on every order.
- This is achieved through a separate iLink3 server, the [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Binary+Order+Entry+-+Business+Layer#iLink3BinaryOrderEntryBusinessLayer-OrderEntryServiceGateway][Order Entry Service Gateway]]
- This gateway uses the same iLink3s session, meaning the same UUID and seq numbers as the main gateway
** [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+Reject+Codes][Error codes]]
** [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+Order+Cancel-Replace+and+In-Flight+Mitigation][In-Flight mitigation]]
** Messages
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+New+Order+-+Single][NewOrderSingle]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Order+Cancel+Replace+Request][CancelReplace]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Order+Cancel+Request][Cancel]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Execution+Report+-+Trade+Outright][ExecutionReport (Outright)]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Execution+Report+-+Trade+Spread][ExecutionReport (Spread)]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Execution+Report+-+Reject][Execution Report Reject]]
- [[https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+3+Execution+Report+-+Elimination][Execution Report Elimination]]
** [[file:ilink3_log.json][Log example]]
* SBE
** Generators
- Source be found on [[https://github.com/real-logic/simple-binary-encoding][RealLogic's GitHub]]
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,16 +1,17 @@
#include "IL3Gateway.h"
#include "execution/GatewayError.h"
#include "execution/IGatewayObserver.h"
#include "execution/OrderHandle.h"
#include "execution/il3/common/IL3GatewayCfg.h"
#include "execution/il3/common/IL3MsgFramer.h"
#include "execution/il3/handlers/init/IL3InitHandler.h"
#include "execution/il3/handlers/init/IL3InitRec.h"
#include "execution/il3/handlers/realtime/IL3RealTimeHandler.h"
#include "execution/il3/parsing/IL3Parser.h"
#include "execution/il3/store/IIL3SessionStore.h"
#include "lib/utils/bts_assert.h"
#include "server/sparkd/cmds/spartan/execution/GatewayError.h"
#include "server/sparkd/cmds/spartan/execution/OrderHandle.h"
#include "server/sparkd/cmds/spartan/execution/il3/common/IL3GatewayCfg.h"
#include "server/sparkd/cmds/spartan/execution/il3/common/IL3MsgFramer.h"
#include "server/sparkd/cmds/spartan/execution/il3/handlers/init/InitHandler.h"
#include "server/sparkd/cmds/spartan/execution/il3/handlers/init/SuccessfullInitRec.h"
#include "server/sparkd/cmds/spartan/execution/il3/handlers/realtime/RealTimeHandler.h"
#include "server/sparkd/cmds/spartan/execution/il3/parsing/IL3Parser.h"
#include "server/sparkd/cmds/spartan/execution/il3/store/IIL3SessionStore.h"
#include "server/sparkd/cmds/spartan/system/Clock.h"
#include "server/sparkd/cmds/spartan/system/reactor/IConnection.h"
#include "system/Clock.h"
#include "system/reactor/IConnection.h"
#include <variant>
@@ -21,7 +22,7 @@ enum class IL3Gateway::State { CONNECTING, INITIALIZING, READY, ERROR };
struct IL3Gateway::PImpl {
IL3MsgFramer framer;
std::variant<InitHandler, RealTimeHandler> handler;
std::variant<IL3InitHandler, IL3RealTimeHandler> handler;
IGatewayObserver &observer;
IIL3SessionStore &store;
IConnection &connection;
@@ -49,8 +50,9 @@ void IL3Gateway::start(
void IL3Gateway::on_connect() {
bts_assert(me->state == State::CONNECTING);
transition(State::INITIALIZING);
me->handler.emplace<InitHandler>();
std::get<InitHandler>(me->handler).start(me->cfg, *this, *this, me->clock);
me->handler.emplace<IL3InitHandler>();
std::get<IL3InitHandler>(me->handler)
.start(me->cfg, *this, *this, me->clock);
}
void IL3Gateway::on_disconnect() {
@@ -93,15 +95,15 @@ void IL3Gateway::on_data(std::string_view buffer) {
}
OrderHandle IL3Gateway::queue(NewOrder const &) { return {}; }
void IL3Gateway::queue(OrderHandle,CancelReplace const &) {}
void IL3Gateway::queue(OrderHandle,Cancel const &) {}
void IL3Gateway::queue(OrderHandle, CancelReplace const &) {}
void IL3Gateway::queue(OrderHandle, Cancel const &) {}
void IL3Gateway::send() { IL3MsgSender::flush(); }
void IL3Gateway::on_init_success(SuccessfullInitRec const &rec) {
void IL3Gateway::on_init_success(IL3InitRec const &rec) {
bts_assert(me->state == State::INITIALIZING);
transition(State::READY);
auto rec_cpy = rec;
me->handler.emplace<RealTimeHandler>();
me->handler.emplace<IL3RealTimeHandler>();
// std::get<RealTimeHandler>(me->handler).start(rec_cpy);
}
@@ -162,4 +164,21 @@ void IL3Gateway::transition(State new_state) {
me->state = new_state;
}
void IL3Gateway::on_realtime_error(GatewayError const &e) {
bts_assert_d(me->state == State::READY);
if (e.error_code() == GatewayError::ATTEMPT_TO_CANCEL_UNKNOWN_ORDER ||
e.error_code() == GatewayError::ATTEMPT_TO_CANCEL_REPLACE_UNKNOWN_ORDER)
// These can happen during the normal course of business if an
// order is already canceled or filled at the exchange but the
// gateway has not been notified yet.
return;
else
on_error(e);
}
void IL3Gateway::on_order_update(OrderUpdate const &update) {
bts_assert_d(me->state == State::READY);
me->observer.on_order_update(update);
}
} // namespace bts::spartan::il3
@@ -2,11 +2,12 @@
#include <memory>
#include "server/sparkd/cmds/spartan/execution/IGateway.h"
#include "server/sparkd/cmds/spartan/execution/OrderHandle.h"
#include "server/sparkd/cmds/spartan/execution/il3/common/IL3MsgSender.h"
#include "server/sparkd/cmds/spartan/execution/il3/handlers/init/IInitObserver.h"
#include "server/sparkd/cmds/spartan/system/reactor/IConnectionObserver.h"
#include "execution/IGateway.h"
#include "execution/OrderHandle.h"
#include "execution/il3/common/IL3MsgSender.h"
#include "execution/il3/handlers/init/IIL3InitObserver.h"
#include "execution/il3/handlers/realtime/IIL3RealTimeObserver.h"
#include "system/reactor/IConnectionObserver.h"
namespace bts::spartan {
class ExecutionReport;
@@ -23,22 +24,22 @@ struct IL3GatewayCfg;
// Mediates access to a single iLink3 Gateway. This class assumes that
// the passed connection is not currently established. It also assumes
// that any pre-registration of party details has already occured.
// that pre-registration of party details has already occured
class IL3Gateway : public IGateway, // Order gateway abstraction
public IConnectionObserver, // Incoming iLink3 messages
IL3MsgSender, // Outgoing iLink3 messages
IInitObserver { // iLink3 link setup events
public IConnectionObserver, // Incoming byte stream observer
IL3MsgSender, // Outgoing iLink3 messages sender
IIL3InitObserver, // iLink3 setup events
IIL3RealTimeObserver // iLink3 real time
{
public:
IL3Gateway();
~IL3Gateway();
// IConnection is assumed to be disconnected
void start(
IL3GatewayCfg const &,
IIL3SessionStore &,
IGatewayObserver &,
IConnection &,
IConnection &, // IConnection is assumed to be disconnected
Clock &);
// IConnectionObserver
@@ -48,15 +49,19 @@ class IL3Gateway : public IGateway, // Order gateway abstraction
// IGateway
OrderHandle queue(NewOrder const &) override;
void queue(OrderHandle,CancelReplace const &) override;
void queue(OrderHandle,Cancel const &) override;
void queue(OrderHandle, CancelReplace const &) override;
void queue(OrderHandle, Cancel const &) override;
void send() override;
private:
// IL3InitObserver
void on_init_success(SuccessfullInitRec const &) override;
// IIL3InitObserver
void on_init_success(IL3InitRec const &) override;
void on_init_failure(GatewayError const &) override;
// IIL3RealTimeObserver
void on_realtime_error(GatewayError const &) override;
void on_order_update(OrderUpdate const &) override;
// IL3MsgSender
void on_flush(std::string_view bytes) override;
@@ -1,11 +1,12 @@
#pragma once
#include <cinttypes>
#include "execution/il3/common/IL3UUID.h"
namespace bts::spartan::il3 {
struct IL3GatewayCfg {
const uint64_t uuid;
const IL3UUID uuid;
const size_t smp_id_2362;
const std::string session_39006;
const std::string firm_39007;
@@ -0,0 +1,10 @@
#pragma once
#include "lib/utils/ValueWrapper.h"
#include <cstdint>
namespace bts::spartan::il3 {
using IL3UUID = utils::ValueWrapper<struct IL3UUIDTag, uint64_t>;
}
@@ -8,11 +8,11 @@ class GatewayError;
namespace bts::spartan::il3 {
struct SuccessfullInitRec;
struct IL3InitRec;
class IInitObserver{
class IIL3InitObserver{
public:
virtual void on_init_success(SuccessfullInitRec const&) = 0;
virtual void on_init_success(IL3InitRec const&) = 0;
virtual void on_init_failure(GatewayError const &) = 0;
};
@@ -1,7 +1,7 @@
#include "InitHandler.h"
#include "IL3InitHandler.h"
#include "IInitObserver.h"
#include "SuccessfullInitRec.h"
#include "IIL3InitObserver.h"
#include "IL3InitRec.h"
#include "lib/logging/logging.h"
#include "lib/utils/SecureLogon.h"
#include "lib/utils/bts_assert.h"
@@ -43,37 +43,37 @@
namespace bts::spartan::il3 {
enum class InitHandler::State {
enum class IL3InitHandler::State {
NEGOTIATING,
ESTABLISHING,
RETRANSMITTING,
DONE
};
struct InitHandler::RetransmitReq {
struct IL3InitHandler::RetransmitReq {
static constexpr uint32_t MAX_RECOVERY = 2500;
uint64_t uuid;
uint32_t from;
uint32_t to;
};
struct InitHandler::PImpl {
struct IL3InitHandler::PImpl {
IL3GatewayCfg const cfg;
State state;
IL3MsgSender &sender;
IInitObserver &observer;
IIL3InitObserver &observer;
Clock &clock;
std::queue<RetransmitReq> pending_retransmit = {};
SuccessfullInitRec init_rec = {};
IL3InitRec init_rec = {};
};
InitHandler::InitHandler() : me() {}
InitHandler::~InitHandler() {}
IL3InitHandler::IL3InitHandler() : me() {}
IL3InitHandler::~IL3InitHandler() {}
void InitHandler::start(
void IL3InitHandler::start(
IL3GatewayCfg const &cfg,
IL3MsgSender &sender,
IInitObserver &obs,
IIL3InitObserver &obs,
Clock &clock) {
LOG(Spartan, Warn, "Starting gateway {}", cfg.segment);
@@ -91,7 +91,7 @@ void InitHandler::start(
}
// Negotiate ------------------------------------------------------------
void InitHandler::send_negotiate() {
void IL3InitHandler::send_negotiate() {
bts_assert(me->state == State::NEGOTIATING);
LOG(Spartan, Warn, "Negotiating UUID {} on gateway {}", me->cfg.uuid,
@@ -99,7 +99,7 @@ void InitHandler::send_negotiate() {
auto msg = me->sender.enqueue<::il3::Negotiate500>(
::il3::Negotiate500::credentialsHeaderLength());
msg.uUID(me->cfg.uuid);
msg.uUID(me->cfg.uuid.value());
msg.requestTimestamp(me->clock.now().value());
msg.putSession(me->cfg.session_39006);
msg.putCredentials("", 0);
@@ -114,7 +114,7 @@ void InitHandler::send_negotiate() {
// Expect -> NegotiationResponse501 or NegotiationReject502
}
void InitHandler::operator()(::il3::NegotiationResponse501) {
void IL3InitHandler::operator()(::il3::NegotiationResponse501) {
bts_assert(me->state == State::NEGOTIATING);
LOG(Spartan, Warn, "Successfull negotiation on UUID {} on gateway {}",
me->cfg.uuid, me->cfg.segment);
@@ -123,14 +123,14 @@ void InitHandler::operator()(::il3::NegotiationResponse501) {
}
// Establish ------------------------------------------------------------
void InitHandler::send_establish() {
void IL3InitHandler::send_establish() {
bts_assert(me->state == State::ESTABLISHING);
LOG(Spartan, Warn, "Establishing UUID {} on gateway {}. From: {} To: {}",
me->cfg.uuid, me->cfg.segment, me->cfg.from_cme, me->cfg.to_cme);
auto msg = me->sender.enqueue<::il3::Establish503>(2);
msg.uUID(me->cfg.uuid);
msg.uUID(me->cfg.uuid.value());
msg.requestTimestamp(me->clock.now().value());
msg.putSession(me->cfg.session_39006);
msg.putCredentials("", 0);
@@ -155,14 +155,14 @@ void InitHandler::send_establish() {
// expect -> EstablishmentAck504 or EstablishmentReject505
}
void InitHandler::operator()(::il3::EstablishmentAck504 msg) {
void IL3InitHandler::operator()(::il3::EstablishmentAck504 msg) {
bts_assert(me->state == State::ESTABLISHING);
LOG(Spartan, Warn, "Successfull establishment on UUID {} on gateway {}",
me->cfg.uuid, me->cfg.segment);
auto cme_prev_uuid = msg.previousUUID();
auto cme_prev_seq = msg.previousSeqNo();
if (cme_prev_seq != 0 && cme_prev_uuid != me->cfg.uuid) {
if (cme_prev_seq != 0 && cme_prev_uuid != me->cfg.uuid.value()) {
// There was a previous session and we need to replay messages from it
@@ -190,7 +190,8 @@ void InitHandler::operator()(::il3::EstablishmentAck504 msg) {
"Requesting replay from "
"{} to {}",
me->cfg.uuid, me->cfg.segment, me->cfg.from_cme + 1, cme_current_seq);
enqueue_retransmit(me->cfg.from_cme + 1, cme_current_seq, me->cfg.uuid);
enqueue_retransmit(
me->cfg.from_cme + 1, cme_current_seq, me->cfg.uuid.value());
}
me->init_rec.from_cme = cme_current_seq;
@@ -207,11 +208,11 @@ void InitHandler::operator()(::il3::EstablishmentAck504 msg) {
// Retransmission management
// ---------------------------------------------------------
void InitHandler::operator()(::il3::Retransmission509) {
void IL3InitHandler::operator()(::il3::Retransmission509) {
bts_assert(me->state == State::RETRANSMITTING);
}
void InitHandler::enqueue_retransmit(
void IL3InitHandler::enqueue_retransmit(
uint32_t from, uint32_t to, uint64_t uuid) {
LOG(Spartan, Warn, "Prepare retransmit from: {} to: {}", from, to);
bts_assert(to >= from);
@@ -223,7 +224,7 @@ void InitHandler::enqueue_retransmit(
} while (from < to);
}
void InitHandler::begin_retransmit() {
void IL3InitHandler::begin_retransmit() {
bts_assert(me->state == State::RETRANSMITTING);
bts_assert(has_pending_retransmit());
@@ -239,13 +240,13 @@ void InitHandler::begin_retransmit() {
send_retransmit_request(working.uuid, working.from, count);
}
void InitHandler::send_retransmit_request(
void IL3InitHandler::send_retransmit_request(
uint64_t uuid, uint32_t from, size_t count) {
bts_assert(me->state == State::RETRANSMITTING);
bts_assert(from > 0);
auto msg = me->sender.enqueue<::il3::RetransmitRequest508>();
msg.uUID(me->cfg.uuid);
msg.uUID(me->cfg.uuid.value());
msg.lastUUID(uuid);
msg.requestTimestamp(me->clock.now().value());
msg.fromSeqNo(from);
@@ -253,36 +254,42 @@ void InitHandler::send_retransmit_request(
me->sender.flush();
}
bool InitHandler::has_pending_retransmit() const {
bool IL3InitHandler::has_pending_retransmit() const {
return me->pending_retransmit.size();
}
using namespace ::il3;
void InitHandler::operator()(BusinessReject521 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportNew522 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportReject523 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportElimination524 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportTradeOutright525 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportTradeSpread526 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportTradeSpreadLeg527 m) {
void IL3InitHandler::operator()(BusinessReject521 m) { on_msg({m}); }
void IL3InitHandler::operator()(ExecutionReportNew522 m) { on_msg({m}); }
void IL3InitHandler::operator()(ExecutionReportReject523 m) { on_msg({m}); }
void IL3InitHandler::operator()(ExecutionReportElimination524 m) {
on_msg({m});
}
void InitHandler::operator()(ExecutionReportModify531 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportStatus532 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportCancel534 m) { on_msg({m}); }
void InitHandler::operator()(OrderCancelReject535 m) { on_msg({m}); }
void InitHandler::operator()(OrderCancelReplaceReject536 m) { on_msg({m}); }
void InitHandler::operator()(ExecutionReportTradeAddendumOutright548 m) {
void IL3InitHandler::operator()(ExecutionReportTradeOutright525 m) {
on_msg({m});
}
void InitHandler::operator()(ExecutionReportTradeAddendumSpread549 m) {
void IL3InitHandler::operator()(ExecutionReportTradeSpread526 m) {
on_msg({m});
}
void InitHandler::operator()(ExecutionReportTradeAddendumSpreadLeg550 m) {
void IL3InitHandler::operator()(ExecutionReportTradeSpreadLeg527 m) {
on_msg({m});
}
void IL3InitHandler::operator()(ExecutionReportModify531 m) { on_msg({m}); }
void IL3InitHandler::operator()(ExecutionReportStatus532 m) { on_msg({m}); }
void IL3InitHandler::operator()(ExecutionReportCancel534 m) { on_msg({m}); }
void IL3InitHandler::operator()(OrderCancelReject535 m) { on_msg({m}); }
void IL3InitHandler::operator()(OrderCancelReplaceReject536 m) { on_msg({m}); }
void IL3InitHandler::operator()(ExecutionReportTradeAddendumOutright548 m) {
on_msg({m});
}
void IL3InitHandler::operator()(ExecutionReportTradeAddendumSpread549 m) {
on_msg({m});
}
void IL3InitHandler::operator()(ExecutionReportTradeAddendumSpreadLeg550 m) {
on_msg({m});
}
void InitHandler::on_msg(IL3MsgBox const &msg) {
void IL3InitHandler::on_msg(IL3MsgBox const &msg) {
LOG(Spartan, Info,
"Received business message on segment {}, UUID: {} seq_num: {}"
" Retransmit: {}",
@@ -318,7 +325,7 @@ void InitHandler::on_msg(IL3MsgBox const &msg) {
}
}
void InitHandler::on_replay_complete() {
void IL3InitHandler::on_replay_complete() {
bts_assert(
me->state == State::ESTABLISHING || me->state == State::RETRANSMITTING);
transition(State::DONE);
@@ -328,50 +335,50 @@ void InitHandler::on_replay_complete() {
me->observer.on_init_success(me->init_rec);
}
void InitHandler::send_sequence() {
void IL3InitHandler::send_sequence() {
bts_assert(
me->state == State::ESTABLISHING || me->state == State::RETRANSMITTING);
auto msg = me->sender.enqueue<::il3::Sequence506>();
msg.uUID(me->cfg.uuid);
msg.uUID(me->cfg.uuid.value());
msg.nextSeqNo(me->init_rec.to_cme);
msg.faultToleranceIndicator(::il3::FTI::NULL_VALUE);
msg.keepAliveIntervalLapsed(::il3::KeepAliveLapsed::NotLapsed);
me->sender.flush();
}
void InitHandler::operator()(::il3::Sequence506 msg) {
void IL3InitHandler::operator()(::il3::Sequence506 msg) {
me->init_rec.from_cme = msg.nextSeqNo() - 1;
send_sequence();
}
uint32_t InitHandler::inc_sec_num() { return me->init_rec.to_cme++; }
uint32_t IL3InitHandler::inc_sec_num() { return me->init_rec.to_cme++; }
// Error Handling -----------------------------------------------------------
void InitHandler::operator()(::il3::Terminate507 msg) {
void IL3InitHandler::operator()(::il3::Terminate507 msg) {
auto error = GatewayError::il3_unexpected_terminate(
std::string{msg.reason()}, msg.errorCodes());
on_error(error);
}
void InitHandler::operator()(::il3::NegotiationReject502 msg) {
void IL3InitHandler::operator()(::il3::NegotiationReject502 msg) {
bts_assert(me->state == State::NEGOTIATING);
LOG(Spartan, Warn, "Negotiation rejection for UUID {} on gateway {}",
me->cfg.uuid, me->cfg.segment);
on_error(GatewayError::il3_negotiation_reject(msg.errorCodes()));
}
void InitHandler::operator()(::il3::EstablishmentReject505 msg) {
void IL3InitHandler::operator()(::il3::EstablishmentReject505 msg) {
bts_assert(me->state == State::ESTABLISHING);
on_error(GatewayError::il3_establish_reject(msg.errorCodes()));
}
void InitHandler::operator()(::il3::RetransmitReject510 msg) {
void IL3InitHandler::operator()(::il3::RetransmitReject510 msg) {
bts_assert(me->state == State::RETRANSMITTING);
on_error(
GatewayError{GatewayError::RETRANSMIT_FAILURE, msg.getReasonAsString()});
}
void InitHandler::on_error(GatewayError const &e) {
void IL3InitHandler::on_error(GatewayError const &e) {
LOG(Spartan, Error, "Error connecting to gateway {}: {}", me->cfg.segment,
e);
transition(State::DONE);
@@ -379,7 +386,7 @@ void InitHandler::on_error(GatewayError const &e) {
}
// State Transition -----------------------------------------------------------
const char *InitHandler::state_name(State state) {
const char *IL3InitHandler::state_name(State state) {
switch (state) {
case State::DONE:
return "DONE";
@@ -394,7 +401,7 @@ const char *InitHandler::state_name(State state) {
return nullptr;
}
void InitHandler::transition(State new_state) {
void IL3InitHandler::transition(State new_state) {
LOG(Spartan, Warn, "Transitioning gateway {} from {} to {}", me->cfg.segment,
log::CharPtrWrapper{state_name(me->state)},
log::CharPtrWrapper{state_name(new_state)});
@@ -14,7 +14,7 @@ namespace bts::spartan::il3 {
struct IL3GatewayCfg;
class IL3MsgSender;
class IInitObserver;
class IIL3InitObserver;
// Encapsulates the setup of an iLink3 connection, including
// synchronizing sequence numbers and requesting replay of lost
@@ -24,16 +24,16 @@ class IInitObserver;
// is after the start() methods is called the class will either invoke
// on_init_success() or on_init_failure() and then transition to a
// terminal state.
class InitHandler {
class IL3InitHandler {
public:
InitHandler();
~InitHandler();
IL3InitHandler();
~IL3InitHandler();
// Call this only once
void start(
IL3GatewayCfg const &cfg,
IL3MsgSender &sender,
IInitObserver &,
IIL3InitObserver &,
Clock &c);
void operator()(::il3::NegotiationResponse501);
@@ -6,7 +6,7 @@
namespace bts::spartan::il3 {
struct SuccessfullInitRec {
struct IL3InitRec {
size_t from_cme = 0;
size_t to_cme = 0;
uint32_t party_reg;
@@ -1,4 +1,4 @@
#include "SetPartyDetailsHandler.h"
#include "IL3PartyDetailsHandler.h"
#include "IPartyDetailsObserver.h"
#include "lib/utils/SecureLogon.h"
@@ -22,7 +22,7 @@
namespace bts::spartan::il3 {
enum class SetPartyDetailsHandler::State {
enum class IL3PartyDetailsHandler::State {
// Sent a Negotiate500 waiting for it to either be accepted
// (NegotiationResponse501) or rejected (NegotiationReject502). In
// case of success a Establish503 is sent.
@@ -38,7 +38,7 @@ enum class SetPartyDetailsHandler::State {
DONE
};
struct SetPartyDetailsHandler::PImpl {
struct IL3PartyDetailsHandler::PImpl {
State state;
IL3MsgSender &sender;
IPartyDetailsObserver &observer;
@@ -46,10 +46,10 @@ struct SetPartyDetailsHandler::PImpl {
const PartyDetailsCfg cfg;
};
SetPartyDetailsHandler::SetPartyDetailsHandler() {}
SetPartyDetailsHandler::~SetPartyDetailsHandler() {}
IL3PartyDetailsHandler::IL3PartyDetailsHandler() {}
IL3PartyDetailsHandler::~IL3PartyDetailsHandler() {}
void SetPartyDetailsHandler::start(
void IL3PartyDetailsHandler::start(
PartyDetailsCfg const &cfg,
IPartyDetailsObserver &obs,
IL3MsgSender &sender,
@@ -59,7 +59,7 @@ void SetPartyDetailsHandler::start(
send_negotiate();
}
void SetPartyDetailsHandler::operator()(::il3::NegotiationResponse501) {
void IL3PartyDetailsHandler::operator()(::il3::NegotiationResponse501) {
bts_assert(me->state == State::NEGOTIATING);
LOG(Spartan, Warn, "Successfull negotiation on UUID {} on OESGW",
me->cfg.uuid);
@@ -67,14 +67,14 @@ void SetPartyDetailsHandler::operator()(::il3::NegotiationResponse501) {
send_establish();
}
void SetPartyDetailsHandler::operator()(::il3::NegotiationReject502 msg) {
void IL3PartyDetailsHandler::operator()(::il3::NegotiationReject502 msg) {
bts_assert(me->state == State::NEGOTIATING);
LOG(Spartan, Warn, "Negotiation rejection for UUID {} on OESGW",
me->cfg.uuid);
on_error(GatewayError::il3_negotiation_reject(msg.errorCodes()));
}
void SetPartyDetailsHandler::operator()(::il3::EstablishmentAck504) {
void IL3PartyDetailsHandler::operator()(::il3::EstablishmentAck504) {
bts_assert(me->state == State::ESTABLISHING);
LOG(Spartan, Warn, "Successfull establishment on UUID {} on OESGW",
me->cfg.uuid);
@@ -82,25 +82,25 @@ void SetPartyDetailsHandler::operator()(::il3::EstablishmentAck504) {
send_party_details();
}
void SetPartyDetailsHandler::operator()(::il3::EstablishmentReject505 msg) {
void IL3PartyDetailsHandler::operator()(::il3::EstablishmentReject505 msg) {
bts_assert(me->state == State::ESTABLISHING);
on_error(GatewayError::il3_establish_reject(msg.errorCodes()));
}
void SetPartyDetailsHandler::operator()(::il3::Terminate507 msg) {
void IL3PartyDetailsHandler::operator()(::il3::Terminate507 msg) {
auto error = GatewayError::il3_unexpected_terminate(
std::string{msg.reason()}, msg.errorCodes());
on_error(error);
}
void SetPartyDetailsHandler::operator()(
void IL3PartyDetailsHandler::operator()(
::il3::PartyDetailsDefinitionRequestAck519) {
bts_assert(me->state == State::SETTING_PARTY_DETAILS);
transition(State::DONE);
me->observer.on_party_details_success(me->cfg.uuid);
}
void SetPartyDetailsHandler::send_negotiate() {
void IL3PartyDetailsHandler::send_negotiate() {
bts_assert(me->state == State::NEGOTIATING);
LOG(Spartan, Warn, "Negotiating UUID {} on OESGW", me->cfg.uuid);
@@ -120,7 +120,7 @@ void SetPartyDetailsHandler::send_negotiate() {
// Expect -> NegotiationResponse501 or NegotiationReject502
}
void SetPartyDetailsHandler::send_establish() {
void IL3PartyDetailsHandler::send_establish() {
bts_assert(me->state == State::ESTABLISHING);
LOG(Spartan, Warn, "Establishing UUID {} on OESGW", me->cfg.uuid);
@@ -151,7 +151,7 @@ void SetPartyDetailsHandler::send_establish() {
// expect -> EstablishmentAck504 or EstablishmentReject505
}
void SetPartyDetailsHandler::send_party_details() {
void IL3PartyDetailsHandler::send_party_details() {
bts_assert(me->state == State::SETTING_PARTY_DETAILS);
using namespace ::il3;
auto party_sz =
@@ -196,25 +196,25 @@ void SetPartyDetailsHandler::send_party_details() {
// Expect PartyDetailsdefinitionrequestack519
}
void SetPartyDetailsHandler::operator()(::il3::BusinessReject521 m) {
void IL3PartyDetailsHandler::operator()(::il3::BusinessReject521 m) {
auto error = GatewayError::il3_bussiness_reject(m.businessRejectReason());
on_error(error);
}
void SetPartyDetailsHandler::on_error(GatewayError const &e) {
void IL3PartyDetailsHandler::on_error(GatewayError const &e) {
LOG(Spartan, Error, "Error connecting to OESGW: {}", e);
transition(State::DONE);
me->observer.on_party_details_failure(e);
}
void SetPartyDetailsHandler::transition(State new_state) {
void IL3PartyDetailsHandler::transition(State new_state) {
LOG(Spartan, Warn, "Transitioning OESGW gateway from {} to {}",
log::CharPtrWrapper{state_name(me->state)},
log::CharPtrWrapper{state_name(new_state)});
me->state = new_state;
}
const char *SetPartyDetailsHandler::state_name(State state) {
const char *IL3PartyDetailsHandler::state_name(State state) {
switch (state) {
case State::DONE:
return "DONE";
@@ -17,10 +17,10 @@ class IPartyDetailsObserver;
// Register a pre-defined set of order details with the exchange under
// a specified ID. This set can then be referred by order in any of
// the MSGWS associated with the same set of iLink3 credentials.
class SetPartyDetailsHandler {
class IL3PartyDetailsHandler {
public:
SetPartyDetailsHandler();
~SetPartyDetailsHandler();
IL3PartyDetailsHandler();
~IL3PartyDetailsHandler();
void start(
PartyDetailsCfg const &cfg,
@@ -0,0 +1,14 @@
#pragma once
namespace bts::spartan {
class GatewayError;
struct OrderUpdate;
class IIL3RealTimeObserver {
public:
virtual void on_realtime_error(GatewayError const &) = 0;
virtual void on_order_update(OrderUpdate const &) = 0;
};
} // namespace bts::spartan
@@ -1,4 +1,5 @@
#include "RealTimeHandler.h"
#include "IL3RealTimeHandler.h"
#include "IIL3RealTimeObserver.h"
#include "domain/order/OrderKey.h"
#include "execution/CancelReplace.h"
#include "execution/GatewayError.h"
@@ -30,11 +31,12 @@
#include "lib/jetfix/codec/i32_toa.h"
#include "lib/logging/logging.h"
#include "system/Clock.h"
#include <boost/container/small_vector.hpp>
namespace bts::spartan::il3 {
struct RealTimeHandler::WorkingOrder {
struct IL3RealTimeHandler::WorkingOrder {
mdp3::OrderKey clorid = {};
mdp3::OrderKey ok = {};
mdp3::SecurityID security_id = {};
@@ -49,7 +51,7 @@ struct RealTimeHandler::WorkingOrder {
};
};
struct RealTimeHandler::PImpl {
struct IL3RealTimeHandler::PImpl {
uint64_t party_reg_id;
IL3MsgSender &sender;
Clock &clock;
@@ -57,11 +59,11 @@ struct RealTimeHandler::PImpl {
std::array<char, 4> sender_id_5392;
std::array<char, 4> location_9357;
boost::container::small_vector<WorkingOrder, 10> working_orders;
IGatewayObserver &obs;
IIL3RealTimeObserver &obs;
IL3GatewayCfg const cfg;
};
inline size_t RealTimeHandler::alloc_order() {
inline size_t IL3RealTimeHandler::alloc_order() {
size_t n = 0;
for (auto &w : me->working_orders)
if (w.is_empty())
@@ -72,7 +74,8 @@ inline size_t RealTimeHandler::alloc_order() {
return n;
}
inline size_t RealTimeHandler::get_order(std::string_view clorid_str) const {
inline size_t
IL3RealTimeHandler::get_order(std::string_view clorid_str) const {
uint64_t clorid_v = 0;
for (auto c : clorid_str)
clorid_v = (clorid_v * 10) + c - '0';
@@ -84,7 +87,8 @@ inline size_t RealTimeHandler::get_order(std::string_view clorid_str) const {
return 0;
}
inline size_t RealTimeHandler::get_order(mdp3::OrderKey exchange_k) const {
inline size_t
IL3RealTimeHandler::get_order(mdp3::OrderKey exchange_k) const {
for (size_t i = 0; i < me->working_orders.size(); i++)
if (me->working_orders[i].ok == exchange_k)
return i;
@@ -92,10 +96,10 @@ inline size_t RealTimeHandler::get_order(mdp3::OrderKey exchange_k) const {
return 0;
}
RealTimeHandler::RealTimeHandler() {}
RealTimeHandler::~RealTimeHandler() {}
IL3RealTimeHandler::IL3RealTimeHandler() {}
IL3RealTimeHandler::~IL3RealTimeHandler() {}
OrderHandle RealTimeHandler::queue(NewOrder const &o) {
OrderHandle IL3RealTimeHandler::queue(NewOrder const &o) {
auto now = me->clock.now().value();
auto m = me->sender.enqueue<::il3::NewOrderSingle514>();
@@ -149,7 +153,7 @@ OrderHandle RealTimeHandler::queue(NewOrder const &o) {
return OrderHandle{w_idx};
}
void RealTimeHandler::queue(OrderHandle h, CancelReplace const &cr) {
void IL3RealTimeHandler::queue(OrderHandle h, CancelReplace const &cr) {
bts_assert_d(h.value() < me->working_orders.size());
auto &w = me->working_orders[h.value()];
bts_assert_d(w.ok.value());
@@ -202,7 +206,7 @@ void RealTimeHandler::queue(OrderHandle h, CancelReplace const &cr) {
m.shortSaleType(::il3::ShortSaleType::NULL_VALUE);
}
void RealTimeHandler::queue(OrderHandle h, Cancel const &) {
void IL3RealTimeHandler::queue(OrderHandle h, Cancel const &) {
bts_assert_d(h.value() < me->working_orders.size());
auto &w = me->working_orders[h.value()];
bts_assert_d(w.ok.value());
@@ -228,35 +232,26 @@ void RealTimeHandler::queue(OrderHandle h, Cancel const &) {
w = {};
}
void RealTimeHandler::send() { me->sender.flush(); }
void IL3RealTimeHandler::send() { me->sender.flush(); }
void RealTimeHandler::operator()(::il3::Sequence506) {
void IL3RealTimeHandler::operator()(::il3::Sequence506) {
auto msg = me->sender.enqueue<::il3::Sequence506>();
msg.uUID(me->cfg.uuid);
msg.uUID(me->cfg.uuid.value());
msg.nextSeqNo(me->next_sn);
msg.faultToleranceIndicator(::il3::FTI::NULL_VALUE);
msg.keepAliveIntervalLapsed(::il3::KeepAliveLapsed::NotLapsed);
me->sender.flush();
}
void RealTimeHandler::operator()(::il3::Terminate507 msg) {
auto error =
GatewayError::il3_unexpected_terminate(msg.reason(), msg.errorCodes());
LOG(Spartan, Error,
"Received terminate in real time handler on segment {}. Error: {}",
me->cfg.segment, error);
me->obs.on_error(error);
}
void RealTimeHandler::operator()(::il3::BusinessReject521 rej) {
void IL3RealTimeHandler::operator()(::il3::BusinessReject521 rej) {
auto error = GatewayError::il3_bussiness_reject(rej.businessRejectReason());
LOG(Spartan, Error,
"Business reject in real time handler on segment: {} Error: {}",
me->cfg.segment, error);
me->obs.on_error(error);
me->obs.on_realtime_error(error);
}
void RealTimeHandler::operator()(::il3::ExecutionReportNew522 m) {
void IL3RealTimeHandler::operator()(::il3::ExecutionReportNew522 m) {
auto ok = mdp3::OrderKey{m.orderID()};
auto clorid = m.getClOrdIDAsStringView();
auto oidx = get_order(clorid);
@@ -268,17 +263,18 @@ void RealTimeHandler::operator()(::il3::ExecutionReportNew522 m) {
o.total_fills});
}
void RealTimeHandler::operator()(::il3::ExecutionReportReject523 m) {
void IL3RealTimeHandler::operator()(::il3::ExecutionReportReject523 m) {
auto clorid = m.getClOrdIDAsStringView();
auto oidx = get_order(clorid);
auto &o = me->working_orders[oidx];
o.clear();
auto error = GatewayError::il3_new_order_reject(
m.getTextAsString(), m.ordRejReason());
me->obs.on_error(error);
me->obs.on_realtime_error(error);
}
void RealTimeHandler::operator()(::il3::ExecutionReportElimination524 m) {
void IL3RealTimeHandler::operator()(
::il3::ExecutionReportElimination524 m) {
auto ok = mdp3::OrderKey{m.orderID()};
auto oidx = get_order(ok);
auto &o = me->working_orders[oidx];
@@ -288,50 +284,52 @@ void RealTimeHandler::operator()(::il3::ExecutionReportElimination524 m) {
o.total_fills});
}
template <class M> void RealTimeHandler::on_trade(M m) {
template <class M>
void IL3RealTimeHandler::on_trade(M m) {
auto ok = mdp3::OrderKey{m.orderID()};
auto oidx = get_order(ok);
auto &o = me->working_orders[oidx];
auto old_qty = o.total_fills;
auto new_qty = mdp3::Quantity{(int) m.cumQty()};
auto new_qty = mdp3::Quantity{(int)m.cumQty()};
mdp3::Price new_avg_fill_price;
if (old_qty == 0)
new_avg_fill_price = mdp3::Price::from_mdp3(m.lastPx());
else {
auto old_total_expense = o.avg_fill_price * old_qty.value();
auto new_fill_expense = mdp3::Price::from_mdp3(m.lastPx()) * m.lastQty();
new_avg_fill_price =
(new_fill_expense + old_total_expense) / new_qty.value();
new_avg_fill_price =
(new_fill_expense + old_total_expense) / new_qty.value();
}
OrderStatus new_status ;
OrderStatus new_status;
if (m.ordStatus() == ::il3::OrdStatusTrd::Filled) {
new_status = OrderStatus::COMPLETED;
o.clear();
}
else {
} else {
new_status = OrderStatus::WORKING;
o.avg_fill_price = new_avg_fill_price;
o.total_fills = new_qty;
}
me->obs.on_order_update(
{OrderHandle{oidx}, new_status,new_avg_fill_price,new_qty});
{OrderHandle{oidx}, new_status, new_avg_fill_price, new_qty});
}
void RealTimeHandler::operator()(::il3::ExecutionReportTradeOutright525 m) {
void IL3RealTimeHandler::operator()(
::il3::ExecutionReportTradeOutright525 m) {
on_trade(m);
}
void RealTimeHandler::operator()(::il3::ExecutionReportTradeSpread526 m) {
void IL3RealTimeHandler::operator()(
::il3::ExecutionReportTradeSpread526 m) {
on_trade(m);
}
// Modifies are supposed to work, so nothing to do if they do.
void RealTimeHandler::operator()(::il3::ExecutionReportModify531) {}
void IL3RealTimeHandler::operator()(::il3::ExecutionReportModify531) {}
// A cancel that works will result in the order being canceled
void RealTimeHandler::operator()(::il3::ExecutionReportCancel534 m) {
void IL3RealTimeHandler::operator()(::il3::ExecutionReportCancel534 m) {
auto ok = mdp3::OrderKey{m.orderID()};
auto oidx = get_order(ok);
auto &o = me->working_orders[oidx];
@@ -340,40 +338,45 @@ void RealTimeHandler::operator()(::il3::ExecutionReportCancel534 m) {
auto total_fills = o.total_fills;
o.clear();
me->obs.on_order_update(
{OrderHandle{oidx}, OrderStatus::CANCELED,avg_p,total_fills});
{OrderHandle{oidx}, OrderStatus::CANCELED, avg_p, total_fills});
}
// Ignore these
void RealTimeHandler::operator()(::il3::ExecutionReportTradeSpreadLeg527) {}
void IL3RealTimeHandler::operator()(
::il3::ExecutionReportTradeSpreadLeg527) {}
// These should never be received
void RealTimeHandler::operator()(::il3::ExecutionReportStatus532) {}
void RealTimeHandler::operator()(::il3::OrderCancelReject535 m) {
void IL3RealTimeHandler::operator()(::il3::Terminate507 m) {
auto error =
GatewayError::il3_unexpected_terminate(m.reason(), m.errorCodes());
me->obs.on_realtime_error(error);
}
void IL3RealTimeHandler::operator()(::il3::OrderCancelReject535 m) {
auto error =
GatewayError::il3_cancel_reject(m.getTextAsString(), m.cxlRejReason());
me->obs.on_error(error);
me->obs.on_realtime_error(error);
}
void RealTimeHandler::operator()(::il3::OrderCancelReplaceReject536 m) {
void IL3RealTimeHandler::operator()(
::il3::OrderCancelReplaceReject536 m) {
auto error = GatewayError::il3_cancel_replace_reject(
m.getTextAsString(), m.cxlRejReason());
me->obs.on_error(error);
me->obs.on_realtime_error(error);
}
void RealTimeHandler::operator()(
void IL3RealTimeHandler::operator()(
::il3::ExecutionReportTradeAddendumOutright548) {
auto error = GatewayError{GatewayError::TRADE_CORRECTION};
me->obs.on_error(error);
me->obs.on_realtime_error(error);
}
void RealTimeHandler::operator()(::il3::ExecutionReportTradeAddendumSpread549) {
void IL3RealTimeHandler::operator()(
::il3::ExecutionReportTradeAddendumSpread549) {
auto error = GatewayError{GatewayError::TRADE_CORRECTION};
me->obs.on_error(error);
me->obs.on_realtime_error(error);
}
void RealTimeHandler::operator()(
void IL3RealTimeHandler::operator()(
::il3::ExecutionReportTradeAddendumSpreadLeg550) {
auto error = GatewayError{GatewayError::TRADE_CORRECTION};
me->obs.on_error(error);
me->obs.on_realtime_error(error);
}
} // namespace bts::spartan::il3
@@ -6,7 +6,7 @@
namespace bts::spartan {
class Clock;
class IGatewayObserver;
class IRealTimeExecutionObserver;
class GatewayError;
class NewOrder;
class CancelReplace;
@@ -19,18 +19,18 @@ struct IL3GatewayCfg;
struct SuccessfullInitRec;
class IL3MsgSender;
// Processes real time execution reports and provides a way to send,
// update and cancel orders via an iLink3 connection.
class RealTimeHandler {
// Handles the happy path of an ilink3 connection: sending, canceling
// and updating orders and processing execution reports
class IL3RealTimeHandler {
public:
RealTimeHandler();
~RealTimeHandler();
IL3RealTimeHandler();
~IL3RealTimeHandler();
void start(
IL3GatewayCfg const &cfg,
SuccessfullInitRec const &,
IL3MsgSender &sender,
IGatewayObserver &,
IRealTimeExecutionObserver&,
Clock &c);
OrderHandle queue(NewOrder const &);
@@ -39,9 +39,7 @@ class RealTimeHandler {
void send();
void operator()(::il3::Sequence506);
void operator()(::il3::Terminate507);
void operator()(::il3::BusinessReject521);
void operator()(::il3::ExecutionReportNew522);
void operator()(::il3::ExecutionReportReject523);
void operator()(::il3::ExecutionReportElimination524);
@@ -49,7 +47,7 @@ class RealTimeHandler {
void operator()(::il3::ExecutionReportTradeSpread526);
void operator()(::il3::ExecutionReportTradeSpreadLeg527);
void operator()(::il3::ExecutionReportModify531);
void operator()(::il3::ExecutionReportStatus532);
void operator()(::il3::Terminate507);
void operator()(::il3::ExecutionReportCancel534);
void operator()(::il3::OrderCancelReject535);
void operator()(::il3::OrderCancelReplaceReject536);
@@ -7,6 +7,11 @@ namespace bts::spartan::il3 {
class IIL3SessionStore {
public:
virtual ~IIL3SessionStore() {};
struct SeqNum {
size_t to_cme;
size_t from_cme;
};
virtual SeqNum starting_seq_num() = 0;
virtual void store_incoming(std::string_view const&) = 0;
virtual void store_outgoing(std::string_view const&) = 0;
};
@@ -1,9 +1,9 @@
#include "IL3SessionFileStore.h"
#include "lib/utils/datetime.h"
#include "lib/utils/file_utils.h"
#include "lib/utils/type_name.h"
#include "server/sparkd/cmds/spartan/execution/il3/common/IL3MsgFramer.h"
#include "server/sparkd/cmds/spartan/execution/il3/parsing/IL3Parser.h"
#include "lib/utils/type_name.h"
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/filesystem.hpp>
#include <nlohmann/json.hpp>
@@ -30,7 +30,7 @@ struct IL3SessionFileStore::PImpl {
};
IL3SessionFileStore::IL3SessionFileStore(
std::string const &session_kind, std::string const &path)
std::string const &session_kind, std::string const &path, IL3UUID)
: me(new PImpl()) {
me->file_store.open(store_path(session_kind, path), std::ofstream::app);
nlohmann::json j;
@@ -55,7 +55,7 @@ struct Persister {
nlohmann::json j;
j["direction"] = direction;
j["time"] = datetime::FIX_timestamp(datetime::now());
j["type"] = utils::type_name<M>();
j["type"] = utils::type_name<M>();
std::stringstream buffer;
buffer << m;
try {
@@ -63,7 +63,7 @@ struct Persister {
} catch (...) {
LOG(Spartan, Error, "Skipping troublesome json encoded message: {}",
buffer.str());
j["msg_json"] = {} ;
j["msg_json"] = {};
}
stream << j << std::endl;
stream.flush();
@@ -91,7 +91,6 @@ struct Persister {
stream << j << std::endl;
stream.flush();
}
};
void IL3SessionFileStore::store(
@@ -1,6 +1,7 @@
#pragma once
#include "server/sparkd/cmds/spartan/execution/il3/store/IIL3SessionStore.h"
#include "execution/il3/store/IIL3SessionStore.h"
#include "execution/il3/common/IL3UUID.h"
#include <memory>
#include <string>
@@ -12,9 +13,12 @@ class IL3MsgFramer;
class IL3SessionFileStore : public IIL3SessionStore {
public:
IL3SessionFileStore(
std::string const &session_kind, std::string const &session_name);
std::string const &session_kind,
std::string const &session_name,
IL3UUID uuid);
~IL3SessionFileStore();
SeqNum starting_seq_num() override { return {}; }
void store_incoming(std::string_view const &bytes) override;
void store_outgoing(std::string_view const &bytes) override;
@@ -1,21 +1,21 @@
#include <catch/catch.hpp>
#include "server/sparkd/cmds/spartan/common/EndPoint.h"
#include "server/sparkd/cmds/spartan/execution/GatewayError.h"
#include "server/sparkd/cmds/spartan/execution/il3/common/IL3GatewayCfg.h"
#include "server/sparkd/cmds/spartan/execution/il3/common/IL3MsgFramer.h"
#include "server/sparkd/cmds/spartan/execution/il3/common/IL3MsgSender.h"
#include "server/sparkd/cmds/spartan/execution/il3/common/PartyDetailsCfg.h"
#include "server/sparkd/cmds/spartan/execution/il3/handlers/init/IInitObserver.h"
#include "server/sparkd/cmds/spartan/execution/il3/handlers/init/InitHandler.h"
#include "server/sparkd/cmds/spartan/execution/il3/handlers/party_details/IPartyDetailsObserver.h"
#include "server/sparkd/cmds/spartan/execution/il3/handlers/party_details/SetPartyDetailsHandler.h"
#include "server/sparkd/cmds/spartan/execution/il3/parsing/IL3Parser.h"
#include "server/sparkd/cmds/spartan/execution/il3/store/IL3SessionFileStore.h"
#include "server/sparkd/cmds/spartan/system/Clock.h"
#include "server/sparkd/cmds/spartan/system/reactor/IConnection.h"
#include "server/sparkd/cmds/spartan/system/reactor/IConnectionObserver.h"
#include "server/sparkd/cmds/spartan/system/reactor/Reactor.h"
#include "common/EndPoint.h"
#include "execution/GatewayError.h"
#include "execution/il3/common/IL3GatewayCfg.h"
#include "execution/il3/common/IL3MsgFramer.h"
#include "execution/il3/common/IL3MsgSender.h"
#include "execution/il3/common/PartyDetailsCfg.h"
#include "execution/il3/handlers/init/IIL3InitObserver.h"
#include "execution/il3/handlers/init/IL3InitHandler.h"
#include "execution/il3/handlers/party_details/IL3PartyDetailsHandler.h"
#include "execution/il3/handlers/party_details/IPartyDetailsObserver.h"
#include "execution/il3/parsing/IL3Parser.h"
#include "execution/il3/store/IL3SessionFileStore.h"
#include "system/Clock.h"
#include "system/reactor/IConnection.h"
#include "system/reactor/IConnectionObserver.h"
#include "system/reactor/Reactor.h"
#include <boost/date_time/posix_time/ptime.hpp>
@@ -55,7 +55,7 @@ static size_t set_party_details() {
"M3V" // operator
};
auto store = IL3SessionFileStore{"oesgw", "log"};
auto store = IL3SessionFileStore{"oesgw", "log",IL3UUID{0}};
auto connected = false;
auto disconnected = false;
@@ -92,7 +92,7 @@ static size_t set_party_details() {
store.store_outgoing(bytes);
c.send(bytes);
};
SetPartyDetailsHandler handle;
IL3PartyDetailsHandler handle;
auto framer = IL3MsgFramer();
c_obs.data = [&framer, &handle, &store](auto bytes) {
@@ -113,7 +113,7 @@ static size_t connect(IL3GatewayCfg const &gw_cfg) {
auto gw_end_point = EndPoint{"10.3.10.16", 57630, EndPoint::TCP};
// Store
auto store = IL3SessionFileStore{"gw", "52"};
auto store = IL3SessionFileStore{"gw", "52", IL3UUID{0}};
// Setup connection observer
auto c_obs = MyConnectionObs{};
@@ -141,18 +141,16 @@ static size_t connect(IL3GatewayCfg const &gw_cfg) {
Clock clock;
bool done = false;
struct MyObserver : IInitObserver {
std::function<void(SuccessfullInitRec const &)> on_success;
struct MyObserver : IIL3InitObserver {
std::function<void(IL3InitRec const &)> on_success;
std::function<void(GatewayError const &)> on_failure;
void on_init_success(SuccessfullInitRec const &rec) override {
on_success(rec);
}
void on_init_success(IL3InitRec const &rec) override { on_success(rec); }
void on_init_failure(GatewayError const &e) override { on_failure(e); }
} my_obs;
my_obs.on_success = [&done](auto const &) { done = true; };
my_obs.on_failure = [](auto const &e) { REQUIRE(e.message() == ""); };
auto handler = InitHandler{};
auto handler = IL3InitHandler{};
handler.start(gw_cfg, sender, my_obs, clock);
c_obs.data = [&framer, &handler, &store](auto bytes) {
framer.on_bytes(bytes, [&handler, &store](auto framed_bytes) {
@@ -165,12 +163,12 @@ static size_t connect(IL3GatewayCfg const &gw_cfg) {
REQUIRE(!disconnected);
}
auto terminate = sender.enqueue<::il3::Terminate507>();
terminate.uUID(gw_cfg.uuid);
terminate.uUID(gw_cfg.uuid.value());
terminate.requestTimestamp(clock.now().value());
terminate.errorCodes(0);
terminate.splitMsg(::il3::SplitMsg::NULL_VALUE);
sender.flush();
return gw_cfg.uuid;
return gw_cfg.uuid.value();
}
TEST_CASE("iLink3", "[spartan_cert") {
@@ -178,7 +176,7 @@ TEST_CASE("iLink3", "[spartan_cert") {
SECTION("set_party_details") { REQUIRE(set_party_details()); }
auto negotiate_cfg = IL3GatewayCfg{
Clock{}.now().value(),
IL3UUID{Clock{}.now().value()},
1, // smp_id
"M3V", // cme_session
"498", // firm
@@ -193,14 +191,14 @@ TEST_CASE("iLink3", "[spartan_cert") {
0}; // to cme
SECTION("init_handler_negotiate") { REQUIRE(connect(negotiate_cfg)); }
SECTION("init_handler_establish") {
sleep_for(5s);
auto uuid = connect(negotiate_cfg);
REQUIRE(uuid);
sleep_for(5s);
auto establish_cfg = IL3GatewayCfg{
uuid,
IL3UUID{uuid},
1, // smp_id
"M3V", // cme_session
"498", // firm
@@ -1,11 +1,11 @@
#pragma once
#include "../realtime/IRealTimeObserver.h"
#include "../recovery/IRecoveryObserver.h"
#include "../realtime/IMDP3RealTimeObserver.h"
#include "../recovery/IMDP3RecoveryObserver.h"
namespace bts::spartan::mdp3 {
class IMDP3FeedObserver : public IRecoveryObserver, public IRealTimeObserver {
class IMDP3FeedObserver : public IMDP3RecoveryObserver, public IMDP3RealTimeObserver {
public:
virtual void init() {}
virtual void finit() {}
@@ -9,8 +9,9 @@ class MDP3PacketView;
class SecuritySnapshot;
struct TradeSummarySignal;
class IRealTimeObserver {
class IMDP3RealTimeObserver {
public:
virtual ~IMDP3RealTimeObserver() {}
virtual void on_packet_begin(MDP3PacketView const &) = 0;
virtual void on_packet_end() = 0;
@@ -1,5 +1,5 @@
#include "RealTimeHandler.h"
#include "IRealTimeObserver.h"
#include "IMDP3RealTimeObserver.h"
#include "server/sparkd/cmds/spartan/domain/SecuritySnapshot.h"
#include "server/sparkd/cmds/spartan/domain/TradeSummarySignal.h"
#include "server/sparkd/cmds/spartan/market_data/common/mdp3_common.h"
@@ -26,7 +26,7 @@ struct RealTimeHandler::PendingTradeOrderDetail {
};
struct RealTimeHandler::PImpl {
PImpl(IRealTimeObserver &o)
PImpl(IMDP3RealTimeObserver &o)
: securities(), current_packet_send_time(TimeStamp{0}),
current_packet_sn(0), current_event(), observer(o), pending_ts(),
pending_trade_order_detail() {}
@@ -36,7 +36,7 @@ struct RealTimeHandler::PImpl {
TimeStamp current_packet_send_time;
uint32_t current_packet_sn;
MDP3Event current_event;
IRealTimeObserver &observer;
IMDP3RealTimeObserver &observer;
std::vector<PendingTradeSummary> pending_ts;
std::vector<PendingTradeOrderDetail> pending_trade_order_detail;
};
@@ -111,7 +111,7 @@ struct RealTimeHandler::EventGuard {
RealTimeHandler &owner;
};
RealTimeHandler::RealTimeHandler(IRealTimeObserver &o) : me(new PImpl(o)) {}
RealTimeHandler::RealTimeHandler(IMDP3RealTimeObserver &o) : me(new PImpl(o)) {}
RealTimeHandler::~RealTimeHandler() {}
@@ -25,7 +25,7 @@ class SecurityStatus30;
namespace bts::spartan::mdp3 {
class SecuritySnapshot;
class IRealTimeObserver;
class IMDP3RealTimeObserver;
class MDP3PacketView;
// Updates a set of security snapshots with the incremental changes
@@ -38,7 +38,7 @@ class MDP3PacketView;
// through the real time incremental feed.
class RealTimeHandler {
public:
RealTimeHandler(IRealTimeObserver &);
RealTimeHandler(IMDP3RealTimeObserver &);
~RealTimeHandler();
// Add a snapshot, including the security definition and its book
@@ -5,7 +5,7 @@ namespace bts::spartan::mdp3 {
class SecuritySnapshot;
class IRecoveryObserver {
class IMDP3RecoveryObserver {
public:
using InitialSnapshot = std::vector<SecuritySnapshot const *>;
virtual void on_recovery_complete(InitialSnapshot const &) = 0;
@@ -1,5 +1,5 @@
#include "RecoveryHandler.h"
#include "../realtime/IRealTimeObserver.h"
#include "../realtime/IMDP3RealTimeObserver.h"
#include "../realtime/RealTimeHandler.h"
#include "BookSnapshot.h"
#include "DefinitionSnapshot.h"
@@ -177,7 +177,7 @@ RecoveryHandler::MaybeSnapshot RecoveryHandler::try_build_snapshot_and_reset() {
// building the respective book. We can now apply our queued
// messages, ensuring that we only add an instrument when the next
// event in the queue has not yet been seen by the snapshot.
struct NullObserver : IRealTimeObserver {
struct NullObserver : IMDP3RealTimeObserver {
void on_event_begin(MDP3Event const &) {}
void on_books(SecuritySnapshot const &, Book const &, ImpliedBook const &) {}
void on_trade_summary_signal(SecuritySnapshot const &,TradeSummarySignal const& ) {}