public static OrderTicket InvalidWarmingUp(SecurityTransactionManager transactionManager, SubmitOrderRequest submit) { submit.SetResponse(OrderResponse.WarmingUp(submit)); var ticket = new OrderTicket(transactionManager, submit); ticket._orderStatusOverride = OrderStatus.Invalid; return(ticket); }
public static OrderTicket InvalidUpdateOrderId(SecurityTransactionManager transactionManager, UpdateOrderRequest 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.AddUpdateRequest(request); ticket._orderStatusOverride = OrderStatus.Invalid; return(ticket); }
private static decimal AccessOrder <T>(OrderTicket ticket, OrderField field, Func <T, decimal> orderSelector, Func <SubmitOrderRequest, decimal> requestSelector) where T : Order { var order = ticket._order; if (order == null) { return(requestSelector(ticket._submitRequest)); } var typedOrder = order as T; if (typedOrder != null) { return(orderSelector(typedOrder)); } throw new ArgumentException(string.Format("Unable to access property {0} on order of type {1}", field, order.Type)); }