protected void RejectCancelRequest(QuickFix.SessionID session, QuickFix.Fields.ClOrdID clordid, QuickFix.Fields.OrigClOrdID origordid, IOrder nt7_order, string rej_reason, int cxl_rej, bool is_cancelreplace_request)
        {
            QuickFix.FIX42.OrderCancelReject rej = new QuickFix.FIX42.OrderCancelReject();
            if (nt7_order == null)
            {
                rej.Set(new QuickFix.Fields.OrderID("NONE"));
            }
            else
            {
                rej.Set(new QuickFix.Fields.OrderID(clordid.getValue()));
            }

            rej.Set(origordid);
            rej.Set(Converter.c(nt7_order.OrderState));
            rej.Set(new QuickFix.Fields.CxlRejResponseTo(is_cancelreplace_request ? QuickFix.Fields.CxlRejResponseTo.ORDER_CANCEL_REPLACE_REQUEST : QuickFix.Fields.CxlRejResponseTo.ORDER_CANCEL_REQUEST));
            rej.Set(new QuickFix.Fields.CxlRejReason(cxl_rej));
            rej.Set(new QuickFix.Fields.Text(rej_reason));
            rej.Set(new QuickFix.Fields.TransactTime(DateTime.Now, true));

            QuickFix.Session.SendToTarget(rej, session);
        }
Beispiel #2
0
        public static QuickFix.FIX42.OrderCancelReject Fix44OCR_2_Fix42OCR(QuickFix.FIX44.OrderCancelReject ocrj44)
        {
            try
            {
                // TODO [FF] - Efetuar a conversao do Fix44 para Fix42 de OrderCancelReject
                QuickFix.FIX42.OrderCancelReject ocrj42 = new QuickFix.FIX42.OrderCancelReject();

                if (ocrj44.IsSetOrderID())
                {
                    ocrj42.Set(new OrderID(ocrj44.OrderID.getValue()));
                }
                if (ocrj44.IsSetSecondaryOrderID())
                {
                    ocrj42.Set(new SecondaryOrderID(ocrj44.SecondaryOrderID.getValue()));
                }
                // if (ocrj44.IsSetSecondaryClOrdID()) ocrj42.Set(new SecondaryClOrdID(ocrj44.SecondaryClOrdID.getValue())); // Not Found on 4.2
                if (ocrj44.IsSetClOrdID())
                {
                    ocrj42.Set(new ClOrdID(ocrj44.ClOrdID.getValue()));
                }
                // if (ocrj44.IsSetClOrdLinkID()) ocrj42.Set(new ClOrdLinkID(ocrj44.ClOrdLinkID.getValue())); // Not Found on 4.2
                if (ocrj44.IsSetOrigClOrdID())
                {
                    ocrj42.Set(new OrigClOrdID(ocrj44.OrigClOrdID.getValue()));
                }
                if (ocrj44.IsSetOrdStatus())
                {
                    ocrj42.Set(new OrdStatus(ocrj44.OrdStatus.getValue()));
                }
                // if (ocrj44.IsSetWorkingIndicator()) ocrj42.Set(new WorkingIndicator(ocrj44.WorkingIndicator.getValue())); // Not found on 4.2
                // if (ocrj44.IsSetOrigOrdModTime()) ocrj42.Set(new OrigOrdModTime(ocrj44.OrigOrdModTime.getValue())); // Not found on 4.2
                if (ocrj44.IsSetListID())
                {
                    ocrj42.Set(new ListID(ocrj44.ListID.getValue()));
                }
                if (ocrj44.IsSetAccount())
                {
                    ocrj42.Set(new Account(ocrj44.Account.getValue()));
                }
                // if (ocrj44.IsSetAcctIDSource()) ocrj42.Set(new AcctIDSource(ocrj44.AcctIDSource.getValue())); // Not found on 4.2
                // if (ocrj44.IsSetAccountType()) ocrj42.Set(new AccountType(ocrj44.AccountType.getValue())); // Not found on 4.2
                // if (ocrj44.IsSetTradeOriginationDate()) ocrj42.Set(new TradeOriginationDate(ocrj44.TradeOriginationDate.getValue())); // Not found on 4.2
                // if (ocrj44.IsSetTradeDate()) ocrj42.Set(new TradeDate(ocrj44.TradeDate.getValue())); // Not found on 4.2
                if (ocrj44.IsSetTransactTime())
                {
                    ocrj42.Set(new TransactTime(ocrj44.TransactTime.getValue()));
                }
                if (ocrj44.IsSetCxlRejResponseTo())
                {
                    ocrj42.Set(new CxlRejResponseTo(ocrj44.CxlRejResponseTo.getValue()));
                }
                // if (ocrj44.IsSetCxlRejReason()) ocrj42.Set(new CxlRejReason(ocrj44.CxlRejReason.getValue()));
                // TODO [FF]: Verify value pattern: Set to "2": BROKER OPTION and describe rejection in text field
                if (ocrj44.IsSetCxlRejReason())
                {
                    ocrj42.Set(new CxlRejReason(CxlRejReason.BROKER_OPTION));
                }
                if (ocrj44.IsSetText())
                {
                    ocrj42.Set(new Text(ocrj44.Text.getValue()));
                }
                if (ocrj44.IsSetEncodedTextLen())
                {
                    ocrj42.Set(new EncodedTextLen(ocrj44.EncodedTextLen.getValue()));
                }
                if (ocrj44.IsSetEncodedText())
                {
                    ocrj42.Set(new EncodedText(ocrj44.EncodedText.getValue()));
                }
                if (ocrj44.IsSetMemo())
                {
                    ocrj42.SetField(new Memo(ocrj44.Memo.getValue()));
                }

                return(ocrj42);
            }
            catch (Exception ex)
            {
                logger.Error("Fix44OCR_2_Fix42OCR(): " + ex.Message, ex);
                return(null);
            }
        }
        protected void RejectCancelRequest(QuickFix.SessionID session, QuickFix.Fields.ClOrdID clordid, QuickFix.Fields.OrigClOrdID origordid, IOrder nt7_order, string rej_reason, int cxl_rej, bool is_cancelreplace_request)
        {
            QuickFix.FIX42.OrderCancelReject rej = new QuickFix.FIX42.OrderCancelReject();
            if (nt7_order == null)
                rej.Set(new QuickFix.Fields.OrderID("NONE"));
            else
                rej.Set(new QuickFix.Fields.OrderID(clordid.getValue()));

            rej.Set(origordid);
            rej.Set(Converter.c(nt7_order.OrderState));
            rej.Set(new QuickFix.Fields.CxlRejResponseTo(is_cancelreplace_request ? QuickFix.Fields.CxlRejResponseTo.ORDER_CANCEL_REPLACE_REQUEST : QuickFix.Fields.CxlRejResponseTo.ORDER_CANCEL_REQUEST));
            rej.Set(new QuickFix.Fields.CxlRejReason(cxl_rej));
            rej.Set(new QuickFix.Fields.Text(rej_reason));
            rej.Set(new QuickFix.Fields.TransactTime(DateTime.Now, true));

            QuickFix.Session.SendToTarget(rej, session);
        }
