示例#1
0
        public OrderResponse Cancel(string tag = null)
        {
            var request = new CancelOrderRequest(_transactionManager.UtcTime, OrderId, tag);

            _transactionManager.ProcessRequest(request);
            return(CancelRequest.Response);
        }
示例#2
0
 internal bool TrySetCancelRequest(CancelOrderRequest request)
 {
     if (request.OrderId != OrderId)
     {
         throw new ArgumentException("Received CancelOrderRequest for incorrect order id.");
     }
     lock (_setCancelRequestLock)
     {
         if (_cancelRequest != null)
         {
             return(false);
         }
         _cancelRequest = request;
     }
     return(true);
 }
示例#3
0
        public static OrderTicket InvalidCancelOrderId(SecurityTransactionManager transactionManager, CancelOrderRequest request)
        {
            var submit = new SubmitOrderRequest(OrderType.Market, SecurityType.Base, Symbol.Empty, 0, 0, 0, DateTime.MaxValue, string.Empty);

            submit.SetResponse(OrderResponse.UnableToFindOrder(request));
            var ticket = new OrderTicket(transactionManager, submit);

            request.SetResponse(OrderResponse.UnableToFindOrder(request));
            ticket.TrySetCancelRequest(request);
            ticket._orderStatusOverride = OrderStatus.Invalid;
            return(ticket);
        }