/// <summary> /// Sends a new Market Order Request to 'Order Execution Server' /// </summary> /// <param name="orderDetails">Contains market order information</param> public void MarketOrderRequests(OrderDetails orderDetails) { // Get new Order ID orderDetails.ID = _orderExecutionService.GetOrderId(); // Create Market Order object to be sent to 'Order Execution Service' MarketOrder marketOrder = OrderMessage.GenerateMarketOrder(orderDetails.ID, orderDetails.Security, orderDetails.Side, orderDetails.Quantity, orderDetails.Provider); // Send Request to Server _orderExecutionService.SendOrder(marketOrder); }
public void OrderIDGeneratorTestCase_ConnectionEstablishedWithServer() { bool logonArrived = false; bool logoutArrived = false; ManualResetEvent manualLogonEvent = new ManualResetEvent(false); ManualResetEvent manualLogoutEvent = new ManualResetEvent(false); ManualResetEvent manualConnectedEvent = new ManualResetEvent(false); _service.Connected += delegate() { _service.Login(new Login() { OrderExecutionProvider = TradeHubConstants.OrderExecutionProvider.Simulated }); manualConnectedEvent.Set(); }; _service.LogonArrived += delegate(string obj) { logonArrived = true; _service.Logout(new Logout { OrderExecutionProvider = TradeHubConstants.OrderExecutionProvider.Simulated }); manualLogonEvent.Set(); }; _service.LogoutArrived += delegate(string obj) { logoutArrived = true; manualLogoutEvent.Set(); }; _service.StartService(); manualConnectedEvent.WaitOne(30000, false); manualLogonEvent.WaitOne(30000, false); manualLogoutEvent.WaitOne(30000, false); string orderId = _service.GetOrderId(); Console.WriteLine("Order ID: " + orderId); string appender = orderId.Substring(orderId.Length - 3); Assert.AreEqual(true, logonArrived, "Logon Arrived"); Assert.AreEqual(true, logoutArrived, "Logout Arrived"); Assert.IsTrue(appender.Equals("A00"), "Appender: " + appender); }