public async Task TwsExecutionController_Should_ReturnOpenOrdersTwice() { TwsObjectFactory twsObjectFactory = new TwsObjectFactory("localhost", TestConstants.Port, 1); ITwsControllerBase twsController = twsObjectFactory.TwsControllerBase; await twsController.EnsureConnectedAsync(); // Create a position Contract contract = new Contract(); contract.SecType = TwsContractSecType.Stock; contract.Symbol = "MSFT"; contract.Exchange = TwsExchange.Smart; contract.Currency = TwsCurrency.Usd; contract.PrimaryExch = TwsExchange.Island; Order order = new Order { Action = "BUY", OrderType = "LMT", TotalQuantity = 1, LmtPrice = 1, }; int orderId = await twsController.GetNextValidIdAsync(); bool successfullyPlaced = await twsController.PlaceOrderAsync(orderId, contract, order); Thread.Sleep(1000); // TWS takes some time to put the order in the portfolio. Wait for it. var openOrders = await twsController.RequestOpenOrders(); openOrders.Count.Should().BeGreaterOrEqualTo(1); Thread.Sleep(5005); var openOrders2 = await twsController.RequestOpenOrders(); openOrders2.Count.Should().BeGreaterOrEqualTo(1); await twsController.DisconnectAsync(); }