Exemple #1
0
        public bool SENT_REJECT(int reason, int refTag)
        {
            if (!SENT_REJECT())
            {
                return(false);
            }

            QuickFix.Message msg = responder.msgLookup[QuickFix.Fields.MsgType.REJECT].First();

            if (!msg.IsSetField(QuickFix.Fields.Tags.SessionRejectReason))
            {
                return(false);
            }

            QuickFix.Fields.SessionRejectReason reasonField = new QuickFix.Fields.SessionRejectReason();
            msg.GetField(reasonField);
            if (reasonField.getValue() != reason)
            {
                return(false);
            }

            if (!msg.IsSetField(QuickFix.Fields.Tags.RefTagID))
            {
                return(false);
            }

            QuickFix.Fields.RefTagID refTagField = new QuickFix.Fields.RefTagID();
            msg.GetField(refTagField);
            if (refTagField.getValue() != refTag)
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        public void UnwrapMessage_Ok()
        {
            // arrange
            var jsonFixMsg = new JsonFixMessage
            {
                localPseudoHeader = "myPseudoHeader",
                rawFixPayload     = "8=FIX.4.2\u00019=67\u000135=D\u000111=0001\u000121=1\u000138=10\u000140=1\u000154=1\u000155=AAPL\u000160=20181013-00:00:00.000\u000110=078\u0001",
            };

            // act
            QuickFix.Message fixMsg = _jsonFixWrapper.Unwrap(jsonFixMsg);

            // assert
            var expectedTransactTime = new DateTime(2018, 10, 13).Date;
            var expectedTicker       = "AAPL";
            var expectedQty          = 10m;

            Assert.Equal(expectedTicker, fixMsg.GetField(55));
            Assert.Equal(expectedTransactTime, fixMsg.GetField(new QuickFix.Fields.TransactTime()).getValue());
            Assert.Equal(expectedQty, fixMsg.GetField(new QuickFix.Fields.OrderQty()).getValue());
        }
Exemple #3
0
        public void UnwrapMessage_Ok_Sample2()
        {
            // arrange
            var jsonFixMsg = new JsonFixMessage
            {
                localPseudoHeader = "myPseudoHeader",
                // rawFixPayload = "8=FIX.4.2\u00019=67\u000135=D\u000111=0001\u000121=1\u000138=10\u000140=1\u000154=1\u000155=AAPL\u000160=20181013-00:00:00.000\u000110=078\u0001",
                rawFixPayload = "8=FIX.4.2\u00019=00\u000135=D\u000149=Sender\u000156=Target\u000134=0\u000152=99990909-17:17:17.777\u000154=1\u000155=ABC\u000111=BUY000000001\u000138=1000\u000140=2\u000144=1001.000\u000159=3\u0001117=A001\u000146=A001\u000110=000\u0001"
            };

            // act
            QuickFix.Message fixMsg = _jsonFixWrapper.Unwrap(jsonFixMsg);

            // assert
            var expectedTicker = "ABC";

            Assert.Equal(expectedTicker, fixMsg.GetField(55));
        }
Exemple #4
0
        public bool SENT_BUSINESS_REJECT(int reason)
        {
            if (!SENT_BUSINESS_REJECT())
            {
                return(false);
            }

            QuickFix.Message msg = responder.msgLookup[QuickFix.Fields.MsgType.BUSINESS_MESSAGE_REJECT].First();

            if (!msg.IsSetField(QuickFix.Fields.Tags.BusinessRejectReason))
            {
                return(false);
            }

            QuickFix.Fields.BusinessRejectReason reasonField = new QuickFix.Fields.BusinessRejectReason();
            msg.GetField(reasonField);
            if (reasonField.getValue() != reason)
            {
                return(false);
            }

            return(true);
        }
Exemple #5
0
    public void FromApp(QuickFix.Message msg, SessionID sessionID)
    {
        var sMsg = "FROM APP: " + msg.ToString();

        AddToLB(sMsg, null);
        if (msg.Header.GetField(35) == "TC")     //Cash
        {
            DateTime dtTdate;
            float    fPrice;
            int      Qty;
            int      OrdType;
            bool     BPisBuyer;
            DateTime.TryParse(msg.GetField(CustomConstants.TDATE), out dtTdate);
            string BPSide = msg.GetField(CustomConstants.BP_SIDE);
            float.TryParse(msg.GetField(CustomConstants.F_PRICE), out fPrice);
            int.TryParse(msg.GetField(CustomConstants.QTY), out Qty);
            string TCTReference = msg.GetField(CustomConstants.TCT_REF);
            string BPAcct       = msg.GetField(CustomConstants.BP_COMPANY);
            int.TryParse(msg.GetField(CustomConstants.ORDER_TYPE), out OrdType);
            string ExecBkr      = msg.GetField(CustomConstants.EXEC_BKR);
            string CounterParty = msg.GetField(CustomConstants.COUNTER_PARTY);
            BPisBuyer = msg.GetField(CustomConstants.IS_BUYER) == "Y";
            string BPTrader      = msg.GetField(CustomConstants.BP_TRADER);
            string CounterTrader = msg.GetField(CustomConstants.COUNTER_TRADER);
            string Grade         = msg.GetField(CustomConstants.GRADE);
            string Location      = msg.GetField(CustomConstants.LOCATION);
            string CycDt         = msg.GetField(CustomConstants.CYCLE_DATE);
            string DelMo         = msg.GetField(CustomConstants.DELIVER_MONTH);
            string Terms         = msg.GetField(CustomConstants.TERMS);
            string Payment       = msg.GetField(CustomConstants.PAYMENT);
            string Origin        = msg.GetField(CustomConstants.ORIGIN);
            string NumOfCyc      = msg.GetField(CustomConstants.NUM_OF_CYCLES);
            string Via           = msg.GetField(CustomConstants.VIA);
            string MoveMo        = msg.GetField(CustomConstants.MOVE_MONTH);
            string Comment       = msg.GetField(CustomConstants.COMMENT);
        }
        else if (msg.Header.GetField(35) == "TE")     //EFP
        {
            DateTime dtTdate;
            float    fPrice;
            int      Qty;
            int      OrdType;
            bool     BPisBuyer;
            bool     IsWater;
            DateTime.TryParse(msg.GetField(CustomConstants.TDATE), out dtTdate);
            string BPSide = msg.GetField(CustomConstants.BP_SIDE);
            float.TryParse(msg.GetField(CustomConstants.F_PRICE), out fPrice);
            int.TryParse(msg.GetField(CustomConstants.QTY), out Qty);
            string TCTReference = msg.GetField(CustomConstants.TCT_REF);
            string BPAcct       = msg.GetField(CustomConstants.BP_COMPANY);
            int.TryParse(msg.GetField(CustomConstants.ORDER_TYPE), out OrdType);
            string ExecBkr      = msg.GetField(CustomConstants.EXEC_BKR);
            string CounterParty = msg.GetField(CustomConstants.COUNTER_PARTY);
            BPisBuyer = msg.GetField(CustomConstants.IS_BUYER) == "Y";
            string BPTrader      = msg.GetField(CustomConstants.BP_TRADER);
            string CounterTrader = msg.GetField(CustomConstants.COUNTER_TRADER);
            string Grade         = msg.GetField(CustomConstants.GRADE);
            string Location      = msg.GetField(CustomConstants.LOCATION);
            string CycDt         = msg.GetField(CustomConstants.CYCLE_DATE);
            string DelMo         = msg.GetField(CustomConstants.DELIVER_MONTH);
            string Terms         = msg.GetField(CustomConstants.TERMS);
            string Payment       = msg.GetField(CustomConstants.PAYMENT);
            string Origin        = msg.GetField(CustomConstants.ORIGIN);
            string NumOfCyc      = msg.GetField(CustomConstants.NUM_OF_CYCLES);
            string Via           = msg.GetField(CustomConstants.VIA);
            string MoveMo        = msg.GetField(CustomConstants.MOVE_MONTH);
            string Comment       = msg.GetField(CustomConstants.COMMENT);
            IsWater = msg.GetField(CustomConstants.ISWATER) == "Y";
            string BPFloorBkr      = msg.GetField(CustomConstants.BP_FLOOR_BKR);
            string CounterFloorBkr = msg.GetField(CustomConstants.COUNTER_FLOOR_BKR);
            string Diff            = msg.GetField(CustomConstants.DIFFERENCE);
            string MercMo          = msg.GetField(CustomConstants.MERC_MO);
            string MercPr          = msg.GetField(CustomConstants.MERC_PRICE);
        }
        else if (msg.Header.GetField(35) == "TI")     //Index
        {
            DateTime dtTdate;
            float    fPrice;
            int      Qty;
            int      OrdType;
            bool     BPisBuyer;
            bool     IsWater;
            DateTime.TryParse(msg.GetField(CustomConstants.TDATE), out dtTdate);
            string BPSide = msg.GetField(CustomConstants.BP_SIDE);
            float.TryParse(msg.GetField(CustomConstants.F_PRICE), out fPrice);
            int.TryParse(msg.GetField(CustomConstants.QTY), out Qty);
            string TCTReference = msg.GetField(CustomConstants.TCT_REF);
            string BPAcct       = msg.GetField(CustomConstants.BP_COMPANY);
            int.TryParse(msg.GetField(CustomConstants.ORDER_TYPE), out OrdType);
            string ExecBkr      = msg.GetField(CustomConstants.EXEC_BKR);
            string CounterParty = msg.GetField(CustomConstants.COUNTER_PARTY);
            BPisBuyer = msg.GetField(CustomConstants.IS_BUYER) == "Y";
            string BPTrader      = msg.GetField(CustomConstants.BP_TRADER);
            string CounterTrader = msg.GetField(CustomConstants.COUNTER_TRADER);
            string Grade         = msg.GetField(CustomConstants.GRADE);
            string Location      = msg.GetField(CustomConstants.LOCATION);
            string CycDt         = msg.GetField(CustomConstants.CYCLE_DATE);
            string DelMo         = msg.GetField(CustomConstants.DELIVER_MONTH);
            string Terms         = msg.GetField(CustomConstants.TERMS);
            string Payment       = msg.GetField(CustomConstants.PAYMENT);
            string Origin        = msg.GetField(CustomConstants.ORIGIN);
            string NumOfCyc      = msg.GetField(CustomConstants.NUM_OF_CYCLES);
            string Via           = msg.GetField(CustomConstants.VIA);
            string MoveMo        = msg.GetField(CustomConstants.MOVE_MONTH);
            string Comment       = msg.GetField(CustomConstants.COMMENT);
            IsWater = msg.GetField(CustomConstants.ISWATER) == "Y";
            string BPFloorBkr      = msg.GetField(CustomConstants.BP_FLOOR_BKR);
            string CounterFloorBkr = msg.GetField(CustomConstants.COUNTER_FLOOR_BKR);
            string Diff            = msg.GetField(CustomConstants.DIFFERENCE);
            string MercMo          = msg.GetField(CustomConstants.MERC_MO);
            string MercPr          = msg.GetField(CustomConstants.MERC_PRICE);
        }
    }