Beispiel #1
0
        public void TestOrderExecutionLogin()
        {
            var    manualResetEvent      = new ManualResetEvent(false);
            string loginMessage          = null;
            var    executionEngineClient = new OrderExecutionEngineClient();

            executionEngineClient.Start();
            manualResetEvent.WaitOne(5000);
            executionEngineClient.LogoutArrived += delegate(string s)
            {
                loginMessage = s;
            };
            executionEngineClient.SendLoginRequest(new Login()
            {
                OrderExecutionProvider = Common.Core.Constants.OrderExecutionProvider.SimulatedExchange
            });
            manualResetEvent.WaitOne(5000);
            executionEngineClient.SendMarketOrderRequest(new MarketOrder("1", OrderSide.BUY, 10, "123", "USD",
                                                                         new Security {
                Symbol = "AAPL"
            },
                                                                         Common.Core.Constants.OrderExecutionProvider.
                                                                         SimulatedExchange));
            manualResetEvent.WaitOne(5000);
            executionEngineClient.Shutdown();
            System.Console.WriteLine(loginMessage);
            Assert.AreEqual(false, string.IsNullOrEmpty(loginMessage));
        }
        /// <summary>
        /// Stops Order Execution Service
        /// </summary>
        public bool StopService()
        {
            try
            {
                if (_executionEngineClient != null)
                {
                    // Stop OEE-Client
                    _executionEngineClient.Shutdown();
                }

                // Clear local map
                _ordersMap.Clear();

                // Shutdown disruptor
                _orderDisruptor.Shutdown();

                if (_asyncClassLogger.IsInfoEnabled)
                {
                    _asyncClassLogger.Info("Order Execution service stopped.", _type.FullName, "StopService");
                }

                return(true);
            }
            catch (Exception exception)
            {
                _asyncClassLogger.Error(exception, _type.FullName, "StopService");
                return(false);
            }
        }
Beispiel #3
0
 public void Close()
 {
     _executionEngineClient.Shutdown();
     _applicationController.StopServer();
 }