From 70e58edacb30254faac28c5cccdc1a06de4d9a63 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Sun, 24 Nov 2019 21:40:12 -0500 Subject: [PATCH] More gateway work. --- src/client/spark_api/utils/Log.cs | 2 + src/lib/CMakeDeps.cmake | 2 +- src/lib/logging/logging.cpp | 1 + src/lib/logging/logging.h | 4 +- src/lib/orderman_v2/actors/Gateway.cpp | 504 +++++++++++++++++- src/lib/orderman_v2/actors/Gateway.h | 61 ++- src/lib/orderman_v2/actors/OrderManager.h | 2 +- src/lib/orderman_v2/common.cpp | 2 + src/lib/orderman_v2/common.h | 51 +- src/lib/orderman_v2/doc/orderman_v2_notes.org | 109 ++-- src/lib/orderman_v2/events/events.h | 178 ++++--- src/lib/orderman_v2/execution/ExecReport.h | 20 + src/lib/orderman_v2/execution/ICancelMsg.cpp | 1 + src/lib/orderman_v2/execution/ICancelMsg.h | 17 + .../execution/ICancelReplaceMsg.cpp | 1 + .../orderman_v2/execution/ICancelReplaceMsg.h | 17 + src/lib/orderman_v2/execution/ILimiter.cpp | 1 + src/lib/orderman_v2/execution/ILimiter.h | 42 ++ .../execution/INewOrderSingleMsg.cpp | 1 + .../execution/INewOrderSingleMsg.h | 17 + src/lib/orderman_v2/execution/IRouter.cpp | 1 + src/lib/orderman_v2/execution/IRouter.h | 24 + src/lib/orderman_v2/execution/IVenue.cpp | 1 + src/lib/orderman_v2/execution/IVenue.h | 33 ++ src/lib/orderman_v2/execution/IVenueMsg.cpp | 2 + src/lib/orderman_v2/execution/IVenueMsg.h | 12 + .../orderman_v2/execution/IVenueObserver.h | 13 + .../orderman_v2/execution/UserAccountVenue.h | 34 ++ src/lib/orderman_v2/fix/Fields.h | 2 + .../orderman_v2/interconnect/Orchestrator.cpp | 13 +- .../orderman_v2/interconnect/Orchestrator.h | 4 +- .../sparkd/cmds/benchmarks/fix_gen_bm.cpp | 88 ++- src/server/sparkd/main.cpp | 3 +- src/web/CMakeDeps.cmake | 2 +- 34 files changed, 1052 insertions(+), 213 deletions(-) create mode 100644 src/lib/orderman_v2/common.cpp create mode 100644 src/lib/orderman_v2/execution/ExecReport.h create mode 100644 src/lib/orderman_v2/execution/ICancelMsg.cpp create mode 100644 src/lib/orderman_v2/execution/ICancelMsg.h create mode 100644 src/lib/orderman_v2/execution/ICancelReplaceMsg.cpp create mode 100644 src/lib/orderman_v2/execution/ICancelReplaceMsg.h create mode 100644 src/lib/orderman_v2/execution/ILimiter.cpp create mode 100644 src/lib/orderman_v2/execution/ILimiter.h create mode 100644 src/lib/orderman_v2/execution/INewOrderSingleMsg.cpp create mode 100644 src/lib/orderman_v2/execution/INewOrderSingleMsg.h create mode 100644 src/lib/orderman_v2/execution/IRouter.cpp create mode 100644 src/lib/orderman_v2/execution/IRouter.h create mode 100644 src/lib/orderman_v2/execution/IVenue.cpp create mode 100644 src/lib/orderman_v2/execution/IVenue.h create mode 100644 src/lib/orderman_v2/execution/IVenueMsg.cpp create mode 100644 src/lib/orderman_v2/execution/IVenueMsg.h create mode 100644 src/lib/orderman_v2/execution/IVenueObserver.h create mode 100644 src/lib/orderman_v2/execution/UserAccountVenue.h diff --git a/src/client/spark_api/utils/Log.cs b/src/client/spark_api/utils/Log.cs index 649f7d202..52d2dcc98 100644 --- a/src/client/spark_api/utils/Log.cs +++ b/src/client/spark_api/utils/Log.cs @@ -36,6 +36,7 @@ namespace bts { Plugin, ClientSdk, Http, + OrderMan2, // Please keep this list in sync with logging.h/logging.cpp } @@ -105,6 +106,7 @@ namespace bts { internal static Logger DataFlow => new Logger(Subsystem.DataFlow); public static Logger ClientSdk => new Logger(Subsystem.ClientSdk); public static Logger Http => new Logger(Subsystem.Http); + public static Logger OrderMan2 => new Logger(Subsystem.OrderMan2); internal static void log_at(this Logger logger, Level level, string message) { switch (level) { diff --git a/src/lib/CMakeDeps.cmake b/src/lib/CMakeDeps.cmake index 38738291a..8d82b4d3c 100644 --- a/src/lib/CMakeDeps.cmake +++ b/src/lib/CMakeDeps.cmake @@ -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/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/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/spreader.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/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/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/Executor.cpp;mercury/topics/Topic.cpp;metrics/metrics.cpp;metrics/system_metrics.cpp;orderman/actors/AsyncFactory.cpp;orderman/actors/FillStore.cpp;orderman/actors/GLBXExecutionGateway.cpp;orderman/actors/ICEExecutionGateway.cpp;orderman/actors/IExecutionGateway.cpp;orderman/actors/MDSupplementarySource.cpp;orderman/actors/OrderStore.cpp;orderman/actors/SODPosition.cpp;orderman/actors/SecuritySrc.cpp;orderman/actors/ServiceBridge.cpp;orderman/actors/order_manager/OrderBuilder.cpp;orderman/actors/order_manager/OrderManager.cpp;orderman/actors/order_manager/OrderServices.cpp;orderman/actors/order_manager/OrderServicesData.cpp;orderman/core/IOrderServices.cpp;orderman/events/CancelRejectEvent.cpp;orderman/events/FilledPositionEvent.cpp;orderman/events/NewExecutionReportEvent.cpp;orderman/limiter/LimitStore.cpp;orderman/limiter/Limiter.cpp;orderman/limiter/ProductLimitNode.cpp;orderman/limiter/ProductLimitTree.cpp;orderman/limiter/SecurityLimitNode.cpp;orderman/limiter/SecurityLimitTree.cpp;orderman/limiter/tests/limit_tests.cpp;orderman/order_factory/DynamicOrderRegistry.cpp;orderman/order_factory/OrderFactory.cpp;orderman/order_router/OrderRouter.cpp;orderman/orderman_utils/fix_order_codec.cpp;orderman/orderman_utils/orderman_utils.cpp;orderman/orders/CompositeOrder.cpp;orderman/orders/DynamicOrder.cpp;orderman/orders/GLBXNativeOrder.cpp;orderman/orders/ICENativeOrder.cpp;orderman/orders/Order.cpp;orderman/orders/TimeBoxOrder.cpp;orderman/orders/TriggerOrder.cpp;orderman/orders/algo/AlgoWrapperOrder.cpp;orderman/orders/algo/DynamicHelpers.cpp;orderman/orders/algo/IAlgoOrder.cpp;orderman/orders/algo/IAlgoServices.cpp;orderman/orders/algo/IBeforeLaunchAlgoServices.cpp;orderman/orders/algo/algo_orders/CoverAlgo.cpp;orderman/orders/algo/algo_orders/DormanAlgo.cpp;orderman/orders/algo/algo_orders/IcebergAlgo.cpp;orderman/orders/algo/algo_orders/JoinAlgo.cpp;orderman/orders/algo/algo_orders/LeanAlgo.cpp;orderman/orders/algo/algo_orders/OffsetAlgo.cpp;orderman/orders/algo/algo_orders/ProRataAlgo.cpp;orderman/orders/algo/algo_orders/RegisterDorman.cpp;orderman/orders/algo/algo_orders/ScratchAlgo.cpp;orderman/orders/algo/algo_orders/SplitterAlgo.cpp;orderman/orders/algo/algo_orders/TopAlgo.cpp;orderman/orders/algo/algo_orders/tests/AlgoTestDriver.cpp;orderman/orders/algo/algo_orders/tests/dorman_tests.cpp;orderman/orders/algo/algo_orders/tests/splitter_tests.cpp;orderman/orders/book_algos/BookAlgo.cpp;orderman/orders/book_algos/BookOrderBase.cpp;orderman/orders/book_algos/OCOOrder.cpp;orderman/orders/book_algos/PricerOrder.cpp;orderman/orders/queue_holder/QueueHolderOrder.cpp;orderman/orders/queue_holder/state_workers/QHOEndStateWorker.cpp;orderman/orders/queue_holder/state_workers/QHOStartStateWorker.cpp;orderman/orders/queue_holder/state_workers/QHOWaitingForAckStateWorker.cpp;orderman/orders/queue_holder/state_workers/QHOWaitingForCancelAllStateWorker.cpp;orderman/orders/queue_holder/state_workers/QHOWorkingStateWorker.cpp;orderman/orders/spreader_orders/SpreaderOrder.cpp;orderman/orders/spreader_orders/spreader/LegFillState.cpp;orderman/orders/spreader_orders/spreader/LegPropertyData.cpp;orderman/orders/spreader_orders/spreader/NLegsHedgeRecompData.cpp;orderman/orders/spreader_orders/spreader/QuoteLegPriceQuantityState.cpp;orderman/orders/spreader_orders/spreader/SingleFillHedger.cpp;orderman/orders/spreader_orders/spreader/SingleLegQuoter.cpp;orderman/orders/spreader_orders/spreader/SpreaderBookkeepingData.cpp;orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.cpp;orderman/orders/spreader_orders/spreader/SpreaderLegData.cpp;orderman/orders/spreader_orders/spreader/SpreaderUtils.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderOrderBuilder.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderOrderServices.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderPreActivationOrderServices.cpp;orderman/orders/spreader_orders/spreader/hedger/HedgerManager.cpp;orderman/orders/spreader_orders/spreader/hedger/UnhedgedDelta.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerEndStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerStartStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForCancelAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForFirstAckCancelledStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForFirstAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWorkingStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteDriverSet.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteDriverSetHistory.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteLegDriver.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterEndStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterStartStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForCancelAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForFirstAckCancelledWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForFirstAckWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForIOCWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForSizeStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderEndStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderStartStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderWaitingForCancelAllStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderWaitingForInitialDataStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderWorkingStateWorker.cpp;orderman/orders/spreader_orders/tests/spreader_tests.cpp;orderman/server/OrderServiceServer.cpp;orderman/tests/fat_wrapper_tests.cpp;orderman_v2/OrderManEngine.cpp;orderman_v2/OrderManScheduler.cpp;orderman_v2/actors/Actor.cpp;orderman_v2/actors/Gateway.cpp;orderman_v2/actors/MDSource.cpp;orderman_v2/actors/OrderManager.cpp;orderman_v2/actors/ServiceBridge.cpp;orderman_v2/actors/Storage.cpp;orderman_v2/events/events.cpp;orderman_v2/fix/Fields.cpp;orderman_v2/interconnect/Action.cpp;orderman_v2/interconnect/Orchestrator.cpp;orderman_v2/interconnect/Queue.cpp;orderman_v2/interconnect/Signal.cpp;orderman_v2/interconnect/Thread.cpp;os/os.cpp;os/tests/os_tests.cpp;persistence/IStore.cpp;persistence/PersistenceServiceServer.cpp;persistence/SqliteStore.cpp;persistence/persistence_utils.cpp;persistence/tests/PersistenceServiceTests.cpp;plugin/SparkServices.cpp;plugin/plugin.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;tracing/PerfLog.cpp;tracing/bts_trace.cpp;utils/AuthSessionManager.cpp;utils/AuthToken.cpp;utils/Dispatcher.cpp;utils/GrowableSPSCQueue.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;utils/Puid.cpp;utils/SecureLogon.cpp;utils/SharedMemory.cpp;utils/Sqlite_utils.cpp;utils/Uuid.cpp;utils/crypto/CipherType.cpp;utils/crypto/CryptoInit.cpp;utils/crypto/Digest.cpp;utils/crypto/KeyCodeHelper.cpp;utils/crypto/PasswordCallback.cpp;utils/crypto/PrivateKey.cpp;utils/crypto/PublicKey.cpp;utils/crypto/iostreambio.cpp;utils/datetime.cpp;utils/download.cpp;utils/file_utils.cpp;utils/init_spark_lib.cpp;utils/is_unittest_environment.cpp;utils/sftp.cpp;utils/stats.cpp;utils/tests/AuthTokenTests.cpp;utils/tests/IDGeneratorTests.cpp;utils/tests/SingleWriterConcurrentVectorTests.cpp;utils/thread_manager.cpp) \ No newline at end of file +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/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/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/spreader.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/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/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/Executor.cpp;mercury/topics/Topic.cpp;metrics/metrics.cpp;metrics/system_metrics.cpp;orderman/actors/AsyncFactory.cpp;orderman/actors/FillStore.cpp;orderman/actors/GLBXExecutionGateway.cpp;orderman/actors/ICEExecutionGateway.cpp;orderman/actors/IExecutionGateway.cpp;orderman/actors/MDSupplementarySource.cpp;orderman/actors/OrderStore.cpp;orderman/actors/SODPosition.cpp;orderman/actors/SecuritySrc.cpp;orderman/actors/ServiceBridge.cpp;orderman/actors/order_manager/OrderBuilder.cpp;orderman/actors/order_manager/OrderManager.cpp;orderman/actors/order_manager/OrderServices.cpp;orderman/actors/order_manager/OrderServicesData.cpp;orderman/core/IOrderServices.cpp;orderman/events/CancelRejectEvent.cpp;orderman/events/FilledPositionEvent.cpp;orderman/events/NewExecutionReportEvent.cpp;orderman/limiter/LimitStore.cpp;orderman/limiter/Limiter.cpp;orderman/limiter/ProductLimitNode.cpp;orderman/limiter/ProductLimitTree.cpp;orderman/limiter/SecurityLimitNode.cpp;orderman/limiter/SecurityLimitTree.cpp;orderman/limiter/tests/limit_tests.cpp;orderman/order_factory/DynamicOrderRegistry.cpp;orderman/order_factory/OrderFactory.cpp;orderman/order_router/OrderRouter.cpp;orderman/orderman_utils/fix_order_codec.cpp;orderman/orderman_utils/orderman_utils.cpp;orderman/orders/CompositeOrder.cpp;orderman/orders/DynamicOrder.cpp;orderman/orders/GLBXNativeOrder.cpp;orderman/orders/ICENativeOrder.cpp;orderman/orders/Order.cpp;orderman/orders/TimeBoxOrder.cpp;orderman/orders/TriggerOrder.cpp;orderman/orders/algo/AlgoWrapperOrder.cpp;orderman/orders/algo/DynamicHelpers.cpp;orderman/orders/algo/IAlgoOrder.cpp;orderman/orders/algo/IAlgoServices.cpp;orderman/orders/algo/IBeforeLaunchAlgoServices.cpp;orderman/orders/algo/algo_orders/CoverAlgo.cpp;orderman/orders/algo/algo_orders/DormanAlgo.cpp;orderman/orders/algo/algo_orders/IcebergAlgo.cpp;orderman/orders/algo/algo_orders/JoinAlgo.cpp;orderman/orders/algo/algo_orders/LeanAlgo.cpp;orderman/orders/algo/algo_orders/OffsetAlgo.cpp;orderman/orders/algo/algo_orders/ProRataAlgo.cpp;orderman/orders/algo/algo_orders/RegisterDorman.cpp;orderman/orders/algo/algo_orders/ScratchAlgo.cpp;orderman/orders/algo/algo_orders/SplitterAlgo.cpp;orderman/orders/algo/algo_orders/TopAlgo.cpp;orderman/orders/algo/algo_orders/tests/AlgoTestDriver.cpp;orderman/orders/algo/algo_orders/tests/dorman_tests.cpp;orderman/orders/algo/algo_orders/tests/splitter_tests.cpp;orderman/orders/book_algos/BookAlgo.cpp;orderman/orders/book_algos/BookOrderBase.cpp;orderman/orders/book_algos/OCOOrder.cpp;orderman/orders/book_algos/PricerOrder.cpp;orderman/orders/queue_holder/QueueHolderOrder.cpp;orderman/orders/queue_holder/state_workers/QHOEndStateWorker.cpp;orderman/orders/queue_holder/state_workers/QHOStartStateWorker.cpp;orderman/orders/queue_holder/state_workers/QHOWaitingForAckStateWorker.cpp;orderman/orders/queue_holder/state_workers/QHOWaitingForCancelAllStateWorker.cpp;orderman/orders/queue_holder/state_workers/QHOWorkingStateWorker.cpp;orderman/orders/spreader_orders/SpreaderOrder.cpp;orderman/orders/spreader_orders/spreader/LegFillState.cpp;orderman/orders/spreader_orders/spreader/LegPropertyData.cpp;orderman/orders/spreader_orders/spreader/NLegsHedgeRecompData.cpp;orderman/orders/spreader_orders/spreader/QuoteLegPriceQuantityState.cpp;orderman/orders/spreader_orders/spreader/SingleFillHedger.cpp;orderman/orders/spreader_orders/spreader/SingleLegQuoter.cpp;orderman/orders/spreader_orders/spreader/SpreaderBookkeepingData.cpp;orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.cpp;orderman/orders/spreader_orders/spreader/SpreaderLegData.cpp;orderman/orders/spreader_orders/spreader/SpreaderUtils.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderOrderBuilder.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderOrderServices.cpp;orderman/orders/spreader_orders/spreader/external_interfacing/SpreaderPreActivationOrderServices.cpp;orderman/orders/spreader_orders/spreader/hedger/HedgerManager.cpp;orderman/orders/spreader_orders/spreader/hedger/UnhedgedDelta.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerEndStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerStartStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForCancelAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForFirstAckCancelledStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWaitingForFirstAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/hedger/hedger_states/HedgerWorkingStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteDriverSet.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteDriverSetHistory.cpp;orderman/orders/spreader_orders/spreader/quoter/QuoteLegDriver.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterEndStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterStartStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForCancelAckStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForFirstAckCancelledWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForFirstAckWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForIOCWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWaitingForSizeStateWorker.cpp;orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderEndStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderStartStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderWaitingForCancelAllStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderWaitingForInitialDataStateWorker.cpp;orderman/orders/spreader_orders/spreader_states/SpreaderWorkingStateWorker.cpp;orderman/orders/spreader_orders/tests/spreader_tests.cpp;orderman/server/OrderServiceServer.cpp;orderman/tests/fat_wrapper_tests.cpp;orderman_v2/OrderManEngine.cpp;orderman_v2/OrderManScheduler.cpp;orderman_v2/actors/Actor.cpp;orderman_v2/actors/Gateway.cpp;orderman_v2/actors/MDSource.cpp;orderman_v2/actors/OrderManager.cpp;orderman_v2/actors/ServiceBridge.cpp;orderman_v2/actors/Storage.cpp;orderman_v2/common.cpp;orderman_v2/events/events.cpp;orderman_v2/execution/ICancelMsg.cpp;orderman_v2/execution/ICancelReplaceMsg.cpp;orderman_v2/execution/ILimiter.cpp;orderman_v2/execution/INewOrderSingleMsg.cpp;orderman_v2/execution/IRouter.cpp;orderman_v2/execution/IVenue.cpp;orderman_v2/execution/IVenueMsg.cpp;orderman_v2/fix/Fields.cpp;orderman_v2/interconnect/Action.cpp;orderman_v2/interconnect/Orchestrator.cpp;orderman_v2/interconnect/Queue.cpp;orderman_v2/interconnect/Signal.cpp;orderman_v2/interconnect/Thread.cpp;os/os.cpp;os/tests/os_tests.cpp;persistence/IStore.cpp;persistence/PersistenceServiceServer.cpp;persistence/SqliteStore.cpp;persistence/persistence_utils.cpp;persistence/tests/PersistenceServiceTests.cpp;plugin/SparkServices.cpp;plugin/plugin.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;tracing/PerfLog.cpp;tracing/bts_trace.cpp;utils/AuthSessionManager.cpp;utils/AuthToken.cpp;utils/Dispatcher.cpp;utils/GrowableSPSCQueue.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;utils/Puid.cpp;utils/SecureLogon.cpp;utils/SharedMemory.cpp;utils/Sqlite_utils.cpp;utils/Uuid.cpp;utils/crypto/CipherType.cpp;utils/crypto/CryptoInit.cpp;utils/crypto/Digest.cpp;utils/crypto/KeyCodeHelper.cpp;utils/crypto/PasswordCallback.cpp;utils/crypto/PrivateKey.cpp;utils/crypto/PublicKey.cpp;utils/crypto/iostreambio.cpp;utils/datetime.cpp;utils/download.cpp;utils/file_utils.cpp;utils/init_spark_lib.cpp;utils/is_unittest_environment.cpp;utils/sftp.cpp;utils/stats.cpp;utils/tests/AuthTokenTests.cpp;utils/tests/IDGeneratorTests.cpp;utils/tests/SingleWriterConcurrentVectorTests.cpp;utils/thread_manager.cpp) \ No newline at end of file diff --git a/src/lib/logging/logging.cpp b/src/lib/logging/logging.cpp index 46d575b2a..4759acceb 100644 --- a/src/lib/logging/logging.cpp +++ b/src/lib/logging/logging.cpp @@ -120,6 +120,7 @@ void configure_logging(bts::config::Logging const&cfg, bts::config::ThreadGroupC {log::Plugin,"Plugin"}, {log::ClientSdk,"ClientSdk"}, {log::Http,"Http"}, + {log::OrderMan2,"OrderMan2"}, }; real_cfg.sinks["console"] = diff --git a/src/lib/logging/logging.h b/src/lib/logging/logging.h index 0bfea9935..5842e2de1 100644 --- a/src/lib/logging/logging.h +++ b/src/lib/logging/logging.h @@ -24,7 +24,8 @@ constexpr log::Level Sys {log::Level::Max-1}; namespace log { -// Please keep this list in sync with Log.cs +// Please keep this list in sync with Log.cs and make sure +// to replicate the change in logging.cpp constexpr log::Subsystem Gen {0 }; constexpr log::Subsystem Cfg {Gen.ordinal+1 }; constexpr log::Subsystem QBus {Cfg.ordinal+1 }; @@ -46,6 +47,7 @@ constexpr log::Subsystem DataFlow {Latency.ordinal+1 }; constexpr log::Subsystem Plugin {DataFlow.ordinal+1 }; constexpr log::Subsystem ClientSdk {Plugin.ordinal+1 }; constexpr log::Subsystem Http {ClientSdk.ordinal+1 }; +constexpr log::Subsystem OrderMan2 {Http.ordinal+1 }; struct LoggerHandle { LoggerHandle(LoggerHandle const&) = delete; diff --git a/src/lib/orderman_v2/actors/Gateway.cpp b/src/lib/orderman_v2/actors/Gateway.cpp index f75acd074..362f20ed3 100644 --- a/src/lib/orderman_v2/actors/Gateway.cpp +++ b/src/lib/orderman_v2/actors/Gateway.cpp @@ -1,30 +1,506 @@ #include "lib/orderman_v2/actors/Gateway.h" -#include + +#include "lib/logging/logging.h" +#include "lib/orderman/limiter/Limiter.h" +#include "lib/orderman_v2/execution/ICancelMsg.h" +#include "lib/orderman_v2/execution/ICancelReplaceMsg.h" +#include "lib/orderman_v2/execution/ILimiter.h" +#include "lib/orderman_v2/execution/INewOrderSingleMsg.h" +#include "lib/orderman_v2/execution/IRouter.h" +#include "lib/orderman_v2/execution/IVenue.h" +#include "lib/orderman_v2/execution/UserAccountVenue.h" +#include "lib/utils/bts_chrono.h" + #include +#include namespace bts { namespace orderman_v2 { -struct GW_OrderRecord2 {}; -using OrderMap = std::map; +struct GW_OrderRecord { + GW_OrderRecord(OM_ID om_id, GW_BoundOrder const &order) + : order(order), cancel_replace(nullptr), cancel(nullptr), + originator(om_id) {} + GW_BoundOrder order; + ICancelReplaceMsg *cancel_replace; + ICancelMsg *cancel; + OM_ID originator; -struct AndDuck {int x;}; + void clear_msgs() { + cancel_replace = nullptr; + cancel = nullptr; + } -struct Gateway::PImpl { - IVenueConnection &venue; - OrderMap orders; - boost::object_pool orec_pool {1024*1024*20}; + bool is_routable() const { return cancel_replace != nullptr; } + + void set_msgs(ICancelReplaceMsg const &cr, ICancelMsg &can) { + cancel_replace = &cr.clone(); + cancel = &can.clone(); + } }; -Gateway::Gateway(IVenueConnection &venue) : - on_native_order_update(this), - on_unknown_native_order_update(this), - on_gw_error(this), - me(new PImpl{venue,{}}) -{} +enum class Gateway::State { + W_BOOTSTRAP, + W_SCHEDULE, + PAUSED, + W_LOGON, + READY, + W_LOGOUT +}; + +struct Gateway::Hot { + using OrderMap = std::unordered_map; + using MsgTemplatesMap = + std::unordered_map; + + Hot(IVenue &v, ILimiter &l) + : state(State::W_BOOTSTRAP), venue(v), limiter(l), working_orders(), + msg_templates(), orec_pool(1024 * 1024) {} + + State state; + IVenue &venue; + ILimiter &limiter; + OrderMap working_orders; + MsgTemplatesMap msg_templates; + boost::container::small_vector pending_msg; + boost::object_pool orec_pool; +}; + +struct Gateway::Cold { + Cold(IRouter &r, IClock &c, GatewayCfg const &cfg) + : router(r), clock(c), admin_data(), cfg(cfg), start_of_pause(), + current_exponential_backoff(0), bootstrap_orders() {} + IRouter &router; + IClock &clock; + api::admin::AdminData const *admin_data; + GatewayCfg cfg; + TimeStamp start_of_pause; + size_t current_exponential_backoff; + std::pair venue_session; + std::map *> bootstrap_orders; +}; + +struct Gateway::PImpl { + PImpl(IVenue &v, ILimiter &l, IRouter &r, IClock &c, GatewayCfg const &cfg) + : hot(v, l), cold(r, c, cfg) {} + Hot hot; + Cold cold; +}; + +Gateway::Gateway(IVenue &v, ILimiter &l, IRouter &r, IClock &c, + GatewayCfg const &cfg) + : on_order_report(this), on_unknown_native_order_update(this), + on_gw_error(this), me(new PImpl(v, l, r, c, cfg)) {} Gateway::~Gateway() {} +void Gateway::do_slow_work() { + switch (me->hot.state) { + case State::W_BOOTSTRAP: + if (has_bootstrap_data()) { + transition(State::W_SCHEDULE); + setup_bootstrap_orders(); + } + break; + case State::W_SCHEDULE: + me->cold.venue_session = me->hot.venue.get_current_session(); + if (in_active_schedule()) { + me->cold.start_of_pause = me->cold.clock.now(); + transition(State::PAUSED); + } + break; + case State::PAUSED: { + auto now = me->cold.clock.now(); + if (sec_diff(now, me->cold.start_of_pause) > + (me->cold.cfg.pause_seconds + << me->cold.current_exponential_backoff)) { + transition(State::W_LOGOUT); + me->hot.venue.login(); + } + break; + } + case State::READY: { + if (!in_active_schedule()) { + me->hot.venue.logout(); + transition(State::W_LOGOUT); + } + break; + } + case State::W_LOGON: + case State::W_LOGOUT: + break; + } +} + +void Gateway::on_om_bootstrap_orders(OM_BootstrapOrders const &orders) { + auto &bso_map = me->cold.bootstrap_orders; + bts_assert(me->hot.state == State::W_BOOTSTRAP); + bts_assert(bso_map.size() < me->cold.cfg.om_count); + bts_assert(bso_map.count(orders.originator) == 0); + bts_assert(orders.target == me->cold.cfg.my_id); + bts_assert(orders.originator.value < me->cold.cfg.om_count); + bso_map[orders.originator] = orders.orders; +} + +void Gateway::on_gw_ops(const GW_Op_Batch &op_batch) { + op_batch.visit(*this); + send_pending_msg(); +} + +void Gateway::on_account_pnl(const AccountPnLUpdate &pnl) { + me->hot.limiter.update(pnl); +} + +void Gateway::on_position(const PositionUpdate &pos) { + me->hot.limiter.update(pos); +} + +void Gateway::on_excess_liquidity(const ExcessLiquidityUpdate &l) { + me->hot.limiter.update(l); +} + +void Gateway::on_admin_data(AdminDataUpdate const &admin) { + me->cold.admin_data = admin.admin_data; + me->hot.limiter.update(*me->cold.admin_data); + me->cold.router.update(*me->cold.admin_data); + + switch (me->hot.state) { + case State::W_BOOTSTRAP: + break; + default: + rebuild_msg_templates(); + } +} + +void Gateway::on_gw_op(OM_ID om_id, const GW_OrderCreate &create) { + auto &bound_order = create.bound_order; + bts_assert_d(me->hot.working_orders.count(bound_order.key) == 0); + + // Construct new order record + auto gw_rec = me->hot.orec_pool.construct(om_id, bound_order); + auto &order = gw_rec->order; + + GW_OrderReport reply; + switch (me->hot.state) { + case State::READY: { + + // Validate route + auto &msg_templates = me->hot.msg_templates; + INewOrderSingleMsg *new_order_single; + auto it = msg_templates.find(order.uav); + if (it == msg_templates.end()) { + reply.set_ack(GW_OP_Result::ERROR_NO_ROUTE); + break; + } + + // Set msgs in order record + new_order_single = &it->second.new_order->clone(); + gw_rec->set_msgs(*it->second.cancel_replace, *it->second.cancel); + + // Validate limit + auto lqt = me->hot.limiter.can_send_new_order( + order.uav.account, *order.security, order.side, order.quantity); + if (lqt.error()) { + reply.set_ack(lqt.result, lqt.message); + break; + } + + // Validate messaging limits + if (!me->hot.venue.under_messaging_limit()) { + reply.set_ack(GW_OP_Result::ERROR_MESSAGING_BREACH); + break; + } + + // All is good. Index the order record, copy the order params to + // the order message and queue the message for sending. + me->hot.working_orders.insert({bound_order.key, gw_rec}); + new_order_single->set_order_params(bound_order); + me->hot.pending_msg.push_back(new_order_single); + + // For speed we do not send acks for the operation until we hear + // from the exchange. + return; + } + default: + reply.set_ack(GW_OP_Result::ERROR_GATEWAY_DISCONNECTED); + break; + } + + // If we got to this point something went wrong and the creation of + // the order failed. We skip the indexing of the order record, + // since we will not need to lookup this order by key, and instead + // send out a order report that details the cause of the failure. + bts_assert_d(reply.last_ack.result != GW_OP_Result::OK); + gw_rec->clear_msgs(); + reply.last_ack.req_id = create.req_id; + reply.target = om_id; + reply.last_exe_report = gw_rec->order.last_exe_report; + reply.om_record = bound_order.om_record; + reply.gw_record = gw_rec; + on_order_report(reply); +} + +// When an order is recovered from disk or from the exchange (meaning +// the exchange sends a report on an order we do not have a record of +// creating) we are left in a situation where we have to create the +// order record that represents the order but we do not have to +// actually send the order. This is what the bind order operation is +// for. +void Gateway::on_gw_op(OM_ID om_id, const GW_OrderBind &bind) { + auto &order = bind.bound_order; + bts_assert_d(me->hot.working_orders.count(order.key) == 0); + + // Construct and index new order record + auto gw_rec = me->hot.working_orders[order.key]; + bts_assert(!gw_rec); + gw_rec = me->hot.orec_pool.construct(om_id, order); + + GW_OrderReport reply; + // Find the message templates for this UAV and clone them for this + // order + auto &msg_templates = me->hot.msg_templates; + auto it = msg_templates.find(order.uav); + if (it == msg_templates.end()) + reply.set_ack(GW_OP_Result::ERROR_NO_ROUTE); + + reply.last_ack.req_id = bind.req_id; + reply.target = om_id; + reply.last_exe_report = order.last_exe_report; + reply.om_record = order.om_record; + reply.gw_record = gw_rec; + on_order_report(reply); +} + +void Gateway::on_gw_op(OM_ID om_id, const GW_OrderQuickUpdate &quick_update) { + auto gw_rec = quick_update.gw_order_record; + auto &order = gw_rec->order; + + GW_OrderReport reply; + switch (me->hot.state) { + case State::READY: { + + // Make sure the order can be routed + if (!gw_rec->is_routable()) { + reply.set_ack(GW_OP_Result::ERROR_ORDER_IS_NOT_ACTIVE); + break; + } + + // Validate trading limits + auto delta_q = quick_update.quantity.value - order.quantity.value; + auto lqr = me->hot.limiter.can_update_order( + order.uav.account, *order.security, order.side, delta_q); + if (lqr.error()) { + reply.set_ack(lqr.result, lqr.message); + break; + } + + // Validate messaging limits + if (!me->hot.venue.under_messaging_limit()) { + reply.set_ack(GW_OP_Result::ERROR_MESSAGING_BREACH); + break; + } + order.price = quick_update.price; + order.quantity = quick_update.quantity; + gw_rec->cancel_replace->update(order); + me->hot.pending_msg.push_back(gw_rec->cancel_replace); + + // We do not send out a order report for performance + // reasons. Instead we delay the report until the exchange + // reponds our order update. + return; + } + default: + reply.set_ack(GW_OP_Result::ERROR_GATEWAY_DISCONNECTED); + break; + } + + // If we got here something went wrong and the update failed. This + // is the exceptional path and it should almost never happen. In + // this case we send out a new order report detailing the reasons + // for the failure. + bts_assert_d(reply.last_ack.result != GW_OP_Result::OK); + reply.last_ack.req_id = quick_update.req_id; + reply.target = om_id; + reply.last_exe_report = order.last_exe_report; + reply.om_record = order.om_record; + reply.gw_record = gw_rec; + on_order_report(reply); +} + +void Gateway::on_gw_op(OM_ID om_id, const GW_OrderCancel &cancel) { + auto gw_rec = cancel.gw_order_record; + auto last_er = gw_rec->order.last_exe_report; + auto &order = gw_rec->order; + + bts_assert_d(last_er); + + GW_OrderReport reply; + switch (me->hot.state) { + case State::READY: { + + // Make sure the order is routable + if (!gw_rec->is_routable()) { + reply.set_ack(GW_OP_Result::ERROR_NO_ROUTE); + break; + } + + gw_rec->cancel->update(order); + me->hot.pending_msg.push_back(gw_rec->cancel); + + // We do not send out a order report for performance + // reasons. Instead we delay the report until the exchange + // reponds to our cancel + return; + } + default: + reply.set_ack(GW_OP_Result::ERROR_GATEWAY_DISCONNECTED); + break; + } + + // If we got here something went wrong and the cancel failed. This + // is the exceptional path and it should almost never happen. In + // this case we send out a new order report detailing the reasons + // for the failure. + bts_assert_d(reply.last_ack.result != GW_OP_Result::OK); + reply.last_ack.req_id = cancel.req_id; + reply.target = om_id; + reply.last_exe_report = order.last_exe_report; + reply.om_record = order.om_record; + reply.gw_record = gw_rec; + on_order_report(reply); +} + +// The difference between a full update and a quick update is that in +// a full update we allow for the account / user to change. In this +// case we have to re-create the messages for cancel and update since +// these messages embed in them account and user specific information. +void Gateway::on_gw_op(OM_ID om_id, const GW_OrderFullUpdate &full_update) { + auto gw_rec = full_update.gw_order_record; + auto &order = gw_rec->order; + + GW_OrderReport reply; + switch (me->hot.state) { + case State::READY: { + + auto &msg_templates = me->hot.msg_templates; + auto it = msg_templates.find(order.uav); + if (it == msg_templates.end()) { + reply.set_ack(GW_OP_Result::ERROR_NO_ROUTE); + break; + } + + // Update existing record with the non quick parts of the full + // order update. There is a bit of inconsistency here. We are + // already setting the message tamplates, uav, moi and tif + // fields below, even though the quick update might later fail + // to set the quantity and price, leaving the order in a + // half-updated half not-updated state. This should be benign + // enough. + gw_rec->set_msgs(*it->second.cancel_replace, *it->second.cancel); + gw_rec->order.uav = full_update.uav; + gw_rec->order.moi = full_update.moi; + gw_rec->order.tif = full_update.tif; + + // Fake a quick update for the rest + GW_OrderQuickUpdate quick_update; + quick_update.gw_order_record = full_update.gw_order_record; + quick_update.quantity = full_update.quantity; + quick_update.price = full_update.price; + quick_update.req_id = full_update.req_id; + on_gw_op(om_id, quick_update); + } + default: + reply.set_ack(GW_OP_Result::ERROR_GATEWAY_DISCONNECTED); + break; + } + + // If we got to this point something went wrong and the update of + // the order failed. This should be very rare. In this case we send + // a reply right away. + bts_assert_d(reply.last_ack.result != GW_OP_Result::OK); + gw_rec->clear_msgs(); + reply.last_ack.req_id = full_update.req_id; + reply.target = om_id; + reply.last_exe_report = gw_rec->order.last_exe_report; + reply.om_record = order.om_record; + reply.gw_record = gw_rec; + on_order_report(reply); +} + +void Gateway::send_pending_msg() { + auto &pending = me->hot.pending_msg; + me->hot.venue.send(pending.data(), pending.data() + pending.size()); + pending.clear(); +} + +bool Gateway::has_bootstrap_data() const { + return me->cold.bootstrap_orders.size() == me->cold.cfg.om_count && + me->cold.admin_data != nullptr; +} + +bool Gateway::in_active_schedule() const { + auto now = me->cold.clock.now(); + return now >= me->cold.venue_session.first && + now < me->cold.venue_session.second; +} + +void Gateway::transition(State state) { + LOG(OrderMan, Info, "Transitioning gateway {} from {} to {}", + me->cold.cfg.my_id.value, state_name(me->hot.state), state_name(state)); + me->hot.state = state; +} + +void Gateway::rebuild_msg_templates() { + // First just rebuild our template cache + me->hot.msg_templates.clear(); + auto all_uav = me->hot.limiter.get_all_user_account_venue(); + for (auto const &uav : all_uav) { + auto rq = me->cold.router.get_route(uav); + if (rq.has_route) { + me->hot.msg_templates[uav] = + me->hot.venue.get_msg_templates(rq.routing_record); + } + } + + // Now go through every order and update its messages + for (auto &p : me->hot.working_orders) { + auto orec = p.second; + orec->clear_msgs(); + if (auto it = me->hot.msg_templates.find(orec->order.uav); + it != me->hot.msg_templates.end()) { + orec->set_msgs(*it->second.cancel_replace, *it->second.cancel); + } else { + LOG(OrderMan, Error, "Order {} can no longer be routed. {}", + orec->order.key, orec->order.uav.to_str()); + orec->clear_msgs(); + } + } +} + +void Gateway::setup_bootstrap_orders() { + bts_assert(me->hot.state == State::W_BOOTSTRAP); + for (auto [om_id, order_vec] : me->cold.bootstrap_orders) + for (auto &bind_order : *order_vec) + on_gw_op(om_id, bind_order); +} + +log::CharPtrWrapper Gateway::state_name(State state) { + switch (state) { + case State::W_BOOTSTRAP: + return {"W_BOOTSTRAP"}; + case State::W_SCHEDULE: + return {"W_SCHEDULE"}; + case State::PAUSED: + return {"PAUSED"}; + case State::W_LOGON: + return {"W_LOGON"}; + case State::READY: + return {"READY"}; + case State::W_LOGOUT: + return {"W_LOGOUT"}; + } +} + } // namespace orderman_v2 } // namespace bts diff --git a/src/lib/orderman_v2/actors/Gateway.h b/src/lib/orderman_v2/actors/Gateway.h index 4f435174c..9bad58a8a 100644 --- a/src/lib/orderman_v2/actors/Gateway.h +++ b/src/lib/orderman_v2/actors/Gateway.h @@ -1,38 +1,63 @@ #pragma once #include "Actor.h" -#include "lib/orderman_v2/events/events.h" #include "lib/orderman_v2/common.h" +#include "lib/orderman_v2/events/events.h" +#include "lib/orderman_v2/interconnect/ISlowWorker.h" #include "lib/orderman_v2/interconnect/Signal.h" +#include "lib/logging/logging.h" namespace bts { namespace orderman_v2 { -class IVenueConnection; +class IVenue; +class ILimiter; +class IRouter; +class IClock; -class Gateway : public Actor { -public: - Gateway(IVenueConnection &); +struct GatewayCfg; +class Gateway : public Actor, ISlowWorker, IGW_Op_Visitor { + public: + Gateway(IVenue &, ILimiter &, IRouter &, IClock &c, GatewayCfg const &); ~Gateway(); - - void do_work(); - //Inputs - void on_om_bootstrap_orders(OM_BootstrapOrders const&) {}; - void on_gw_ops (const GW_Op_Batch &) {}; - void on_account_pnl (const AccountPnLUpdate &) {} - void on_excess_liquidity (const ExcessLiquidityUpdate &) {} - void on_admin_data(const AdminDataUpdate &) {} - void on_position(const PositionUpdate &) {} - + void do_slow_work() override; + + // Inputs + void on_om_bootstrap_orders(OM_BootstrapOrders const &); + void on_gw_ops(const GW_Op_Batch &); + void on_account_pnl(const AccountPnLUpdate &); + void on_position(const PositionUpdate &); + void on_excess_liquidity(const ExcessLiquidityUpdate &); + void on_admin_data(const AdminDataUpdate &); + // Signals - Signal on_native_order_update; + Signal on_order_report; Signal on_unknown_native_order_update; Signal on_gw_error; -private: + private: + enum class State; struct PImpl; + struct Hot; + struct Cold; std::unique_ptr me; + + // Destructuring of GW_Op_Batch + void on_gw_op(OM_ID, const GW_OrderCreate &) override; + void on_gw_op(OM_ID, const GW_OrderBind &) override; + void on_gw_op(OM_ID, const GW_OrderQuickUpdate &) override; + void on_gw_op(OM_ID, const GW_OrderCancel &) override; + void on_gw_op(OM_ID, const GW_OrderFullUpdate &) override; + + void send_pending_msg(); + bool has_bootstrap_data() const; + bool in_active_schedule() const; + void transition(State); + void rebuild_msg_templates(); + void setup_bootstrap_orders(); + static log::CharPtrWrapper state_name(State) ; }; -}} +} // namespace orderman_v2 +} // namespace bts diff --git a/src/lib/orderman_v2/actors/OrderManager.h b/src/lib/orderman_v2/actors/OrderManager.h index 592a6a216..91add881f 100644 --- a/src/lib/orderman_v2/actors/OrderManager.h +++ b/src/lib/orderman_v2/actors/OrderManager.h @@ -14,7 +14,7 @@ public: // Inputs void on_bootstrap_orders(BootstrapOrders) {} - void on_native_order_update (GW_ExeReport const&) {} + void on_native_order_update (GW_OrderReport const&) {} void on_unknown_native_order_update(GW_UnknownOrderExeReport const&) {} void on_create_order (CreateOrderRequest const&) {} void on_update_order (UpdateOrderRequest const&) {} diff --git a/src/lib/orderman_v2/common.cpp b/src/lib/orderman_v2/common.cpp new file mode 100644 index 000000000..ddef6fc94 --- /dev/null +++ b/src/lib/orderman_v2/common.cpp @@ -0,0 +1,2 @@ +#include "common.h" + diff --git a/src/lib/orderman_v2/common.h b/src/lib/orderman_v2/common.h index 4daf47342..77b8d1e38 100644 --- a/src/lib/orderman_v2/common.h +++ b/src/lib/orderman_v2/common.h @@ -6,6 +6,8 @@ #include "lib/domain_model/common.h" #include "lib/md/PriceSize.h" #include "lib/utils/ValueWrapper.h" +#include "lib/utils/bts_chrono.h" + #include #include @@ -22,7 +24,7 @@ struct hash> { return hash()(k.value); } }; -} +} // namespace std namespace bts { namespace orderman_v2 { @@ -43,20 +45,36 @@ std::ostream &operator<<(std::ostream &s, Value const &v) { } using BookSide = std::array; -using OrderKey = Value; -using Price = Value; -using Quantity = Value; -using OM_Id = Value; -using GW_Id = Value; -using RequestID = Value; -using UserID = Value; -using AccountID = Value; -using SecurityKey = Value; -using Side = Value; -using ManualOrderIndicator = Value; -using TimeInForce = Value; +using OrderKey = Value; +using Price = Value; +using Quantity = Value; +using OM_ID = Value; +using GW_ID = Value; +using OM_Request_ID = Value; +using GW_Request_ID = Value; +using UserID = Value; +using AccountID = Value; +using SecurityKey = Value; +using Side = Value; +using ManualOrderIndicator = Value; +using TimeInForce = Value; -enum class OrderStatus : uint8_t { WORKING, COMPLETED, CANCELED }; +enum class OrderStatus : uint8_t { WORKING, COMPLETED, CANCELED, REJECTED }; + +enum GW_OP_Result { + OK, + ERROR_NO_ROUTE, + ERROR_MESSAGING_BREACH, + ERROR_GATEWAY_DISCONNECTED, + ERROC_SEC_LONG_POS_BREACHED, + ERROR_PROD_LONG_POS_BREACHED, + ERROR_SEC_SHORT_POS_BREACHED, + ERROR_PROD_SHORT_POS_BREACHED, + ERROR_CLIP_SIZE_BREACHED, + ERROR_LOSS_LIMIT_BREACHED, + ERROR_MARGIN_LIMIT_BREACHED, + ERROR_ORDER_IS_NOT_ACTIVE +}; class Book { public: @@ -96,5 +114,10 @@ class Book { std::array _book; }; +class IClock { + public: + virtual TimeStamp now() = 0; +}; + } // namespace orderman_v2 } // namespace bts diff --git a/src/lib/orderman_v2/doc/orderman_v2_notes.org b/src/lib/orderman_v2/doc/orderman_v2_notes.org index b50ab2d58..9e4df9e7a 100644 --- a/src/lib/orderman_v2/doc/orderman_v2_notes.org +++ b/src/lib/orderman_v2/doc/orderman_v2_notes.org @@ -1,8 +1,10 @@ +* Header #+TITLE: V2 docs #+OPTIONS: ^:nil #+OPTIONS: H:2 #+OPTIONS: ^:nil H:2 author:nil creator:nil timestamp:nil toc:nil #+OPTIONS: html-postamble:nil + * Data flow #+begin_src dot :file data_flow.png :cmdline -Kdot -Tpng digraph G { @@ -36,13 +38,17 @@ digraph G { [[file:algo_flow.png]] * NewOrder -** Known at startup +** Immutable +BeginString = FIX.4.2 8=FIX.4.2 +MsgType = NewOrderSingle 35=D +** When fields are known +*** Known at startup BeginString = FIX.4.2 8=FIX.4.2 MsgType = NewOrderSingle 35=D TargetCompID = CME 56=CME TargetSubID = 80 57=80 SenderCompID = DE7534N 49=DE7534N -** Derivable from hash of routing record +*** Derivable from account and user SenderLocationID = US,IL 142=US,IL SenderSubID = DO3BTSJGR 50=DO3BTSJGR Account = CLX60635 1=CLX60635 @@ -50,15 +56,15 @@ Account = CLX60635 1=CLX60635 1028 = N 1028=N CustomerOrFirm = 0 204=0 7928 = 6935102 7928=6935102 -** Known at stamp +*** Known at stamp BodyLength = 000257 9=000257 MsgSeqNum = 000000113 34=000000113 LastMsgSeqNumProcessed = 000000110 369=000000110 CheckSum = 018 10=018 -** Known when clock ticks +*** Known when clock ticks TransactTime = 20190804-22:11:06.592 60=20190804-22:11:06.592 SendingTime = 20190804-22:11:06.602 52=20190804-22:11:06.602 -** Known when order is known +*** Known when order is known SecurityDesc = HOU9-HOX9 107=HOU9-HOX9 Side = 2 54=2 TimeInForce = 0 59=0 @@ -66,7 +72,7 @@ ClOrdID = 00000101730000432660 11=00000101730000432 OrderQty = 000001 38=000001 OrdType = 2 40=2 Price = -0000093.00000000 44=-0000093.00000000 -* Whole thing +** Whole thing BeginString = FIX.4.2 8=FIX.4.2 BodyLength = 000257 9=000257 MsgType = NewOrderSingle 35=D @@ -93,62 +99,37 @@ OrdType = 2 40=2 Price = -0000093.00000000 44=-0000093.00000000 CheckSum = 018 10=018 -* Structure -** Header: -- BeginString -- *BodyLength* -- MsgType -- *MsgSeqNum* -- *LastMsgSeqNumProcessed* -- *SendingTime* -- TargetCompID -- TargetSubID -- SenderCompID -** Routing: -- SenderLocationID -- SenderSubID -- Account -- 0702 -- 1028 -- CustomerOrFirm -- 7928 -** Body -- Side -- TimeInForce -- ClOrdID -- OrdQty -- OrdType -- Price -- TransactTime -** Footer -- SecurityDesc -- Checksum - -* Field sources -| BeginString | | -| MsgType | | -| SenderCompID | | -| TargetCompID | | -| 9702 | | -| 7928 | | -| TargetSubID | | -| SendingTime | clock | -| TransactTime | clock | -| CustomerOrFirm | user/account/venue | -| SenderSubID | user/account/venue | -| SenderLocationID | user/account/venue | -| Account | user/account/venue | -| Side | Order | -| TimeInForce | Order | -| 1028 | Order | -| SecurityDesc | Order | -| ClOdID | Order | -| OrderQty | Order | -| Price | Order | -| BodyLength | finished msg | -| MsgSeqNum | finished msg | -| LastMsg | finished msg | -| CheckSum | finished msg | -* Dimensioning -- executor count +* Bootstrap process +** GWs +Gateways will wait until they have: +- The list of all boostrap orders, that is orders that are currently thought to be active +- The admin object +- Filled position +* Quick Notes +- when creating or binding orders the gw will reply to the create/bind with a execution report that contains the record key +- this could mean that the OM will have to buffer any updates until it receives this execution report +- the alternative is to fallback to keys to look up the order. This should be OK, since the branch should be totally predictable +* To discuss with Taha +- Full positions are now calculated outside the OM +* On limiter enforcing +- Because we now have potentially multiple threads generating updates to the working position it is no longer possible for the order manager, now the gateway, to assume it knows all the working positions. We have two options here, we can either use shared state and have all the threads coordinate access to it, or we can have the full position (filled + working) to be computed elsewhere. Since we are already late in observing the filled position we are really no worse off by also being late in observing the filled position. So we opt for having it all entirely computed elsewhere. +* Work Log +** <2019-11-25 Mon> +*** Goals +- Make substantial headway into Gateway +*** Work +**** Gateway +:LOGBOOK: +CLOCK: [2019-11-25 Mon 09:29] +:END: +** <2019-11-24 Sun> +Improved the way we calculate fix tag strings and crc at runtime, droppnig the metaprogramming machinery in favour of a constexpr function +** <2019-11-23 Sat> +Worked a little on the gateway. +1) We can distinguish full updates from quick updates. Full updates can update anything that is updatable, but quick updates can only update price and size. Full updates result in obtaining new IMessage pointers +2) We should have an async call added to the api, maybe something like this: + do_async(action_to_do, cb_when_complete); +3) It might be necessary to bring back on_before_launch and in general keep the API stable. It will be a lot of work if there substantial changes. +4) I need to keep a log of the work, with a single place for notes. + diff --git a/src/lib/orderman_v2/events/events.h b/src/lib/orderman_v2/events/events.h index 5205970cd..6f93751fb 100644 --- a/src/lib/orderman_v2/events/events.h +++ b/src/lib/orderman_v2/events/events.h @@ -1,14 +1,22 @@ #pragma once #include "lib/orderman_v2/common.h" +#include "lib/orderman_v2/execution/ExecReport.h" #include "lib/orderman_v2/interconnect/Action.h" +#include "lib/orderman_v2/execution/UserAccountVenue.h" #include namespace bts { namespace orderman_v2 { -class GW_OrderRecord; -class OM_NativeOrderRecord; -class IExecReport; +struct GW_OrderRecord; +struct OM_NativeOrderRecord; +class ExecReport; + +struct GatewayCfg { + uint8_t om_count; + GW_ID my_id; + int pause_seconds; +}; template constexpr bool meets_event_constraints() { return std::is_trivial::value && sizeof(EV) <= MaxEventSize; @@ -50,54 +58,37 @@ struct SecurityStatusUpdate { static_assert(meets_event_constraints()); struct PositionUpdate { - SecurityKey key; + api::Security *const security; AccountID account_id; Quantity long_quantity; Quantity short_quantity; }; static_assert(meets_event_constraints()); - -struct CommonOrderState { - OrderKey order_key; - Price price; - Quantity quantity; - Quantity total_fills; - Price avg_price; - Quantity last_fills; - Price last_price; - OrderStatus status; +struct GW_Op_Ack { + GW_OP_Result result; + GW_Request_ID req_id; + char const* message; }; -struct GW_ExeReport { - CommonOrderState common; - IExecReport const *last_report; - OM_NativeOrderRecord const *om_record; - GW_OrderRecord const *gw_record; - OM_Id target; -}; -static_assert(meets_event_constraints()); - struct GW_UnknownOrderExeReport { - CommonOrderState common; - api::Security const*security; - GW_Id source_gw; - IExecReport const *last_report; + api::Security const *security; + GW_ID source_gw; + ExecReport const *last_exe_report; }; static_assert(meets_event_constraints()); struct OM_OrderUpdate { - CommonOrderState common; OrderKey parent_key; - IExecReport const *last_report; + ExecReport const *last_exe_report; api::orderman::OrderDefinition const *def; const char *last_msg; }; static_assert(meets_event_constraints()); struct CreateOrderRequest { - OM_Id target; - RequestID request_id; + OM_ID target; + OM_Request_ID request_id; Price price; Quantity quantity; api::orderman::OrderDefinition const *def; @@ -105,8 +96,8 @@ struct CreateOrderRequest { static_assert(meets_event_constraints()); struct UpdateOrderRequest { - OM_Id target; - RequestID request_id; + OM_ID target; + OM_Request_ID request_id; OrderKey key; Price price; Quantity quantity; @@ -115,15 +106,15 @@ struct UpdateOrderRequest { static_assert(meets_event_constraints()); struct CancelOrderRequest { - OM_Id target; - RequestID request_id; + OM_ID target; + OM_Request_ID request_id; OrderKey key; }; static_assert(meets_event_constraints()); struct DetachOrderRequest { - OM_Id target; - RequestID request_id; + OM_ID target; + OM_Request_ID request_id; OrderKey key; }; static_assert(meets_event_constraints()); @@ -137,43 +128,85 @@ enum GW_Op_Code : uint8_t { BIND }; -struct GW_OrderCreate { - static const auto code = GW_Op_Code::CREATE; - api::Security const*security; +struct GW_OrderReport; + +struct GW_BoundOrder { + api::Security const *security; OM_NativeOrderRecord const *om_record; + ExecReport const *last_exe_report; OrderKey key; - UserID user_id; - AccountID account_id; + UserAccountVenue uav; Price price; Quantity quantity; - Side side; ManualOrderIndicator moi; TimeInForce tif; + Side side; +}; + +struct GW_OrderCreate { + static const auto code = GW_Op_Code::CREATE; + GW_BoundOrder bound_order; + GW_Request_ID req_id; +}; + +struct GW_OrderBind { + static const auto code = GW_Op_Code::BIND; + GW_BoundOrder bound_order; + GW_Request_ID req_id; }; struct GW_OrderQuickUpdate { static const auto code = GW_Op_Code::QUICK_UPDATE; - GW_OrderRecord *order_record; + GW_OrderRecord *gw_order_record; Quantity quantity; Price price; + GW_Request_ID req_id; +}; + +struct GW_OrderFullUpdate { + static const auto code = GW_Op_Code::FULL_UPDATE; + GW_OrderRecord *gw_order_record; + Quantity quantity; + Price price; + ManualOrderIndicator moi; + TimeInForce tif; + UserAccountVenue uav; + GW_Request_ID req_id; }; struct GW_OrderCancel { static const auto code = GW_Op_Code::CANCEL; - GW_OrderRecord *order_record; + GW_OrderRecord *gw_order_record; + GW_Request_ID req_id; }; +struct GW_OrderReport { + ExecReport const *last_exe_report; + OM_NativeOrderRecord const *om_record; + GW_OrderRecord const *gw_record; + GW_Op_Ack last_ack; + OM_ID target; + + void set_ack(GW_OP_Result result, const char*message=nullptr) { + last_ack.result = result; + last_ack.message = message; + } +}; +static_assert(meets_event_constraints()); + class IGW_Op_Visitor { public: - virtual void on(GW_OrderCreate &) = 0; - virtual void on(GW_OrderQuickUpdate &) = 0; - virtual void on(GW_OrderCancel &) = 0; + virtual void on_gw_op(OM_ID, const GW_OrderCreate &) = 0; + virtual void on_gw_op(OM_ID, const GW_OrderQuickUpdate &) = 0; + virtual void on_gw_op(OM_ID, const GW_OrderCancel &) = 0; + virtual void on_gw_op(OM_ID, const GW_OrderFullUpdate &) = 0; + virtual void on_gw_op(OM_ID, const GW_OrderBind &) = 0; }; struct GW_Op_Batch { struct Header { - OM_Id originator; - GW_Id target; + OM_ID originator; + GW_ID target; uint8_t n_msgs; } header; @@ -195,27 +228,31 @@ struct GW_Op_Batch { } template - void consume(IGW_Op_Visitor &v, uint8_t* &buffer) { - v.on(*((OP*) (buffer+1))); - buffer+= (1+sizeof(OP)); + void consume(IGW_Op_Visitor &v, uint8_t const *&buffer) const { + v.on_gw_op(header.originator, *((OP *)(buffer + 1))); + buffer += (1 + sizeof(OP)); } - void visit(IGW_Op_Visitor &v) { + void visit(IGW_Op_Visitor &v) const { auto n_msgs = header.n_msgs; auto cursor = buffer.data(); while (n_msgs--) { - auto op_code = (GW_Op_Code)* (cursor); + auto op_code = (GW_Op_Code) * (cursor); switch (op_code) { - case GW_Op_Code::CREATE: - consume(v,cursor); - break; case GW_Op_Code::QUICK_UPDATE: - consume(v,cursor); + consume(v, cursor); + break; + case GW_Op_Code::CREATE: + consume(v, cursor); break; case GW_Op_Code::CANCEL: - consume(v,cursor); + consume(v, cursor); break; - default: + case GW_Op_Code::FULL_UPDATE: + consume(v, cursor); + break; + case GW_Op_Code::BIND: + consume(v, cursor); break; } } @@ -226,27 +263,32 @@ static_assert(meets_event_constraints()); // Order Ops struct OM_BootstrapOrders { - OM_Id originator; - GW_Id target; - std::vector *orders; + OM_ID originator; + GW_ID target; + std::vector *orders; }; struct GW_Status { - GW_Id gw; + GW_ID gw; bool connected; }; static_assert(meets_event_constraints()); struct GW_Error { - GW_Id gw; - enum uint8_t { CANCEL_REJECT, BUSSINESS_REJECT, SESSION_REJECT, DISCONNECT } error; + GW_ID gw; + enum uint8_t { + CANCEL_REJECT, + BUSSINESS_REJECT, + SESSION_REJECT, + DISCONNECT + } error; const char *error_msg; OrderKey order_key; }; static_assert(meets_event_constraints()); struct OM_Reply { - RequestID req_id; + OM_Request_ID req_id; const char *error_msg; bool success; }; diff --git a/src/lib/orderman_v2/execution/ExecReport.h b/src/lib/orderman_v2/execution/ExecReport.h new file mode 100644 index 000000000..a794d8280 --- /dev/null +++ b/src/lib/orderman_v2/execution/ExecReport.h @@ -0,0 +1,20 @@ +#pragma once +#include "lib/orderman_v2/common.h" + + +namespace bts { +namespace orderman_v2 { + +class ExecReport { +public: + OrderKey order_key; + Price price; + Quantity quantity; + Quantity total_fills; + Price avg_price; + Quantity last_fills; + Price last_price; + OrderStatus status; +}; + +}} diff --git a/src/lib/orderman_v2/execution/ICancelMsg.cpp b/src/lib/orderman_v2/execution/ICancelMsg.cpp new file mode 100644 index 000000000..97af203d7 --- /dev/null +++ b/src/lib/orderman_v2/execution/ICancelMsg.cpp @@ -0,0 +1 @@ +#include "ICancelMsg.h" diff --git a/src/lib/orderman_v2/execution/ICancelMsg.h b/src/lib/orderman_v2/execution/ICancelMsg.h new file mode 100644 index 000000000..d4aa11aad --- /dev/null +++ b/src/lib/orderman_v2/execution/ICancelMsg.h @@ -0,0 +1,17 @@ +#pragma once +#include +#include "lib/orderman_v2/execution/IVenueMsg.h" + +namespace bts { +namespace orderman_v2 { + +struct GW_BoundOrder; + +class ICancelMsg : public IVenueMsg { + public: + virtual ICancelMsg& clone() const; + virtual void update(GW_BoundOrder const&) const; + virtual ~ICancelMsg() {} +}; + +}} diff --git a/src/lib/orderman_v2/execution/ICancelReplaceMsg.cpp b/src/lib/orderman_v2/execution/ICancelReplaceMsg.cpp new file mode 100644 index 000000000..533d0a862 --- /dev/null +++ b/src/lib/orderman_v2/execution/ICancelReplaceMsg.cpp @@ -0,0 +1 @@ +#include "ICancelReplaceMsg.h" diff --git a/src/lib/orderman_v2/execution/ICancelReplaceMsg.h b/src/lib/orderman_v2/execution/ICancelReplaceMsg.h new file mode 100644 index 000000000..20042d55c --- /dev/null +++ b/src/lib/orderman_v2/execution/ICancelReplaceMsg.h @@ -0,0 +1,17 @@ +#pragma once +#include +#include "lib/orderman_v2/execution/IVenueMsg.h" + +namespace bts { +namespace orderman_v2 { + +struct GW_BoundOrder; + +class ICancelReplaceMsg : public IVenueMsg { + public: + virtual void update(GW_BoundOrder const&); + virtual ICancelReplaceMsg& clone() const = 0; + virtual ~ICancelReplaceMsg() {} +}; + +}} diff --git a/src/lib/orderman_v2/execution/ILimiter.cpp b/src/lib/orderman_v2/execution/ILimiter.cpp new file mode 100644 index 000000000..4b8fc03aa --- /dev/null +++ b/src/lib/orderman_v2/execution/ILimiter.cpp @@ -0,0 +1 @@ +#include "ILimiter.h" diff --git a/src/lib/orderman_v2/execution/ILimiter.h b/src/lib/orderman_v2/execution/ILimiter.h new file mode 100644 index 000000000..463f22c7f --- /dev/null +++ b/src/lib/orderman_v2/execution/ILimiter.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include "lib/orderman_v2/common.h" + +namespace bts { +namespace api {namespace admin { class AdminData; }} + +namespace orderman_v2 { + +struct AccountPnLUpdate; +struct PositionUpdate; +struct ExcessLiquidityUpdate; +struct UserAccountVenue; + +class ILimiter { + public: + + struct LimiterQueryResult { + GW_OP_Result result; + char const*message; + bool ok() const { return result == GW_OP_Result::OK; } + bool error() const { return !ok(); } + }; + + virtual LimiterQueryResult can_send_new_order(AccountID account, + api::Security const &sec, + Side side, Quantity quantity); + + virtual LimiterQueryResult can_update_order(AccountID account, + api::Security const &sec, + Side side, double delta); + + virtual void update(api::admin::AdminData const &admin); + virtual void update(AccountPnLUpdate const &) = 0; + virtual void update(PositionUpdate const &) = 0; + virtual void update(ExcessLiquidityUpdate const &) = 0; + virtual std::vector get_all_user_account_venue() const = 0; +}; + +}} diff --git a/src/lib/orderman_v2/execution/INewOrderSingleMsg.cpp b/src/lib/orderman_v2/execution/INewOrderSingleMsg.cpp new file mode 100644 index 000000000..3514a6bb8 --- /dev/null +++ b/src/lib/orderman_v2/execution/INewOrderSingleMsg.cpp @@ -0,0 +1 @@ +#include "INewOrderSingleMsg.h" diff --git a/src/lib/orderman_v2/execution/INewOrderSingleMsg.h b/src/lib/orderman_v2/execution/INewOrderSingleMsg.h new file mode 100644 index 000000000..fd2217ef1 --- /dev/null +++ b/src/lib/orderman_v2/execution/INewOrderSingleMsg.h @@ -0,0 +1,17 @@ +#pragma once +#include +#include "lib/orderman_v2/execution/IVenueMsg.h" + +namespace bts { +namespace orderman_v2 { + +struct GW_BoundOrder; + +class INewOrderSingleMsg : public IVenueMsg { + public: + virtual INewOrderSingleMsg & clone() const; + virtual void set_order_params(GW_BoundOrder const&); + virtual ~INewOrderSingleMsg() {} +}; + +}} diff --git a/src/lib/orderman_v2/execution/IRouter.cpp b/src/lib/orderman_v2/execution/IRouter.cpp new file mode 100644 index 000000000..41df46a41 --- /dev/null +++ b/src/lib/orderman_v2/execution/IRouter.cpp @@ -0,0 +1 @@ +#include "IRouter.h" diff --git a/src/lib/orderman_v2/execution/IRouter.h b/src/lib/orderman_v2/execution/IRouter.h new file mode 100644 index 000000000..be53314c7 --- /dev/null +++ b/src/lib/orderman_v2/execution/IRouter.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include "lib/api/services/OrderService.pb.h" + +namespace bts { + +namespace api {namespace admin {class AdminData;}} + +namespace orderman_v2 { +struct UserAccountVenue; + +class IRouter { + public: + virtual void update(api::admin::AdminData const &admin); + + struct RouteQueryResult { + bool has_route; + std::string error_msg; + api::orderman::RoutingRecord routing_record; + }; + virtual RouteQueryResult get_route(UserAccountVenue const &) = 0; +}; +}} diff --git a/src/lib/orderman_v2/execution/IVenue.cpp b/src/lib/orderman_v2/execution/IVenue.cpp new file mode 100644 index 000000000..367bd538d --- /dev/null +++ b/src/lib/orderman_v2/execution/IVenue.cpp @@ -0,0 +1 @@ +#include "IVenue.h" diff --git a/src/lib/orderman_v2/execution/IVenue.h b/src/lib/orderman_v2/execution/IVenue.h new file mode 100644 index 000000000..9015e07f1 --- /dev/null +++ b/src/lib/orderman_v2/execution/IVenue.h @@ -0,0 +1,33 @@ +#pragma once +#include "lib/utils/bts_chrono.h" + +namespace bts { +namespace api {namespace orderman { class RoutingRecord;}} + +namespace orderman_v2 { + +class ExeReport; + +class INewOrderSingleMsg; +class ICancelReplaceMsg; +class ICancelMsg; +class IVenueMsg; + +struct MsgTemplates { + INewOrderSingleMsg* new_order; + ICancelReplaceMsg* cancel_replace; + ICancelMsg* cancel; +}; + +class IVenue { + public: + virtual std::pair get_current_session() = 0; + virtual void logout() = 0; + virtual void login() = 0; + virtual MsgTemplates + get_msg_templates(api::orderman::RoutingRecord const &) = 0; + virtual bool under_messaging_limit() = 0; + virtual void send(IVenueMsg**begin, IVenueMsg**end); +}; + +}} diff --git a/src/lib/orderman_v2/execution/IVenueMsg.cpp b/src/lib/orderman_v2/execution/IVenueMsg.cpp new file mode 100644 index 000000000..4a19b85f0 --- /dev/null +++ b/src/lib/orderman_v2/execution/IVenueMsg.cpp @@ -0,0 +1,2 @@ +#include "IVenueMsg.h" + diff --git a/src/lib/orderman_v2/execution/IVenueMsg.h b/src/lib/orderman_v2/execution/IVenueMsg.h new file mode 100644 index 000000000..4637de959 --- /dev/null +++ b/src/lib/orderman_v2/execution/IVenueMsg.h @@ -0,0 +1,12 @@ +#pragma once + + +namespace bts { +namespace orderman_v2 { + +class IVenueMsg { +public: + virtual ~IVenueMsg() {} +}; + +}} diff --git a/src/lib/orderman_v2/execution/IVenueObserver.h b/src/lib/orderman_v2/execution/IVenueObserver.h new file mode 100644 index 000000000..d781df4fd --- /dev/null +++ b/src/lib/orderman_v2/execution/IVenueObserver.h @@ -0,0 +1,13 @@ +#prama once + +namespace bts { +namespace orderman_v2 { + +class IVenueObserver { +public: + virtual void on_venue_logon() = 0; + virtual void on_venue_logout() = 0; + virtual void on_venue_logon_failure() = 0; +}; + +}} diff --git a/src/lib/orderman_v2/execution/UserAccountVenue.h b/src/lib/orderman_v2/execution/UserAccountVenue.h new file mode 100644 index 000000000..9501005db --- /dev/null +++ b/src/lib/orderman_v2/execution/UserAccountVenue.h @@ -0,0 +1,34 @@ +#pragma once +#include +#include +#include + +namespace bts { +namespace orderman_v2 { + +struct UserAccountVenue { + UserID user; + AccountID account; + api::Venue venue; + bool operator==(UserAccountVenue const &rhs) const { + return user == rhs.user && account == rhs.account && venue == rhs.venue; + } + + std::string to_str() { + return fmt::format (" user_id: {} account_id: {} venue: {}", + user.value, + account.value, + api::Venue_Name(venue)); + } +}; + +struct UserAccountVenueHash { + std::size_t operator()(UserAccountVenue const &k) const { + size_t result = k.user.value; + boost::hash_combine(result, k.account.value); + boost::hash_combine(result, k.venue); + return result; + } +}; + +}} diff --git a/src/lib/orderman_v2/fix/Fields.h b/src/lib/orderman_v2/fix/Fields.h index 8580b9f05..533e96c6c 100644 --- a/src/lib/orderman_v2/fix/Fields.h +++ b/src/lib/orderman_v2/fix/Fields.h @@ -137,6 +137,8 @@ template class FIXFragment { sealed_crc + hole_crc}; } + FIXFragment& operator=(const FIXFragment&src) = default; + private: uint64_t sealed_crc; uint64_t hole_crc; diff --git a/src/lib/orderman_v2/interconnect/Orchestrator.cpp b/src/lib/orderman_v2/interconnect/Orchestrator.cpp index a38670701..04cee3626 100644 --- a/src/lib/orderman_v2/interconnect/Orchestrator.cpp +++ b/src/lib/orderman_v2/interconnect/Orchestrator.cpp @@ -54,6 +54,10 @@ Orchestrator::Orchestrator(md::MDConsumer &md, void Orchestrator::create_actors(config::OrderManThreadingCfg const &cfg) { + ILimiter *limiter = nullptr; + IRouter *router = nullptr; + IClock *clock = nullptr; + for (auto const &t_cfg : cfg.thread()) { auto thread = get_thread(t_cfg.name(), t_cfg.poll(), t_cfg.slow_worker_period()); @@ -66,7 +70,8 @@ void Orchestrator::create_actors(config::OrderManThreadingCfg const &cfg) { thread->add_actor()}); else if (actor_name == "gateway") me->gateways.push_back(thread->add_actor( - get_venue_connection(actor_desc.arg(0)))); + get_venue_connection(actor_desc.arg(0)), *limiter, *router,*clock, + GatewayCfg{})); else if (actor_name == "sorage") { bts_assert_msg(!me->storage, "Duplicate storage actor in OrderManThreadingCfg"); @@ -195,7 +200,7 @@ void Orchestrator::wire_order_managers() { void Orchestrator::wire_gateways() { for (auto gw : me->gateways) { // GW_OrderUpdate - gw->on_native_order_update.route_to( + gw->on_order_report.route_to( [](auto const &o) { return o.target.value; }, me->collect_om_fwds<&OrderManager::on_native_order_update>()); @@ -221,8 +226,8 @@ Thread *Orchestrator::get_thread(std::string const &name, bool poll, return thread.get(); } -IVenueConnection &Orchestrator::get_venue_connection(std::string const &) { - IVenueConnection *ptr = nullptr; +IVenue &Orchestrator::get_venue_connection(std::string const &) { + IVenue *ptr = nullptr; return *ptr; } diff --git a/src/lib/orderman_v2/interconnect/Orchestrator.h b/src/lib/orderman_v2/interconnect/Orchestrator.h index aeb4f0268..6db035825 100644 --- a/src/lib/orderman_v2/interconnect/Orchestrator.h +++ b/src/lib/orderman_v2/interconnect/Orchestrator.h @@ -15,7 +15,7 @@ class OrderManThreadingCfg; namespace orderman_v2 { class Thread; -class IVenueConnection; +class IVenue; class Orchestrator { public: @@ -36,7 +36,7 @@ class Orchestrator { void wire_gateways(); Thread *get_thread(std::string const &name, bool poll, uint32_t slow_worker_period); - IVenueConnection &get_venue_connection(std::string const&jf_session); + IVenue &get_venue_connection(std::string const&jf_session); }; } // namespace orderman_v2 diff --git a/src/server/sparkd/cmds/benchmarks/fix_gen_bm.cpp b/src/server/sparkd/cmds/benchmarks/fix_gen_bm.cpp index 39727c31f..9608a76e0 100644 --- a/src/server/sparkd/cmds/benchmarks/fix_gen_bm.cpp +++ b/src/server/sparkd/cmds/benchmarks/fix_gen_bm.cpp @@ -1,14 +1,13 @@ #include -#include "lib/orderman_v2/fix/Fields.h" #include "lib/jetfix/codec/f_toa.h" #include "lib/jetfix/codec/i32_toa.h" +#include "lib/orderman_v2/fix/Fields.h" namespace bts { namespace cmd { - using namespace orderman_v2; struct NumberEncoding { @@ -33,8 +32,8 @@ inline int my_u32_toa(uint32_t v, unsigned char *buffer, int pad) { memcpy(buffer, u32_encoding[v].number.data() + offset, pad); return u32_encoding[v].crc - (offset * '0'); } else { - u32_toa(v, (char*) buffer, pad); - return sum_bytes((char*)buffer, pad); + u32_toa(v, (char *)buffer, pad); + return sum_bytes((char *)buffer, pad); } } @@ -61,14 +60,12 @@ static void new_order_single_hybrid(benchmark::State &state) { no.add_value("DE7534N"); no.add_value("CME"); no.add_value("80"); - no.add_value("DO3BTSJGR"); no.add_value("US,IL"); - - - no.add_value("CLX60635"); - no.add_value("1"); - no.add_value("1"); no.add_value("6935102"); + no.add_value("DO3BTSJGR"); + no.add_value("CLX60635"); + no.add_value("1"); + no.add_value("1"); no.add_value("2"); auto transact_time = no.add_hole(); @@ -88,27 +85,69 @@ static void new_order_single_hybrid(benchmark::State &state) { for (auto _ : state) { no.reopen_holes(); - no.fill_hole_inplace(body_length, 123,my_u32_toa); - no.fill_hole_inplace(sn, 12,my_u32_toa); - no.fill_hole_inplace(lsn,13,my_u32_toa); - no.fill_hole(send_time, 0,"20190804-22:11:06.602"); - no.fill_hole(transact_time,0, "20190804-22:11:06.602"); - no.fill_hole_inplace(clorid, 100,my_u32_toa); + no.fill_hole_inplace(body_length, 123, my_u32_toa); + no.fill_hole_inplace(sn, 12, my_u32_toa); + no.fill_hole_inplace(lsn, 13, my_u32_toa); + no.fill_hole(send_time, 0, "20190804-22:11:06.602"); + no.fill_hole(transact_time, 0, "20190804-22:11:06.602"); + no.fill_hole_inplace(clorid, 100, my_u32_toa); no.fill_hole(side, "1"); no.fill_hole(tif, "1"); no.fill_hole(mno, "1"); - no.fill_hole_inplace(qty, 9,my_u32_toa); - no.fill_hole_inplace(price,-93.0,[](auto v, auto buffer, auto sz) { - d_toa(v,(char*)buffer,sz+1,9,sz); - buffer[sz]=1; - return sum_bytes((char*)buffer,sz); - }); + no.fill_hole_inplace(qty, 9, my_u32_toa); + no.fill_hole_inplace(price, -93.0, [](auto v, auto buffer, auto sz) { + d_toa(v, (char *)buffer, sz + 1, 9, sz); + buffer[sz] = 1; + return sum_bytes((char *)buffer, sz); + }); no.fill_hole(sec_desc, "HOU9-HOX9"); - no.fill_hole_inplace(checksum,123,my_u32_toa); + no.fill_hole_inplace(checksum, 123, my_u32_toa); } + std::cout << no.encode().human_str() << "\n"; } BENCHMARK(new_order_single_hybrid); +static void fragment_copy(benchmark::State &state) { + NewOrderSingle no; + using namespace fix; + + no.add_value("FIX.4.2"); + no.add_hole(); + no.add_value("D"); + no.add_hole(); + no.add_hole(); + no.add_hole(); + + no.add_value("DE7534N"); + no.add_value("CME"); + no.add_value("80"); + no.add_value("US,IL"); + no.add_value("6935102"); + no.add_value("DO3BTSJGR"); + no.add_value("CLX60635"); + no.add_value("1"); + no.add_value("1"); + no.add_value("2"); + + no.add_hole(); + no.add_hole(9); + no.add_hole(); + no.add_hole(); + no.add_hole(); + no.add_hole(); + no.add_hole(17); + no.add_hole(9); + no.add_hole(); + + no.seal(); + + NewOrderSingle no2; + for (auto _ : state) { + benchmark::DoNotOptimize(no2 = no); + } +} +BENCHMARK(fragment_copy); + // size_t create_order = 0; // size_t update_order = 0; // size_t cancel_order = 0; @@ -189,7 +228,8 @@ BENCHMARK(new_order_single_hybrid); // memcpy(buffer + p_index, "-0000093.00000000", // sizeof("-0000093.00000000") - 1); // benchmark::DoNotOptimize( -// cb += sum_bytes(buffer + p_index, sizeof("-0000093.00000000") - 1)); +// cb += sum_bytes(buffer + p_index, sizeof("-0000093.00000000") - +// 1)); // } // } // BENCHMARK(new_order_single_raw_gen); diff --git a/src/server/sparkd/main.cpp b/src/server/sparkd/main.cpp index 057c6d41f..46b77d5ae 100644 --- a/src/server/sparkd/main.cpp +++ b/src/server/sparkd/main.cpp @@ -24,7 +24,6 @@ int main(int argc, char **argv) { using namespace bts; - utils::init_spark_lib(); BEGIN_CMD; REGISTER(Test); @@ -48,3 +47,5 @@ int main(int argc, char **argv) { return 0; } + + diff --git a/src/web/CMakeDeps.cmake b/src/web/CMakeDeps.cmake index c0c4c57d6..19fda82cb 100644 --- a/src/web/CMakeDeps.cmake +++ b/src/web/CMakeDeps.cmake @@ -1 +1 @@ -set(sources ../../externals/linux/include/google/protobuf/descriptor.proto;../../externals/linux/include/google/protobuf/timestamp.proto;../lib/api/apicore.proto;../lib/api/apigateway.proto;../lib/api/apioptions.proto;../lib/api/services/AdminService.proto;../lib/api/services/AlgoDefinitionService.proto;../lib/api/services/AlgoService.proto;../lib/api/services/ApiUnitTestService.proto;../lib/api/services/AuthService.proto;../lib/api/services/BasePositionService.proto;../lib/api/services/ErrorReportService.proto;../lib/api/services/HelloService.proto;../lib/api/services/MBOService.proto;../lib/api/services/MarginService.proto;../lib/api/services/MarketDataAuxiliaryService.proto;../lib/api/services/MarketDataRelay.proto;../lib/api/services/MoneyFileService.proto;../lib/api/services/OrderService.proto;../lib/api/services/OutOfProcessURLListener.proto;../lib/api/services/PersistenceService.proto;../lib/api/services/PositionService.proto;../lib/api/services/ShellDiagnosticService.proto;../lib/api/services/ShellLatencyService.proto;../lib/api/services/SyntheticSecurityService.proto;../lib/domain_model/Security.proto;../lib/md/protos/co2.proto;../lib/sparkproto/SparkProtos.proto;api/build.sh;api/node_modules/cssstyle/scripts/run_tests.sh;api/node_modules/exit/test/fixtures/create-files.sh;api/node_modules/protobufjs/cli/node_modules/acorn-jsx/node_modules/acorn/bin/update_authors.sh;api/node_modules/watch/release.sh;api/quiet_build.sh;api/src/DynamicService.ts;api/src/ServiceContext.ts;api/src/bts_assert.ts;ui/src/Access.fs;ui/src/Accounts/ClipLimits.fs;ui/src/Accounts/ProductLimits.fs;ui/src/Accounts/SecurityLimits.fs;ui/src/Accounts/State.fs;ui/src/Accounts/Types.fs;ui/src/Accounts/View.fs;ui/src/App.fs;ui/src/Cmd.fs;ui/src/Controls/Button.fs;ui/src/Controls/DataGrid.fs;ui/src/Controls/Fields.fs;ui/src/Controls/Modal.fs;ui/src/Controls/ReactGrid.fs;ui/src/Controls/Table.fs;ui/src/Controls/nbsp.fs;ui/src/Global.fs;ui/src/Imports.fs;ui/src/Lens.fs;ui/src/Login/Login.fs;ui/src/Nav.fs;ui/src/State.fs;ui/src/Types.fs;ui/src/Users/State.fs;ui/src/Users/Types.fs;ui/src/Users/View.fs;ui/src/Util/EnumUtils.fs;ui/src/Util/JSMap.fs;ui/src/Util/StreamUtils.fs;ui/src/obj/Debug/netstandard2.0/ui.AssemblyInfo.fs) \ No newline at end of file +set(sources ../../externals/linux/include/google/protobuf/descriptor.proto;../../externals/linux/include/google/protobuf/timestamp.proto;../lib/api/apicore.proto;../lib/api/apigateway.proto;../lib/api/apioptions.proto;../lib/api/services/AdminService.proto;../lib/api/services/AlgoDefinitionService.proto;../lib/api/services/AlgoService.proto;../lib/api/services/ApiUnitTestService.proto;../lib/api/services/AuthService.proto;../lib/api/services/BasePositionService.proto;../lib/api/services/ErrorReportService.proto;../lib/api/services/HelloService.proto;../lib/api/services/MBOService.proto;../lib/api/services/MarginService.proto;../lib/api/services/MarketDataAuxiliaryService.proto;../lib/api/services/MarketDataRelay.proto;../lib/api/services/MoneyFileService.proto;../lib/api/services/OrderService.proto;../lib/api/services/OutOfProcessURLListener.proto;../lib/api/services/PersistenceService.proto;../lib/api/services/PositionService.proto;../lib/api/services/ShellDiagnosticService.proto;../lib/api/services/ShellLatencyService.proto;../lib/api/services/SyntheticSecurityService.proto;../lib/domain_model/Security.proto;../lib/md/protos/co2.proto;../lib/sparkproto/SparkProtos.proto;api/build.sh;api/node_modules/exit/test/fixtures/create-files.sh;api/node_modules/protobufjs/cli/node_modules/acorn-jsx/node_modules/acorn/bin/update_authors.sh;api/node_modules/watch/release.sh;api/quiet_build.sh;api/src/DynamicService.ts;api/src/ServiceContext.ts;api/src/bts_assert.ts;ui/src/Access.fs;ui/src/Accounts/ClipLimits.fs;ui/src/Accounts/ProductLimits.fs;ui/src/Accounts/SecurityLimits.fs;ui/src/Accounts/State.fs;ui/src/Accounts/Types.fs;ui/src/Accounts/View.fs;ui/src/App.fs;ui/src/Cmd.fs;ui/src/Controls/Button.fs;ui/src/Controls/DataGrid.fs;ui/src/Controls/Fields.fs;ui/src/Controls/Modal.fs;ui/src/Controls/ReactGrid.fs;ui/src/Controls/Table.fs;ui/src/Controls/nbsp.fs;ui/src/Global.fs;ui/src/Imports.fs;ui/src/Lens.fs;ui/src/Login/Login.fs;ui/src/Nav.fs;ui/src/State.fs;ui/src/Types.fs;ui/src/Users/State.fs;ui/src/Users/Types.fs;ui/src/Users/View.fs;ui/src/Util/EnumUtils.fs;ui/src/Util/JSMap.fs;ui/src/Util/StreamUtils.fs;ui/src/obj/Debug/netstandard2.0/ui.AssemblyInfo.fs) \ No newline at end of file