//[Test] public void LoginTestCase() { var manualBarEvent = new ManualResetEvent(false); _marketDataEngineClient.LiveBarArrived += Console.WriteLine; manualBarEvent.WaitOne(1000); _marketDataEngineClient.SendLoginRequest(new Login { MarketDataProvider = Common.Core.Constants.MarketDataProvider.SimulatedExchange }); // Assert.AreEqual(true, logoutArrived, "Logout Arrived"); manualBarEvent.WaitOne(3000); _marketDataEngineClient.SendLiveBarSubscriptionRequest(new BarDataRequest { BarFormat = Common.Core.Constants.BarFormat.TIME, Security = new Security { Symbol = "GOOG" }, BarLength = 10, MarketDataProvider = Common.Core.Constants.MarketDataProvider.SimulatedExchange, Id = "1", BarPriceType = Common.Core.Constants.BarPriceType.BID }); manualBarEvent.WaitOne(10000); }
void _marketDataEngineClient_ServerConnected() { _marketDataEngineClient.SendLoginRequest(new Login() { MarketDataProvider = Common.Core.Constants.MarketDataProvider.Simulated }); }
/// <summary> /// Sends Login request to MDE /// </summary> /// <param name="login">TradeHub Login object</param> public bool Login(Login login) { try { if (_asyncClassLogger.IsInfoEnabled) { _asyncClassLogger.Info("Sending Login request for: " + login.MarketDataProvider, _type.FullName, "Login"); } // Check if MDE-Client is connected to MDE if (_isConnected) { // Send login request to MDE _dataEngineClient.SendLoginRequest(login); return(true); } if (_asyncClassLogger.IsDebugEnabled) { _asyncClassLogger.Debug("Request not sent to MDE as MDE-Client is not connected.", _type.FullName, "Login"); } return(false); } catch (Exception exception) { _asyncClassLogger.Error(exception, _type.FullName, "Login"); return(false); } }
public void ConnectivityTestCase() { bool logonArrived = false; bool logoutArrived = false; ManualResetEvent manualLogonEvent = new ManualResetEvent(false); ManualResetEvent manualLogoutEvent = new ManualResetEvent(false); ManualResetEvent manualConnectedEvent = new ManualResetEvent(false); _marketDataEngineClient.ServerConnected += delegate() { _marketDataEngineClient.SendLoginRequest(new Login() { MarketDataProvider = TradeHubConstants.MarketDataProvider.Simulated }); manualConnectedEvent.Set(); }; _marketDataEngineClient.LogonArrived += delegate(string obj) { logonArrived = true; _marketDataEngineClient.SendLogoutRequest(new Logout { MarketDataProvider = TradeHubConstants.MarketDataProvider.Simulated }); manualLogonEvent.Set(); }; _marketDataEngineClient.LogoutArrived += delegate(string obj) { logoutArrived = true; manualLogoutEvent.Set(); }; _marketDataEngineClient.Start(); manualConnectedEvent.WaitOne(30000, false); manualLogonEvent.WaitOne(30000, false); manualLogoutEvent.WaitOne(30000, false); Assert.AreEqual(true, logonArrived, "Logon Arrived"); Assert.AreEqual(true, logoutArrived, "Logout Arrived"); }
public void TestWholeExchange() { int count = 0; _orderExecutionEngine.NewArrived += delegate(Order order) { count++; }; _orderExecutionEngine.ExecutionArrived += delegate(Execution execution) { count++; }; ManualResetEvent manualResetEvent = new ManualResetEvent(false); manualResetEvent.WaitOne(1000); _orderExecutionEngine.SendLoginRequest(new Login { OrderExecutionProvider = OrderExecutionProvider.SimulatedExchange }); _marketDataEngineClient.SendLoginRequest(new Login { MarketDataProvider = MarketDataProvider.SimulatedExchange }); manualResetEvent.WaitOne(3000); LimitOrder limitOrder = new LimitOrder("1", OrderSide.SELL, 10, OrderTif.DAY, "USD", new Security() { Symbol = "GOOG" }, OrderExecutionProvider.SimulatedExchange) { LimitPrice = 120 }; _orderExecutionEngine.SendLimitOrderRequest(limitOrder); _marketDataEngineClient.SendLiveBarSubscriptionRequest(new BarDataRequest { BarFormat = BarFormat.TIME, Security = new Security { Symbol = "GOOG" }, BarLength = 10, MarketDataProvider = MarketDataProvider.SimulatedExchange, Id = "1", BarPriceType = BarPriceType.BID }); manualResetEvent.WaitOne(3000); Assert.AreEqual(2, count); }