예제 #1
0
        public static long GetOrderIdFromMessage(QuickFix.FIX42.OrderCancelRequest msg)
        {
            if (!msg.IsSetOrderID())
            {
                throw new IncorrectTagValue(msg.OrderID.Tag);
            }

            var  idString = msg.OrderID.getValue();
            long id;

            if (!string.IsNullOrEmpty(idString) && long.TryParse(idString, out id))
            {
                return(id);
            }

            throw new IncorrectTagValue(msg.OrderID.Tag);
        }
예제 #2
0
        public void OnMessage(QuickFix.FIX42.OrderCancelRequest msg, SessionID s)
        {
            string orderid = (msg.IsSetOrderID()) ? msg.OrderID.Obj : "unknown orderID";

            QuickFix.FIX42.OrderCancelReject ocj = new QuickFix.FIX42.OrderCancelReject(
                new OrderID(orderid), msg.ClOrdID, msg.OrigClOrdID, new OrdStatus(OrdStatus.REJECTED), new CxlRejResponseTo(CxlRejResponseTo.ORDER_CANCEL_REQUEST));
            ocj.CxlRejReason = new CxlRejReason(CxlRejReason.UNKNOWN_ORDER);
            ocj.Text         = new Text("Executor does not support order cancels");

            try
            {
                Session.SendToTarget(ocj, s);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }