public OrderResponse Cancel(string tag = null) { var request = new CancelOrderRequest(_transactionManager.UtcTime, OrderId, tag); _transactionManager.ProcessRequest(request); return(CancelRequest.Response); }
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); }
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); }