コード例 #1
0
        public void ShouldRegisterFilledHandlerAndReceiveFilledEvent()
        {
            var filledOrders = new List <ILimitOrder>();
            var newOrder     = new LimitOrder("ABC", 10, 99.22d, WayEnum.Buy, 3);

            newOrder.RegisterFilledNotification(filledOrders.Add);

            newOrder.Modify(0, 88.44d);

            Assert.AreEqual(1, filledOrders.Count);
            Assert.AreEqual(newOrder, filledOrders[0]);
        }
コード例 #2
0
        public ILimitOrder NewLimitOrder(string symbol, int clientId, double price, int quantity, WayEnum way)
        {
            if (!ClientOrders.ContainsKey(clientId))
            {
                ClientOrders.Add(clientId, new EditableList <ILimitOrder>());
            }

            ILimitOrder toReturn = new LimitOrder(symbol, quantity, price, way, clientId);

            toReturn.SetExchangeOrderId(globalItemCounter);

            LimitOrders.Add(toReturn.ExchangeOrderId, toReturn);
            ClientOrders[clientId].Add(toReturn);
            toReturn.RegisterDeleteNotificationHandler(HandleDeletedLimitOrder);
            toReturn.RegisterFilledNotification(HandleDeletedLimitOrder);

            globalItemCounter++;
            return(toReturn);
        }