/// <summary> /// Initializes a new instance of the <see cref="OrderRequest"/> class /// </summary> /// <param name="time">The time this request was created</param> /// <param name="orderId">The order id this request acts on, specify zero for <see cref="SubmitOrderRequest"/></param> /// <param name="tag">A custom tag for the request</param> protected OrderRequest(DateTime time, int orderId, string tag) { Time = time; OrderId = orderId; Tag = tag; Response = OrderResponse.Unprocessed; Status = OrderRequestStatus.Unprocessed; }
/// <summary> /// Creates a new <see cref="OrderTicket"/> that represents trying to submit a new order that had errors embodied in the <paramref name="response"/> /// </summary> public static OrderTicket InvalidSubmitRequest(SecurityTransactionManager transactionManager, SubmitOrderRequest request, OrderResponse response) { request.SetResponse(response); return(new OrderTicket(transactionManager, request) { _orderStatusOverride = OrderStatus.Invalid }); }
/// <summary> /// Sets the <see cref="Response"/> for this request /// </summary> /// <param name="response">The response to this request</param> /// <param name="status">The current status of this request</param> public void SetResponse(OrderResponse response, OrderRequestStatus status = OrderRequestStatus.Error) { if (response == null) { throw new ArgumentNullException("response", "Response can not be null"); } // if the response is an error, ignore the input status Status = response.IsError ? OrderRequestStatus.Error : status; Response = response; }