Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataService"/> class.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="messagingAdapter">The messaging adapter.</param>
        /// <param name="dataBusAdapter">The data bus adapter.</param>
        /// <param name="dataGateway">The data gateway.</param>
        /// <param name="config">The service configuration.</param>
        /// <exception cref="ArgumentException">If the addresses is empty.</exception>
        public DataService(
            IComponentryContainer container,
            MessageBusAdapter messagingAdapter,
            DataBusAdapter dataBusAdapter,
            IDataGateway dataGateway,
            ServiceConfiguration config)
            : base(
                container,
                messagingAdapter,
                config.FixConfig)
        {
            this.dataBus           = dataBusAdapter;
            this.dataGateway       = dataGateway;
            this.managedComponents = new List <Address>
            {
                ComponentAddress.DataServer,
                ComponentAddress.DataPublisher,
                ComponentAddress.MarketDataRepository,
                ComponentAddress.TickPublisher,
                ComponentAddress.TickProvider,
                ComponentAddress.BarProvider,
                ComponentAddress.InstrumentRepository,
                ComponentAddress.InstrumentProvider,
            };

            this.subscribingSymbols = config.DataConfig.SubscribingSymbols;

            this.RegisterConnectionAddress(ComponentAddress.DataGateway);
        }
Пример #2
0
        public MockMessageBusProvider(IComponentryContainer container)
        {
            var adapter = new MessageBusAdapter(
                new MessageBus <Command>(container),
                new MessageBus <Event>(container),
                new MessageBus <Message>(container));

            this.Adapter = adapter;

            var initializeSwitchboard = new InitializeSwitchboard(
                Switchboard.Empty(),
                Guid.NewGuid(),
                container.Clock.TimeNow());

            adapter.Send(initializeSwitchboard);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExecutionService"/> class.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="messagingAdapter">The messaging adapter.</param>
        /// <param name="tradingGateway">The execution gateway.</param>
        /// <param name="config">The execution service configuration.</param>
        /// <exception cref="ArgumentException">If the addresses is empty.</exception>
        public ExecutionService(
            IComponentryContainer container,
            MessageBusAdapter messagingAdapter,
            ITradingGateway tradingGateway,
            ServiceConfiguration config)
            : base(
                container,
                messagingAdapter,
                config.FixConfig)
        {
            this.tradingGateway = tradingGateway;

            this.managedComponents = new List <Address>
            {
                ComponentAddress.CommandServer,
                ComponentAddress.EventPublisher,
            };

            this.RegisterConnectionAddress(ComponentAddress.TradingGateway);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NautilusServiceBase"/> class.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="messagingAdapter">The messaging adapter.</param>
        /// <param name="config">The service configuration.</param>
        /// <exception cref="ArgumentException">If the addresses is empty.</exception>
        protected NautilusServiceBase(
            IComponentryContainer container,
            MessageBusAdapter messagingAdapter,
            FixConfiguration config)
            : base(container, messagingAdapter)
        {
            this.messaging            = messagingAdapter;
            this.connectWeeklyTime    = config.ConnectWeeklyTime;
            this.disconnectWeeklyTime = config.DisconnectWeeklyTime;
            this.maintainConnection   = false;

            // Commands
            this.RegisterHandler <ConnectSession>(this.OnMessage);
            this.RegisterHandler <DisconnectSession>(this.OnMessage);

            // Events
            this.RegisterHandler <SessionConnected>(this.OnMessage);
            this.RegisterHandler <SessionDisconnected>(this.OnMessage);

            // Event Subscriptions
            this.Subscribe <SessionConnected>();
            this.Subscribe <SessionDisconnected>();
        }