Exemple #1
0
 public override void SendOrderCancelReplaceRequest(OrderCancelReplaceRequest request)
 {
     if (!request.ContainsField(1) && !string.IsNullOrWhiteSpace(this.DefaultAccount))
     {
         request.Account = this.DefaultAccount.Trim();
     }
     if (!request.ContainsField(109) && !string.IsNullOrWhiteSpace(this.DefaultClientID))
     {
         request.SetStringValue(109, this.DefaultClientID.Trim());
     }
     base.SendOrderCancelReplaceRequest(request);
 }
Exemple #2
0
        internal static void ReplaceOrder(SingleOrder order)
        {
            if (order.Provider == null)
            {
                throw new ApplicationException("null");
            }
            OrderCancelReplaceRequest request = new OrderCancelReplaceRequest();

            request.ClOrdID     = OrderManager.GetOrdId();
            request.OrigClOrdID = order.ClOrdID;
            if (order.ContainsField(37))
            {
                request.OrderID = order.OrderID;
            }
            request.Side        = order.Side;
            request.OrdType     = !order.ReplaceOrder.ContainsField(40) ? order.OrdType : order.ReplaceOrder.OrdType;
            request.TimeInForce = !order.ReplaceOrder.ContainsField(59) ? order.TimeInForce : order.ReplaceOrder.TimeInForce;
            if (order.ReplaceOrder.ContainsField(126))
            {
                request.ExpireTime = order.ReplaceOrder.ExpireTime;
            }
            if (order.ReplaceOrder.ContainsField(44))
            {
                request.Price = order.ReplaceOrder.Price;
            }
            else
            {
                request.Price = order.Price;
            }
            if (order.ReplaceOrder.ContainsField(99))
            {
                request.StopPx = order.ReplaceOrder.StopPx;
            }
            else
            {
                request.StopPx = order.StopPx;
            }
            if (order.ReplaceOrder.ContainsField(10701))
            {
                request.TrailingAmt = order.ReplaceOrder.TrailingAmt;
            }
            else
            {
                request.TrailingAmt = order.TrailingAmt;
            }
            if (order.ReplaceOrder.ContainsField(38))
            {
                request.OrderQty = order.ReplaceOrder.OrderQty;
            }
            else
            {
                request.OrderQty = order.OrderQty;
            }
            request.TransactTime     = Clock.Now;
            request.Account          = order.Account;
            request.HandlInst        = order.HandlInst;
            request.Symbol           = order.Symbol;
            request.SecurityType     = order.SecurityType;
            request.SecurityExchange = order.SecurityExchange;
            request.SecurityID       = order.SecurityID;
            request.Currency         = order.Currency;
            request.SetStringValue(109, order.GetStringValue(109));
            order.Provider.SendOrderCancelReplaceRequest(request);
        }