Exemplo n.º 1
0
        internal static void CancelOrder(SingleOrder order)
        {
            if (order.Provider == null)
            {
                throw new ApplicationException("Provider is null");
            }
            OrderCancelRequest request = new OrderCancelRequest();

            request.OrigClOrdID      = order.ClOrdID;
            request.ClOrdID          = OrderManager.GetOrdId();
            request.Side             = order.Side;
            request.TransactTime     = Clock.Now;
            request.Symbol           = order.Symbol;
            request.SecurityType     = order.SecurityType;
            request.SecurityID       = order.SecurityID;
            request.SecurityExchange = order.SecurityExchange;
            if (order.ContainsField(37))
            {
                request.OrderID = order.OrderID;
            }
            request.Account  = order.Account;
            request.OrderQty = order.OrderQty;
            request.SetStringValue(109, order.GetStringValue(109));
            order.Provider.SendOrderCancelRequest(request);
        }
Exemplo n.º 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);
 }
Exemplo n.º 3
0
 internal static void CancelOrder(SingleOrder order)
 {
     if (order.Provider == null)
         throw new ApplicationException("Provider is null");
     OrderCancelRequest request = new OrderCancelRequest();
     request.OrigClOrdID = order.ClOrdID;
     request.ClOrdID = OrderManager.GetOrdId();
     request.Side = order.Side;
     request.TransactTime = Clock.Now;
     request.Symbol = order.Symbol;
     request.SecurityType = order.SecurityType;
     request.SecurityID = order.SecurityID;
     request.SecurityExchange = order.SecurityExchange;
     if (order.ContainsField(37))
         request.OrderID = order.OrderID;
     request.Account = order.Account;
     request.OrderQty = order.OrderQty;
     request.SetStringValue(109, order.GetStringValue(109));
     order.Provider.SendOrderCancelRequest(request);
 }
Exemplo n.º 4
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);
        }