public RequestStatus DeletePendingOrderRequest(PendingOrder order, PendingOrderStatus status, int?positionId, string closeReason) { // снять отложенный ордер return(ServerInterface.DeletePendingOrder(order, status, positionId, closeReason) ? RequestStatus.OK : RequestStatus.ServerError); }
public RequestStatus SendDeletePendingOrderRequest( ProtectedOperationContext secCtx, PendingOrder order, PendingOrderStatus status, int?positionID, string closeReason) { if (UserOperationRightsStorage.IsProtectedOperation(UserOperation.CloseOrder)) { if (!UserSessionStorage.Instance.PermitUserOperation(secCtx, UserOperationRightsStorage.IsTradeOperation(UserOperation.ModifyOrder), true)) { return(RequestStatus.Unauthorized); } } Account account; var dealer = GetDealerByAccount(order.AccountID, out account); if (dealer == null) { return(RequestStatus.GroupUnsupported); } try { var rst = dealer.DeletePendingOrderRequest(order, status, positionID, closeReason); AccountLogger.InfoFormat("SendDeletePendingOrderRequest({0}, {1} {2} {3}): {4}", order.ID, (DealType)order.Side, order.PriceSide, order.Symbol, rst); return(rst); } catch (Exception ex) { Logger.ErrorFormat("Ошибка дилера {0}: {1}", dealer, ex); return(RequestStatus.DealerError); } }
public static PendingSection <T> Create <T>(PendingOrderStatus status, IEnumerable <T> orders) where T : PendingOrderBase { switch (status) { case PendingOrderStatus.UnpickedAboutToShip: return(new PendingSection <T> { SectionLabel = "Warning", SectionDescription = "Orders are scheduled to ship within 2 days and have not been picked", SectionColor = Color.FromArgb(255, 255, 192, 192), Items = orders }); case PendingOrderStatus.Picked: return(new PendingSection <T> { SectionLabel = "On Time", SectionDescription = "Orders have been picked", SectionColor = Color.FromArgb(255, 192, 192, 192), Items = orders }); case PendingOrderStatus.UnpickedNotAboutToShip: return(new PendingSection <T> { SectionLabel = "Unpicked", SectionDescription = "Orders have not been picked but are not scheduled to ship within 2 days", SectionColor = Color.FromArgb(255, 255, 220, 220), Items = orders }); default: throw new ArgumentOutOfRangeException("status"); } }
public override RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext ctx, PendingOrder order, PendingOrderStatus status, int?positionId, string closeReason) { order.Status = status; order.CloseReason = closeReason; ordHistory.Add(order); orders.Remove(order); return(RequestStatus.OK); }
public bool DeletePendingOrder(PendingOrder orderDecorated, PendingOrderStatus status, int?positionID, string closeReason) { var order = LinqToEntity.UndecorateLiveActiveOrder(orderDecorated); using (var ctx = DatabaseContext.Instance.Make()) { // получить текущую цену var pair = QuoteStorage.Instance.ReceiveValue(order.Symbol); var priceClosed = pair == null ? 0 : order.Side > 0 ? pair.bid : pair.ask; var hist = new PENDING_ORDER_CLOSED { OrderID = order.ID, AccountID = order.AccountID, Comment = order.Comment, ExpertComment = order.ExpertComment, Magic = order.Magic, PairOCO = order.PairOCO, PriceFrom = order.PriceFrom, PriceTo = order.PriceTo, Side = order.Side, Status = (int)status, Stoploss = order.Stoploss, Takeprofit = order.Takeprofit, Symbol = order.Symbol, TimeClosed = DateTime.Now, Volume = order.Volume, PriceClosed = (decimal)priceClosed, Position = positionID, CloseReason = closeReason }; try { ctx.PENDING_ORDER_CLOSED.Add(hist); var ord = ctx.PENDING_ORDER.FirstOrDefault(p => p.ID == order.ID); if (ord == null) { Logger.ErrorFormat("DeletePendingOrder - ордер {0} не найден", order.ID); ServiceManagerClientManagerProxy.Instance.NewOrderResponse(null, RequestStatus.ServerError, "crudsav"); return(false); } ctx.PENDING_ORDER.Remove(ord); // сохранить изменения ctx.SaveChanges(); return(true); } catch (Exception ex) { Logger.ErrorFormat("Ошибка в DeletePendingOrder (#{0}): {1}", order.ID, ex); } } return(false); }
public RequestStatus SendDeletePendingOrderRequestSafe(PendingOrder order, PendingOrderStatus status, int?positionId, string closeReason) { if (InvokeRequired) { return((RequestStatus)Invoke(new Func <PendingOrder, PendingOrderStatus, int?, string, RequestStatus>(SendDeletePendingOrderRequestUnsafe), status, positionId, closeReason)); } return(SendDeletePendingOrderRequestUnsafe(order, status, positionId, closeReason)); }
private static RequestStatus SendDeletePendingOrderRequestUnsafe(PendingOrder order, PendingOrderStatus status, int?positionId, string closeReason) { try { var res = serverProxyTrade.proxy.SendDeletePendingOrderRequest( CurrentProtectedContext.Instance.MakeProtectedContext(), order, status, positionId, closeReason); if (res != RequestStatus.OK) { Instance.ShowMsgWindowSafe(new AccountEvent( Localizer.GetString("MessageErrorExecutingOrder"), EnumFriendlyName <RequestStatus> .GetString(res), AccountEventCode.ServerMessage)); } return(res); } catch (Exception ex) { Logger.Error("SendDeletePendingOrderRequest", ex); return(RequestStatus.NoConnection); } }
public RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext ctx, PendingOrder order, PendingOrderStatus status, int?positionID, string closeReason) { throw new NotImplementedException(); }
public abstract RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext ctx, PendingOrder order, PendingOrderStatus status, int?positionId, string closeReason);
public override RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext ctx, PendingOrder order, PendingOrderStatus status, int?positionId, string closeReason) { return(proxyTrade.proxy.SendDeletePendingOrderRequest(ctx, order, status, positionId, closeReason)); }
public override RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext ctx, PendingOrder order, PendingOrderStatus status, int? positionId, string closeReason) { return proxyTrade.proxy.SendDeletePendingOrderRequest(ctx, order, status, positionId, closeReason); }
public abstract RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext ctx, PendingOrder order, PendingOrderStatus status, int? positionId, string closeReason);
public RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext secCtx, PendingOrder order, PendingOrderStatus status, int?positionID, string closeReason) { return(Channel.SendDeletePendingOrderRequest(secCtx, order, status, positionID, closeReason)); }
public RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext secCtx, PendingOrder order, PendingOrderStatus status, int?positionID, string closeReason) { try { return(Proxy.SendDeletePendingOrderRequest(secCtx, order, status, positionID, closeReason)); } catch (Exception) //no try-catch in original { RenewChannel(); try { return(Proxy.SendDeletePendingOrderRequest(secCtx, order, status, positionID, closeReason)); } catch (Exception) { return(RequestStatus.ServerError); } } }
public RequestStatus SendDeletePendingOrderRequest(ProtectedOperationContext ctx, PendingOrder order, PendingOrderStatus status, int? positionID, string closeReason) { throw new NotImplementedException(); }