Beispiel #4
0
        public static QuickFix.FIX42.OrderCancelReject Fix42Reject2OrderCancelReject(QuickFix.Message msgReject, QuickFix.Message msgOri)
        {
            try
            {
                QuickFix.FIX42.OrderCancelReject ocr = new QuickFix.FIX42.OrderCancelReject();

                if (msgOri.IsSetField(Tags.OrderID))
                {
                    ocr.Set(new OrderID(msgOri.GetString(Tags.OrderID)));
                }
                else
                {
                    ocr.Set(new OrderID("NONE"));
                }
                if (msgOri.IsSetField(Tags.SecondaryOrderID))
                {
                    ocr.Set(new SecondaryOrderID(msgOri.GetString(Tags.SecondaryOrderID)));
                }
                if (msgOri.IsSetField(Tags.ClOrdID))
                {
                    ocr.Set(new ClOrdID(msgOri.GetString(Tags.ClOrdID)));
                }
                if (msgOri.IsSetField(Tags.OrigClOrdID))
                {
                    ocr.Set(new OrigClOrdID(msgOri.GetString(Tags.OrigClOrdID)));
                }
                ocr.Set(new OrdStatus(OrdStatus.REJECTED));
                // if (msgOri.IsSetField(Tags.ClientID)) ocr.Set(new ClientID(msgOri.GetString(Tags.ClientID))); // not found on 4.4EP
                // TODO[FF] - Verificar a montagem do execbroker a partir de party ids
                // if (msgOri.IsSetField(Tags.ExecBroker)) ocr.Set(new ExecBroker(msgOri.GetString(Tags.ExecBroker))); // not found on 4.4EP
                if (msgOri.IsSetField(Tags.ListID))
                {
                    ocr.Set(new ListID(msgOri.GetString(Tags.ListID)));
                }
                if (msgOri.IsSetField(Tags.Account))
                {
                    ocr.Set(new Account(msgOri.GetString(Tags.Account)));
                }
                if (msgOri.IsSetField(Tags.TransactTime))
                {
                    ocr.Set(new TransactTime(msgOri.GetDateTime(Tags.TransactTime)));
                }
                if (msgOri.Header.GetString(Tags.MsgType).Equals(MsgType.ORDER_CANCEL_REQUEST)) // mandatory
                {
                    ocr.Set(new CxlRejResponseTo('1'));
                }
                else
                {
                    ocr.Set(new CxlRejResponseTo('2'));
                }
                //if (msgOri.IsSetField(Tags.CxlRejReason)) ocr.Set(new CxlRejReason(msgOri.GetInt(Tags.CxlRejReason)));
                if (msgOri.IsSetField(Tags.CxlRejReason))
                {
                    ocr.Set(new CxlRejReason(CxlRejReason.BROKER_OPTION));
                }
                if (msgOri.IsSetField(Tags.Text))
                {
                    ocr.Set(new Text(msgOri.GetString(Tags.Text)));
                }
                if (msgOri.IsSetField(Tags.EncodedTextLen))
                {
                    ocr.Set(new EncodedTextLen(msgOri.GetInt(Tags.EncodedTextLen)));
                }
                if (msgOri.IsSetField(Tags.EncodedText))
                {
                    ocr.Set(new EncodedText(msgOri.GetString(Tags.EncodedText)));
                }
                if (msgOri.IsSetField(Tags.Memo))
                {
                    ocr.SetField(new Memo(msgOri.GetString(Tags.Memo)));
                }

                /*
                 * if (msgOri.IsSetField(Tags.OrderID))
                 *  ocr.Set(new OrderID(msgOri.GetString(Tags.OrderID)));
                 * else
                 *  ocr.Set(new OrderID("NONE"));
                 * ocr.Set(new ClOrdID(msgOri.GetString(Tags.ClOrdID)));           // mandatory
                 * ocr.Set(new OrigClOrdID(msgOri.GetString(Tags.OrigClOrdID)));   // mandatory
                 * ocr.Set(new OrdStatus(OrdStatus.REJECTED));                     // mandatory
                 * if (msgOri.IsSetField(Tags.Account))
                 *  ocr.SetField(new Account(msgOri.GetString(Tags.Account)));
                 * if (msgOri.Header.GetString(Tags.MsgType).Equals(MsgType.ORDER_CANCEL_REQUEST)) // mandatory
                 *  ocr.Set(new CxlRejResponseTo('1'));
                 * else
                 *  ocr.Set(new CxlRejResponseTo('2'));
                 * if (msgReject.IsSetField(Tags.Text))
                 *  ocr.Set(new Text(msgReject.GetString(Tags.Text)));
                 * int len = msgOri.GetInt(Tags.NoPartyIDs);
                 * for (int i = 0; i < len; i++)
                 * {
                 *  Group grp = msgOri.GetGroup(i + 1, Tags.NoPartyIDs);
                 *  ocr.AddGroup(grp);
                 * }
                 * ocr.SetField(new Symbol(msgOri.GetString(Tags.Symbol)));
                 * if (msgOri.IsSetField(Tags.SecurityID)) ocr.SetField(new SecurityID(msgOri.GetField(Tags.SecurityID)));
                 * if (msgOri.IsSetField(Tags.SecurityIDSource)) ocr.SetField(new SecurityIDSource(msgOri.GetField(Tags.SecurityIDSource)));
                 * ocr.SetField(new Side(msgOri.GetChar(Tags.Side)));
                 * if (msgOri.IsSetField(Tags.Memo))
                 *  ocr.SetField(new Memo(msgOri.GetString(Tags.Memo)));
                 */
                return(ocr);
            }
            catch (Exception ex)
            {
                logger.Error("Fix42Reject2OrderCancelReject(): " + ex.Message, ex);
                return(null);
            }
        }