Example #1
0
        public void OrderCancellationRequest_ToString_test()
        {
            Order order = new Order(1,
                                    BrokerDateTime.Make(DateTime.Now),
                                    "BP12345-RF-01",
                                    "RTS-12.13_FT",
                                    TradeAction.Buy,
                                    OrderType.Limit,
                                    1,
                                    150000,
                                    0);

            OrderCancellationRequest request = new OrderCancellationRequest(order, "Лучшая цена предложения ушла от цены заявки на 100 пунктов.");
            string result = String.Format("Запрос на отмену заявки Id: {0}, DateTime: {1}, Description: {2}, OrderId: {3}", request.Id, request.DateTime, request.Description, request.OrderId);

            Assert.AreEqual(result, request.ToString());
        }
Example #2
0
        public override void OnQuotesUpdate(string symbol)
        {
            if (!this.strategyHeader.Symbol.Equals(symbol))
            {
                return;
            }

            if (this.tradingData.GetAmount(this.strategyHeader) != 0)
            {
                return;
            }

            Order lastUnfilledOrder = GetLastUnfilledOrder();

            if (lastUnfilledOrder == null)
            {
                return;
            }

            if (!lastUnfilledOrder.IsDelivered)
            {
                return;
            }

            if (!BestQuotePriceGoneOverTheLimit(lastUnfilledOrder))
            {
                return;
            }

            if (OrderCancellationRequstExists(lastUnfilledOrder))
            {
                return;
            }

            this.request = null;
            this.request = MakeOrderCancellationRequest(lastUnfilledOrder);

            this.logger.Log(String.Format("{0:dd/MM/yyyy H:mm:ss.fff}, {1}, запрос на снятие заявки {2}", DateTime.Now, this.GetType().Name, request.ToString()));

            this.tradingData.Get <ObservableHashSet <OrderCancellationRequest> >().Add(request);
        }