Esempio n. 1
0
        public bool Send(string msgStr)
        {
            QuickFix.Fields.MsgType msgType = QuickFix.Message.IdentifyType(msgStr);
            string beginString = QuickFix.Message.ExtractBeginString(msgStr);

            QuickFix.Message message = messageFactory.Create(beginString, msgType.Obj);
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            message.FromString(msgStr, false, dd, dd, _defaultMsgFactory);

            if (!msgLookup.ContainsKey(msgType.getValue()))
                msgLookup.Add(msgType.getValue(), new Queue<QuickFix.Message>());

            msgLookup[msgType.getValue()].Enqueue(message);

            QuickFix.Fields.PossDupFlag possDup = new QuickFix.Fields.PossDupFlag(false);
            if (message.Header.IsSetField(possDup))
                message.Header.GetField(possDup);

            if (possDup.getValue() && msgType.getValue()!= QuickFix.Fields.MsgType.SEQUENCE_RESET)
            {
                dups.Enqueue(message);
            }

            return true;
        }
 public void FieldHasDescriptionTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/fix/FIX44.xml");
     Assert.AreEqual(typeof (Dictionary<string, string>), dd.FieldsByTag[945].EnumDict.GetType());
     Assert.That("COMPLETED", Is.EqualTo(dd.FieldsByTag[945].EnumDict["2"]));
     Assert.AreNotEqual("HEARTBEAT", dd.FieldsByTag[35].EnumDict["A"]);
 }
 public void ComponentSmokeTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/fix/FIX44.xml");
     QuickFix.DataDictionary.DDMap tcr = dd.Messages["AE"];
     Assert.True(tcr.Fields.ContainsKey(55));
     Assert.False(tcr.Fields.ContainsKey(5995));
 }
        public FixMessageVisualizer(string message, IFixDictionarySource source)
        {
            QuickFix.DataDictionary.DataDictionary dict = new QuickFix.DataDictionary.DataDictionary();

            _message = message;

            _dicSource = source;
        }
 public void VersionTest()
 {
     QuickFix.DataDictionary.DataDictionary dd44 = new QuickFix.DataDictionary.DataDictionary();
     dd44.Load("../../../spec/fix/FIX44.xml");
     Assert.That(dd44.MajorVersion, Is.EqualTo("4"));
     Assert.That(dd44.MinorVersion, Is.EqualTo("4"));
     Assert.That(dd44.Version, Is.EqualTo("FIX.4.4"));
 }
 public void LoadFieldsTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/fix/FIX44.xml");
     Assert.That(dd.FieldsByTag[1].Name, Is.EqualTo("Account"));
     Assert.That(dd.FieldsByName["Account"].Tag, Is.EqualTo(1));
     Assert.That(dd.FieldsByTag[1].EnumDict.Count, Is.EqualTo(0));
     Assert.That(dd.FieldsByTag[QuickFix.Fields.Tags.StatusValue].EnumDict.Count, Is.EqualTo(4));
 }
 public void FieldHasValueTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/fix/FIX44.xml");
     Assert.That(dd.FieldHasValue(QuickFix.Fields.Tags.StatusValue, "1"), Is.EqualTo(true));
     Assert.That(dd.FieldHasValue(QuickFix.Fields.Tags.StatusValue, "CONNECTED"), Is.EqualTo(false));
     Assert.False(dd.FieldsByTag[1].HasEnums());
     Assert.True(dd.FieldsByTag[945].HasEnums());
 }
 public void HeaderGroupTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/fix/FIX44.xml");
     QuickFix.DataDictionary.DDMap headerMap = dd.Header;
     Assert.True(headerMap.IsGroup(627));
     QuickFix.DataDictionary.DDGrp grpMap = headerMap.GetGroup(627);
     Assert.True(dd.Header.GetGroup(627).IsField(628));
     Assert.True(grpMap.IsField(628));
 }
		public void LoadFieldsFromStreamTest()
		{
			QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
			Stream stream = new FileStream("../../../spec/fix/FIX44.xml", FileMode.Open, FileAccess.Read);
			dd.Load(stream);
			Assert.That(dd.FieldsByTag[1].Name, Is.EqualTo("Account"));
			Assert.That(dd.FieldsByName["Account"].Tag, Is.EqualTo(1));
			Assert.That(dd.FieldsByTag[1].EnumDict.Count, Is.EqualTo(0));
			Assert.That(dd.FieldsByTag[QuickFix.Fields.Tags.StatusValue].EnumDict.Count, Is.EqualTo(4));
		}
Esempio n. 10
0
        public void CheckIsInGroupTest()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.DataDictionary.DDGrp g = dd.Messages["B"].GetGroup(33);

            QuickFix.Fields.Text textField = new QuickFix.Fields.Text("woot");
            QuickFix.Fields.ClOrdID clOrdIdField = new QuickFix.Fields.ClOrdID("not woot");

            Assert.DoesNotThrow(delegate() { dd.CheckIsInGroup(textField, g, "B"); });
            Assert.Throws(typeof(TagNotDefinedForMessage), delegate { dd.CheckIsInGroup(clOrdIdField, g, "B"); });
        }
 public void GroupTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/fix/FIX44.xml");
     QuickFix.DataDictionary.DDMap tcrr = dd.Messages["AD"];
     Assert.True(tcrr.IsGroup(711));
     Assert.True(tcrr.IsField(711));  // No Field also a field
     Assert.True(tcrr.GetGroup(711).IsField(311));
     Assert.That(tcrr.Groups[711].Fields[311].Name, Is.EqualTo("UnderlyingSymbol"));
     Assert.That(tcrr.Groups[711].Delim, Is.EqualTo(311));
     QuickFix.DataDictionary.DDMap tcr = dd.Messages["AE"];
     Assert.That(tcr.Groups[711].Groups[457].Fields[458].Name, Is.EqualTo("UnderlyingSecurityAltID"));
 }
Esempio n. 12
0
        public void RequiredComponentRequiredField()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.LoadFIXSpec("FIX44");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=76", "35=7", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "2=AdvId",   "5=N",  "4=B",  "53=1", "10=138" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "7";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            var ex = Assert.Throws <QuickFix.RequiredTagMissing>(delegate { dd.Validate(message, beginString, msgType); });

            Assert.AreEqual(55, ex.Field);
        }
Esempio n. 13
0
        public void MissingDelimiterField()
        {
            // issue 101

            var dd = new QuickFix.DataDictionary.DataDictionary();

            dd.Load("../../../spec/fix/FIX44.xml");

            // message is missing 703
            string[] msgFields = { "8=FIX.4.4",             "9=230",       "35=AP", "34=3",        "49=XXXXX", "52=20120731-14:06:37.848", "56=FixKevindemo",
                                   "1=20050500001",         "55=EURUSD",   "453=0", "581=1",       "702=1",    "704=0",                    "705=20000",      "710=634792896000000000","715=20120802",
                                   "721=P-DEA30E1PHC0IW7V", "730=1.22608", "731=1", "734=1.22608", "753=1",    "708=20000",                "10=030" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            QuickFix.FIX44.PositionReport msg = new QuickFix.FIX44.PositionReport();

            QuickFix.GroupDelimiterTagException ex =
                Assert.Throws <QuickFix.GroupDelimiterTagException>(delegate { msg.FromString(msgStr, true, dd, dd, _defaultMsgFactory); });
            Assert.AreEqual(702, ex.Field);
            Assert.AreEqual("Group 702's first entry does not start with delimiter 703", ex.Message);
        }
Esempio n. 14
0
        public void RepeatingGroupParseGroupTest()
        {
            String data = "8=FIX.4.4\x01" + "9=309\x01" + "35=8\x01" + "49=ASX\x01" + "56=CL1_FIX44\x01" + "34=4\x01" + "52=20060324-01:05:58\x01" + ""
                          + "17=X-B-WOW-1494E9A0:58BD3F9D-1109\x01" + "150=D\x01" + "39=0\x01" + "11=184271\x01" + "38=200\x01" + "198=1494E9A0:58BD3F9D\x01" + ""
                          + "526=4324\x01" + "37=B-WOW-1494E9A0:58BD3F9D\x01" + "55=WOW\x01" + "54=1\x01" + "151=200\x01" + "14=0\x01" + "40=2\x01" + "44=15\x01" + "59=1\x01" + "6=0\x01" + ""
                          + "453=3\x01"
                          + "448=AAA35791\x01" + "447=D\x01" + "452=3\x01" + "802=1\x01" + "523=OHAI123\x01"
                          + "448=8\x01" + "447=D\x01" + "452=4\x01" + "448=FIX11\x01" + "447=D\x01" + "452=36\x01" + ""
                          + "60=20060320-03:34:29\x01" + "10=169\x01" + "";
            var msg = new QuickFix.FIX44.ExecutionReport();
            var dd  = new QuickFix.DataDictionary.DataDictionary();

            dd.Load("../../../spec/fix/FIX44.xml");
            msg.FromString(data, false, dd, dd, _defaultMsgFactory);

            var grp = msg.GetGroup(1, Tags.NoPartyIDs);

            Assert.That(grp.GetString(Tags.PartyID), Is.EqualTo("AAA35791"));
            grp = msg.GetGroup(3, Tags.NoPartyIDs);
            Assert.That(grp.GetString(Tags.PartyID), Is.EqualTo("FIX11"));
        }
Esempio n. 15
0
        public void ValidateWrongType()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.LoadFIXSpec("FIX44");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4",  "9=120",  "35=D", "34=3",                     "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "11=clordid", "55=sym", "54=1", "60=20110909-09:09:09.999", "40=1",
                                   "38=failboat",// should be a decimal
                                   "10=64" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "D";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectDataFormat>());
        }
Esempio n. 16
0
        [Test] // Issue #66
        public void ValidateMultipleValueStringType_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.LoadFIXSpec("FIX44");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=99",  "35=W",       "34=3",  "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "55=sym",
                                   "268=1",     "269=0", "270=123.23", "271=2", "277=A 1",
                                   "10=196" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectTagValue>());
        }
Esempio n. 17
0
        public void OptionalComponentRequiredField()
        {
            // issue #98 - message erroneously rejected because DD says that
            //   component-required field is missing even though component is not present

            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4",      "9=77",  "35=AD", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "568=tradereqid", "569=0", "10=109" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "AD";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
Esempio n. 18
0
        public void ReadInput()
        {
            var file = File.ReadLines("03.JSE_Indices_recv_log.txt").ToList();
            var line = file.FirstOrDefault();

            var dd = new QuickFix.DataDictionary.DataDictionary();

            var log = line.Split(' ');

            line = log[1];

            var factory = new QuickFix.DefaultMessageFactory();

            var msgType = Message.IdentifyType(line);

            Message msg = factory.Create("", msgType.getValue());

            msg.FromString(line, true, dd, dd, factory);

            Assert.AreEqual("0", msgType.Obj);
        }
Esempio n. 19
0
        public void CheckValue()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.LoadFIXSpec("FIX44");

            // unknown field
            Assert.DoesNotThrow(delegate { dd.CheckValue(new QuickFix.Fields.CharField(20, '0')); });
            // not an enum
            Assert.DoesNotThrow(delegate { dd.CheckValue(new QuickFix.Fields.ListSeqNo(5)); });
            // regular enum, ok
            Assert.DoesNotThrow(delegate { dd.CheckValue(new QuickFix.Fields.TickDirection('2')); });
            // multiple-value field, ok
            Assert.DoesNotThrow(delegate { dd.CheckValue(new QuickFix.Fields.QuoteCondition("A C D")); });

            // regular enum, invalid value
            Assert.Throws(typeof(IncorrectTagValue),
                          delegate { dd.CheckValue(new QuickFix.Fields.TickDirection('9')); });
            // multiple-value field, one value is invalid
            Assert.Throws(typeof(IncorrectTagValue),
                          delegate { dd.CheckValue(new QuickFix.Fields.QuoteCondition("A @ D")); });
        }
        public void CheckGroupCountTest()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX42.xml");

            QuickFix.FIX42.NewOrderSingle n = new QuickFix.FIX42.NewOrderSingle();

            string nul = Message.SOH;
            string s = "8=FIX.4.2" + nul + "9=148" + nul + "35=D" + nul + "34=2" + nul + "49=TW" + nul + "52=20111011-15:06:23.103" + nul + "56=ISLD" + nul
                + "11=ID" + nul + "21=1" + nul + "40=1" + nul + "54=1" + nul + "38=200.00" + nul + "55=INTC" + nul
                + "386=3" + nul + "336=PRE-OPEN" + nul + "336=AFTER-HOURS" + nul
                + "60=20111011-15:06:23.103" + nul
                + "10=35" + nul;

            n.FromString(s, true, dd, dd);

            //verify that FromString didn't correct the counter (if these fail, check if MessageTests::FromString_DoNotCorrectCounter() passes)
            Assert.AreEqual("386=3", n.NoTradingSessions.toStringField());
            StringAssert.Contains("386=3", n.ToString());

            Assert.Throws<QuickFix.RepeatingGroupCountMismatch>(delegate { dd.CheckGroupCount(n.NoTradingSessions, n, "D"); });
        }
Esempio n. 21
0
        public void RepeatingGroup_ReuseObject()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.Load("../../../spec/fix/FIX42.xml");

            QuickFix.FIX42.News news = new QuickFix.FIX42.News(new QuickFix.Fields.Headline("Foo headline"));

            QuickFix.FIX42.News.LinesOfTextGroup group = new QuickFix.FIX42.News.LinesOfTextGroup();
            group.Text = new QuickFix.Fields.Text("line1");
            news.AddGroup(group);
            group.Text = new QuickFix.Fields.Text("line2");
            news.AddGroup(group);

            string raw = news.ToString();

            string nul = "\x01";

            StringAssert.Contains(
                nul + "33=2" + nul + "58=line1" + nul + "58=line2",
                raw);
        }
Esempio n. 22
0
        [Test] // Issue #282 investigation
        public void ValidateTagSpecifiedWithoutAValue()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX42.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.2", "9=65", "35=B", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "148=",      "33=0", "10=188" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "B";
            string beginString = "FIX.4.2";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd);

            dd.CheckFieldsHaveValues = true;
            Assert.Throws <QuickFix.NoTagValue>(delegate { dd.Validate(message, beginString, msgType); });

            dd.CheckFieldsHaveValues = false;
            Assert.DoesNotThrow(delegate { dd.Validate(message, beginString, msgType); });
        }
Esempio n. 23
0
        public void issue56_GetGroup_by_reference()
        {
            // setup
            var dd = new QuickFix.DataDictionary.DataDictionary();

            dd.Load("../../../spec/fix/FIX44.xml");
            string[] msgFields = { "8=FIX.4.2", "9=87", "35=B", "34=3", "49=CLIENT1", "52=20111012-22:15:55.474", "56=EXECUTOR", "148=AAAAAAA", "33=2", "58=L1", "58=L2", "10=016" };
            string   msgStr    = String.Join(Message.SOH, msgFields) + Message.SOH;

            QuickFix.FIX42.News msg = new QuickFix.FIX42.News();
            msg.FromString(msgStr, false, dd, dd, _defaultMsgFactory);
            Assert.AreEqual(2, msg.GroupCount(Tags.LinesOfText)); // for sanity

            // the test
            QuickFix.FIX42.News.LinesOfTextGroup grp = new QuickFix.FIX42.News.LinesOfTextGroup(); // for return value

            msg.GetGroup(1, grp);
            Assert.AreEqual("L1", grp.Text.Obj);

            msg.GetGroup(2, grp);
            Assert.AreEqual("L2", grp.Text.Obj);
        }
Esempio n. 24
0
        public void CheckGroupCountTest()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX42.xml");

            QuickFix.FIX42.NewOrderSingle n = new QuickFix.FIX42.NewOrderSingle();

            string nul = Message.SOH;
            string s   = "8=FIX.4.2" + nul + "9=148" + nul + "35=D" + nul + "34=2" + nul + "49=TW" + nul + "52=20111011-15:06:23.103" + nul + "56=ISLD" + nul
                         + "11=ID" + nul + "21=1" + nul + "40=1" + nul + "54=1" + nul + "38=200.00" + nul + "55=INTC" + nul
                         + "386=3" + nul + "336=PRE-OPEN" + nul + "336=AFTER-HOURS" + nul
                         + "60=20111011-15:06:23.103" + nul
                         + "10=35" + nul;

            n.FromString(s, true, dd, dd, _defaultMsgFactory);

            //verify that FromString didn't correct the counter
            //HEY YOU, READ THIS NOW: if these fail, first check if MessageTests::FromString_DoNotCorrectCounter() passes
            Assert.AreEqual("386=3", n.NoTradingSessions.toStringField());
            StringAssert.Contains("386=3", n.ToString());

            Assert.Throws <QuickFix.RepeatingGroupCountMismatch>(delegate { dd.CheckGroupCount(n.NoTradingSessions, n, "D"); });
        }
Esempio n. 25
0
        public void DateOnlyTimeOnlyConvertProblem()
        {
            // issue 135

            var dd = new QuickFix.DataDictionary.DataDictionary();

            dd.Load("../../../spec/fix/FIX44.xml");

            string[] msgFields = { "8=FIX.4.4", "9=332",           "35=W",     "34=2",                                     "49=MA",        "52=20121024-12:21:42.170", "56=xxxx",
                                   "22=4",      "48=BE0932900518", "55=[N/A]", "262=1b145288-9c9a-4911-a084-7341c69d3e6b", "762=EURO_EUR", "268=2",
                                   "269=0",     "270=97.625",      "15=EUR",   "271=1246000",                              "272=20121024", "273=07:30:47",             "276=I",  "282=BEARGB21XXX",  "299=15478575",
                                   "269=1",     "270=108.08",      "15=EUR",   "271=884000",                               "272=20121024", "273=07:30:47",             "276=I",  "282=BEARGB21XXX",  "299=15467902", "10=77" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            QuickFix.FIX44.MarketDataSnapshotFullRefresh msg = new QuickFix.FIX44.MarketDataSnapshotFullRefresh();

            msg.FromString(msgStr, true, dd, dd, _defaultMsgFactory);
            QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup gentry1 = (QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup)msg.GetGroup(1, new QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup());
            Assert.AreEqual(new DateTime(2012, 10, 24), gentry1.MDEntryDate.getValue());
            Assert.AreEqual(new DateTime(2012, 10, 24, 7, 30, 47).TimeOfDay, gentry1.MDEntryTime.getValue().TimeOfDay);
            Assert.AreEqual(new DateTime(2012, 10, 24, 7, 30, 47), gentry1.MDEntryDate.getValue() + gentry1.MDEntryTime.getValue().TimeOfDay);
        }
Esempio n. 26
0
        public void DateOnlyTimeOnlyConvertProblem()
        {
            // issue 135

            var dd = new QuickFix.DataDictionary.DataDictionary();
            dd.Load("../../../spec/fix/FIX44.xml");

            string[] msgFields = { "8=FIX.4.4", "9=332", "35=W", "34=2", "49=MA", "52=20121024-12:21:42.170", "56=xxxx",
                "22=4", "48=BE0932900518", "55=[N/A]", "262=1b145288-9c9a-4911-a084-7341c69d3e6b", "762=EURO_EUR", "268=2",
                "269=0", "270=97.625", "15=EUR", "271=1246000", "272=20121024", "273=07:30:47", "276=I", "282=BEARGB21XXX", "299=15478575",
                "269=1", "270=108.08", "15=EUR", "271=884000", "272=20121024", "273=07:30:47", "276=I", "282=BEARGB21XXX", "299=15467902", "10=77"
            };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            QuickFix.FIX44.MarketDataSnapshotFullRefresh msg = new QuickFix.FIX44.MarketDataSnapshotFullRefresh();

            msg.FromString(msgStr, true, dd, dd, _defaultMsgFactory);
            QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup gentry1 = (QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup)msg.GetGroup(1, new QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup());
            Assert.AreEqual(new DateTime(2012, 10, 24), gentry1.MDEntryDate.getValue());
            Assert.AreEqual(new DateTime(2012, 10, 24, 7, 30, 47).TimeOfDay, gentry1.MDEntryTime.getValue().TimeOfDay);
            Assert.AreEqual(new DateTime(2012, 10, 24, 7, 30, 47), gentry1.MDEntryDate.getValue() + gentry1.MDEntryTime.getValue().TimeOfDay);
        }
Esempio n. 27
0
        public void FromString_Groups_NoFactory()
        {
            // issue 179
            var dd = new QuickFix.DataDictionary.DataDictionary();

            dd.Load("../../../spec/fix/FIX44.xml");

            string[] msgFields =
            {
                // header
                "8=FIX.4.4",              "9=638",          "35=8",             "34=360",          "49=BLPTSOX",                  "52=20130321-15:21:23", "56=THINKTSOX",         "57=6804469",                "128=ZERO",
                // non-group body fields
                "6=122.255",              "11=61101189",    "14=1990000",       "15=GBP",          "17=VCON:20130321:50018:5:12", "22=4",                 "31=122.255",           "32=1990000",
                "37=116",                 "38=1990000",     "39=2",             "48=GB0032452392", "54=1",                        "55=[N/A]",             "60=20130321-15:21:23", "64=20130322",               "75=20130321",
                "106=UK TSY 4 1/4% 2036", "118=2436321.85", "150=F",            "151=0",           "157=15",                      "159=3447.35",          "192=0",                "198=3739:20130321:50018:5",
                "223=0.0425",             "228=1",          "236=0.0291371041", "238=0",           "381=2432874.5",               "423=1",                "470=GB",               "541=20360307",
                // NoPartyIDs
                "453=6",
                "448=VCON",               "447=D",          "452=1",            "802=1",           "523=14",                      "803=4",
                "448=TFOLIO:6804469",     "447=D",          "452=12",
                "448=TFOLIO",             "447=D",          "452=11",
                "448=THINKFOLIO LTD",     "447=D",          "452=13",
                "448=SXT",                "447=D",          "452=16",
                "448=TFOLIO:6804469",     "447=D",          "452=36",
                "10=152"
            };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            QuickFix.FIX44.ExecutionReport msg = new QuickFix.FIX44.ExecutionReport();
            msg.FromString(msgStr, true, dd, dd, null); // <-- null factory!

            Console.WriteLine(msg.ToString());

            QuickFix.FIX44.ExecutionReport.NoPartyIDsGroup partyGroup = new QuickFix.FIX44.ExecutionReport.NoPartyIDsGroup();
            msg.GetGroup(2, partyGroup);

            Assert.False(partyGroup.IsSetNoPartySubIDs());
        }
Esempio n. 28
0
        public void ValidateWrongTypeInRepeatingGroup()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4",   "9=111", "35=V",  "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "262=mdreqid", "263=0", "264=5",
                                   "267=1",        // MDReqGrp
                                   "269=failboat", // should be a char
                                   "146=1",        // InstrmtMDReqGrp
                                   "55=sym",
                                   "10=91" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "V";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectDataFormat>());
        }
Esempio n. 29
0
        public void issue56_GetGroup_by_tag_and_return()
        {
            // setup
            var dd = new QuickFix.DataDictionary.DataDictionary();

            dd.LoadFIXSpec("FIX44");
            string[] msgFields = { "8=FIX.4.2", "9=87", "35=B", "34=3", "49=CLIENT1", "52=20111012-22:15:55.474", "56=EXECUTOR", "148=AAAAAAA", "33=2", "58=L1", "58=L2", "10=016" };
            string   msgStr    = String.Join(Message.SOH, msgFields) + Message.SOH;

            QuickFix.FIX42.News msg = new QuickFix.FIX42.News();
            msg.FromString(msgStr, false, dd, dd, _defaultMsgFactory);
            Assert.AreEqual(2, msg.GroupCount(Tags.LinesOfText)); // for sanity

            // the test
            var grp1 = msg.GetGroup(1, Tags.LinesOfText);

            Assert.IsInstanceOf <QuickFix.FIX42.News.LinesOfTextGroup>(grp1);
            Assert.AreEqual("L1", (grp1 as QuickFix.FIX42.News.LinesOfTextGroup).Text.Obj);

            var grp2 = msg.GetGroup(2, Tags.LinesOfText);

            Assert.IsInstanceOf <QuickFix.FIX42.News.LinesOfTextGroup>(grp2);
            Assert.AreEqual("L2", (grp2 as QuickFix.FIX42.News.LinesOfTextGroup).Text.Obj);
        }
Esempio n. 30
0
        public void ValidateWrongTypeInNestedRepeatingGroup()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory          f  = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4",          "9=185", "35=J",  "34=3",  "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "70=AllocID",         "71=0",  "626=1", "857=0", "54=1",      "55=sym",                   "53=1",     "6=5.5","75=20110909-09:09:09.999",
                                   "73=1",               // NoOrders
                                   "11=clordid",
                                   "756=1",              // NoNested2PartyIDs
                                   "757=nested2partyid",
                                   "759=failboat",       // supposed to be a int
                                   "10=48" };
            string   msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType     = "J";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);

            message.FromString(msgStr, true, dd, dd, f);

            Assert.That(() => dd.Validate(message, beginString, msgType), Throws.TypeOf <QuickFix.IncorrectDataFormat>());
        }
Esempio n. 31
0
        public void ValidateDateAndTimeFields()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=104", "35=W", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "55=sym", "268=1", "269=0", "272=20111012", "273=22:15:30.444", "10=19" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            try
            {
                dd.Validate(message, beginString, msgType);
            }
            catch (QuickFix.TagException e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine(e.Field);
                throw;
            }
        }
Esempio n. 32
0
 public void DuplicateEnumsDoesNotThrow()
 {
     // If this test throws, it failed.
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/test/FIX43_dup_enum.xml");
 }
Esempio n. 33
0
        public void CheckValidFormat()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.LoadFIXSpec("FIX44");
            dd.CheckFieldsHaveValues = true;

            var goodFields = new QuickFix.Fields.StringField[] {
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.Symbol, "foo"),                            // string
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.Side, "2"),                                // char
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.LastQty, "123"),                           // int
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.AvgPx, "1.23"),                            // decimal
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.ReportToExch, "Y"),                        // bool
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.ContraTradeTime, "20011217-09:30:47.123"), // datetime
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.MDEntryDate, "20030910"),                  // dateonly
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.MDEntryTime, "13:20:00.123"),              // timeonly

                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.Symbol, "")                                // string
            };

            foreach (var datum in goodFields)
            {
                Assert.DoesNotThrow(delegate { dd.CheckValidFormat(datum); });
            }

            var badFields = new QuickFix.Fields.StringField[]
            {
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.Side, "toolong"),                // char
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.LastQty, "notint"),              // int
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.AvgPx, "notdec"),                // decimal
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.ReportToExch, "notbool"),        // bool
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.ContraTradeTime, "notdatetime"), // datetime
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.MDEntryDate, "notdate"),         // dateonly
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.MDEntryTime, "nottime")          // timeonly
            };

            foreach (var datum in badFields)
            {
                Assert.Throws(typeof(IncorrectDataFormat), delegate { dd.CheckValidFormat(datum); });
            }

            var emptyFields = new QuickFix.Fields.StringField[]
            {
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.Side, ""),            // char
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.LastQty, ""),         // int
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.AvgPx, ""),           // decimal
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.ReportToExch, ""),    // bool
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.ContraTradeTime, ""), // datetime
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.MDEntryDate, ""),     // dateonly
                new QuickFix.Fields.StringField(QuickFix.Fields.Tags.MDEntryTime, "")      // timeonly
            };

            foreach (var datum in emptyFields)
            {
                Assert.Throws(typeof(IncorrectDataFormat), delegate { dd.CheckValidFormat(datum); });
            }

            // Setting change!
            dd.CheckFieldsHaveValues = false;
            foreach (var datum in emptyFields)
            {
                Assert.DoesNotThrow(delegate { dd.CheckValidFormat(datum); });
            }
        }
Esempio n. 34
0
        /*
         * public void SaveSessionIDS(string filename)
         * {
         *  FileStream fs = File.Open(filename, FileMode.Create, FileAccess.Write);
         *  try
         *  {
         *      // Serialize Dictionary to dat file
         *      List<TOMessageBackup> lst = new List<TOMessageBackup>();
         *      if (!_serializing)
         *      {
         *          _serializing = true;
         *          Dictionary<string, TOOrderSession> regs = new Dictionary<string, TOOrderSession>(_dicMsgsCl);
         *
         *
         *          foreach (KeyValuePair<string, TOOrderSession> item in regs)
         *          {
         *              TOMessageBackup to = new TOMessageBackup();
         *
         *              to.Key = item.Key;
         *              to.BeginString = item.Value.Sessao.BeginString;
         *              to.SenderCompID = item.Value.Sessao.SenderCompID;
         *              to.SenderSubID = item.Value.Sessao.SenderSubID;
         *              to.TargetCompID = item.Value.Sessao.TargetCompID;
         *              to.TargetSubID = item.Value.Sessao.TargetSubID;
         *              to.TipoExpiracao = item.Value.TipoExpiracao;
         *              to.DataExpiracao = item.Value.DataExpiracao;
         *              to.DataEnvio = item.Value.DataEnvio;
         *              to.MsgSeqNum = item.Value.MsgSeqNum.ToString();
         *              to.ClOrdID = item.Value.ClOrdID;
         *              to.OrigClOrdID = item.Value.OrigClOrdID;
         *              to.Account = item.Value.Account.ToString();
         *              int lenPid = item.Value.PartyIDs.Count;
         *              for (int i = 0; i < lenPid; i++)
         *              {
         *                  PartyIDBackup pId = new PartyIDBackup();
         *                  pId.PartyID = item.Value.PartyIDs[i].GetField(Tags.PartyID);
         *                  pId.PartyIDSource = item.Value.PartyIDs[i].GetChar(Tags.PartyIDSource);
         *                  pId.PartyRole = item.Value.PartyIDs[i].GetInt(Tags.PartyRole);
         *                  to.PartyIDs.Add(pId);
         *              }
         *              // to.MensagemQF = item.Value.MensagemQF.ToString();
         *              to.TipoLimite = (int)item.Value.TipoLimite;
         *              to.Order = item.Value.Order;
         *              to.MensagemQF = item.Value.MensagemQF.ToString();
         *              to.ExchangeNumberID = item.Value.ExchangeNumberID;
         *              to.ExchangeSeqNum = item.Value.ExchangeSeqNum;
         *              //to.SecondaryOrderID = item.Value.SecondaryOrderID;
         *              //to.TradeDate = item.Value.TradeDate;
         *              lst.Add(to);
         *              to = null;
         *          }
         *
         *          BinaryFormatter bs = new BinaryFormatter();
         *          bs.Serialize(fs, lst);
         *          bs = null;
         *          logger.InfoFormat("SaveSessionIDS(): Registros serializados: [{0}] [{1}]", lst.Count, filename);
         *          // Efetuar limpeza da lista
         *          int len = lst.Count;
         *          for (int i = 0; i < len; i++)
         *          {
         *              TOMessageBackup aux = lst[i];
         *              aux = null;
         *          }
         *
         *          lst.Clear();
         *          lst = null;
         *          fs.Close();
         *          fs = null;
         *          regs.Clear();
         *          regs = null;
         *          _serializing = false;
         *      }
         *      else
         *      {
         *          if (_serializing)
         *              logger.Debug("SaveSessionIDS(): Processo de serializacao já em execucao!!!");
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      logger.Error("SaveSessionIDS(): Erro na serializacao dos registros do dicionario: " + ex.Message, ex);
         *      _serializing = false; // mudar para false para tentar backupear no proximo "ciclo"
         *      fs.Close();
         *      fs = null;
         *  }
         * }
         */
        /*
         * public void LoadSessionIDs(string fileName, QuickFix.DataDictionary.DataDictionary dataDic)
         * {
         *  string msgQF = string.Empty;
         *  try
         *  {
         *      if (File.Exists(fileName))
         *      {
         *          List<TOMessageBackup> lst = new List<TOMessageBackup>();
         *          FileStream fs = File.Open(fileName, FileMode.Open, FileAccess.Read);
         *          BinaryFormatter bformatter = new BinaryFormatter();
         *          lst = (List<TOMessageBackup>)bformatter.Deserialize(fs);
         *          int length = lst.Count;
         *          if (lst.Count > 0)
         *          {
         *              lock (_dicMsgsCl)
         *              {
         *                  for (int i = 0; i < length; i++)
         *                  {
         *                      TOMessageBackup to = lst[i];
         *                      TOOrderSession toOrder = new TOOrderSession();
         *                      SessionID ssID = null;
         *                      if (!string.IsNullOrEmpty(to.SenderSubID) && (!string.IsNullOrEmpty(to.TargetSubID)))
         *                          ssID = new SessionID(to.BeginString, to.SenderCompID, to.SenderSubID, to.TargetCompID, to.TargetSubID);
         *                      else
         *                          ssID = new SessionID(to.BeginString, to.SenderCompID, to.TargetCompID);
         *                      toOrder.Sessao = ssID;
         *                      toOrder.TipoExpiracao = to.TipoExpiracao;
         *                      toOrder.DataExpiracao = to.DataExpiracao;
         *                      toOrder.DataEnvio = to.DataEnvio;
         *                      toOrder.MsgSeqNum = Convert.ToInt32(to.MsgSeqNum);
         *                      toOrder.ClOrdID = to.ClOrdID;
         *                      toOrder.OrigClOrdID = to.OrigClOrdID;
         *                      toOrder.Account = Convert.ToInt32(to.Account);
         *                      int len = to.PartyIDs.Count;
         *                      for (int j = 0; j < len; j++)
         *                      {
         *                          QuickFix.FIX44.NewOrderSingle.NoPartyIDsGroup grp = new QuickFix.FIX44.NewOrderSingle.NoPartyIDsGroup();
         *                          grp.Set(new PartyID(to.PartyIDs[j].PartyID));
         *                          grp.Set(new PartyIDSource(to.PartyIDs[j].PartyIDSource));
         *                          grp.Set(new PartyRole(to.PartyIDs[j].PartyRole));
         *                          toOrder.PartyIDs.Add(grp);
         *                      }
         *
         *                      toOrder.TipoLimite = (TipoLimiteEnum)to.TipoLimite;
         *                      toOrder.Order = to.Order;
         *                      toOrder.MensagemQF = new QuickFix.Message(to.MensagemQF, dataDic, true);
         *                      toOrder.ExchangeNumberID = to.ExchangeNumberID;
         *                      toOrder.ExchangeSeqNum = to.ExchangeSeqNum;
         *                      //toOrder.SecondaryOrderID = to.SecondaryOrderID;
         *                      //toOrder.TradeDate = to.TradeDate;
         *                      _dicMsgsCl.Add(to.Key, toOrder);
         *                  }
         *              }
         *              logger.Info("LoadSessionIDs(): Registros recuperados: " + lst.Count);
         *              lst.Clear();
         *              lst = null;
         *          }
         *          if (fs != null)
         *          {
         *              fs.Close();
         *              fs = null;
         *          }
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      logger.Error("LoadSessionIDs(): Erro na deserializacao dos registros do dicionario: MsgQF: " + msgQF + " " + ex.Message, ex);
         *  }
         * }
         */
        public void LoadOrderSessionIDsFromDB(int idSession, QuickFix.DataDictionary.DataDictionary dataDic)
        {
            try
            {
                DbFix dbFix = new DbFix();
                List <TOMessageBackup> lst = dbFix.BuscarOrderSessionIDs(idSession);

                int length = lst.Count;
                if (lst.Count > 0)
                {
                    lock (_dicMsgsCl)
                    {
                        for (int i = 0; i < length; i++)
                        {
                            TOMessageBackup to      = lst[i];
                            TOOrderSession  toOrder = new TOOrderSession();
                            SessionID       ssID    = null;
                            if (!string.IsNullOrEmpty(to.SenderSubID) && (!string.IsNullOrEmpty(to.TargetSubID)))
                            {
                                ssID = new SessionID(to.BeginString, to.SenderCompID, to.SenderSubID, to.TargetCompID, to.TargetSubID);
                            }
                            else
                            {
                                ssID = new SessionID(to.BeginString, to.SenderCompID, to.TargetCompID);
                            }
                            toOrder.Sessao        = ssID;
                            toOrder.TipoExpiracao = to.TipoExpiracao;
                            toOrder.DataExpiracao = to.DataExpiracao;
                            toOrder.DataEnvio     = to.DataEnvio;
                            toOrder.MsgSeqNum     = Convert.ToInt32(to.MsgSeqNum);
                            toOrder.ClOrdID       = to.ClOrdID;
                            toOrder.OrigClOrdID   = to.OrigClOrdID;
                            toOrder.Account       = Convert.ToInt32(to.Account);
                            int len = to.PartyIDs.Count;
                            for (int j = 0; j < len; j++)
                            {
                                QuickFix.FIX44.NewOrderSingle.NoPartyIDsGroup grp = new QuickFix.FIX44.NewOrderSingle.NoPartyIDsGroup();
                                grp.Set(new PartyID(to.PartyIDs[j].PartyID));
                                grp.Set(new PartyIDSource(to.PartyIDs[j].PartyIDSource));
                                grp.Set(new PartyRole(to.PartyIDs[j].PartyRole));
                                toOrder.PartyIDs.Add(grp);
                            }

                            toOrder.TipoLimite       = (TipoLimiteEnum)to.TipoLimite;
                            toOrder.Order            = to.Order;
                            toOrder.MensagemQF       = new QuickFix.Message(to.MensagemQF, dataDic, true);
                            toOrder.ExchangeNumberID = to.ExchangeNumberID;
                            toOrder.ExchangeSeqNum   = to.ExchangeSeqNum;
                            _dicMsgsCl.Add(to.Key, toOrder);
                        }
                    }
                    logger.Info("LoadOrderSessionIDsFromDB(): Registros recuperados: " + lst.Count);
                    lst.Clear();
                    lst = null;
                }
            }
            catch (Exception ex)
            {
                logger.Error("LoadOrderSessionIDsFromDB(): Erro na deserializacao dos registros a partir do banco de dados: " + ex.Message, ex);
            }
        }
Esempio n. 35
0
 public void BasicMessageTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.LoadFIXSpec("FIX44");
     Assert.That(dd.Messages["3"].Fields.Count, Is.EqualTo(7));
 }
 public void CheckValidTagTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
     Assert.Throws(typeof(InvalidTagNumber),
         delegate { dd.CheckValidTagNumber(999); });
 }
 public void BasicMessageTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/fix/FIX44.xml");
     Assert.That(dd.Messages["3"].Fields.Count, Is.EqualTo(7));
 }
 public void TrailerTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
     Assert.True(dd.Trailer.ReqFields.Contains(10));
     Assert.That(dd.Trailer.Fields.Count, Is.EqualTo(3));
 }
Esempio n. 39
0
        public void OptionalComponentRequiredField()
        {
            // issue #98 - message erroneously rejected because DD says that
            //   component-required field is missing even though component is not present

            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=77", "35=AD", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "568=tradereqid", "569=0", "10=109" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "AD";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
Esempio n. 40
0
        public void RequiredComponentRequiredField()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = { "8=FIX.4.4", "9=76", "35=7", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "2=AdvId", "5=N", "4=B", "53=1", "10=138" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "7";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            var ex = Assert.Throws<QuickFix.RequiredTagMissing>(delegate { dd.Validate(message, beginString, msgType); });
            Assert.AreEqual(55, ex.Field);
        }
Esempio n. 41
0
        public void NestedGroupTest()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.Load("../../../spec/fix/FIX44.xml");
            QuickFix.DataDictionary.DDMap msgJ = dd.Messages["J"];

            Assert.True(msgJ.IsGroup(73));
            Assert.False(msgJ.IsGroup(756));
            Assert.True(msgJ.GetGroup(73).IsGroup(756));
        }
Esempio n. 42
0
        public void Issue134_RequiredIsOptional()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/test/required_is_optional.xml");
            Assert.True(dd.Messages["magic"].ReqFields.Contains(1111));  //base required field
            Assert.False(dd.Messages["magic"].ReqFields.Contains(5555)); //base optional field
            Assert.False(dd.Messages["magic"].ReqFields.Contains(5556)); //component optional field

            Assert.False(dd.Messages["magic"].Groups[6660].Required); // group isn't required
            Assert.False(dd.Messages["magic"].Groups[6660].ReqFields.Contains(6662)); // group optional field
        }
Esempio n. 43
0
 public void HeaderTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
     Assert.True(dd.Header.ReqFields.Contains(9));
     Assert.That(dd.Header.Fields.Count, Is.EqualTo(27));
 }
Esempio n. 44
0
 public void ReqFldTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
     Assert.True(dd.Messages["AE"].ReqFields.Contains(571));
     Assert.False(dd.Messages["AE"].ReqFields.Contains(828));
 }
Esempio n. 45
0
 public void BasicMessageTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/fix/FIX44.xml");
     Assert.That(dd.Messages["3"].Fields.Count, Is.EqualTo(7));
 }
 public void ReqFldTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
     Assert.True(dd.Messages["AE"].ReqFields.Contains(571));
     Assert.False(dd.Messages["AE"].ReqFields.Contains(828));
 }
Esempio n. 47
0
        public void ValidateTimeOnly_Invalid()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            // intentionally invalid MDEntryTime (272/TimeOnly)
            string[] msgFields = { "8=FIX.4.4", "9=113", "35=W", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "55=sym", "268=1", "269=0", "272=20111012", "273=20111012-22:15:30.444", "10=200" };
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "W";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            // this should throw
            dd.Validate(message, beginString, msgType);
        }
        public void ValidateWithRepeatingGroupTest()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX42.xml");
            QuickFix.FIX42.MessageFactory f = new QuickFix.FIX42.MessageFactory();

            string nul = Message.SOH;
            string msgStr = "8=FIX.4.2" + nul + "9=87" + nul + "35=B" + nul + "34=3" + nul + "49=CLIENT1" + nul
                + "52=20111012-22:15:55.474" + nul + "56=EXECUTOR" + nul + "148=AAAAAAA" + nul
                + "33=2" + nul + "58=L1" + nul + "58=L2" + nul + "10=016" + nul;

            QuickFix.Fields.MsgType msgType = Message.IdentifyType(msgStr);
            string beginString = Message.ExtractBeginString(msgStr);

            Message message = f.Create(beginString, msgType.Obj);
            message.FromString(
                msgStr,
                true,
                dd,
                dd);

            // Session.Next(message)

            dd.Validate(message, beginString, msgType.Obj);
        }
Esempio n. 49
0
        public void ValidateWrongType()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = {"8=FIX.4.4", "9=120", "35=D", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                   "11=clordid", "55=sym", "54=1", "60=20110909-09:09:09.999", "40=1",
                                   "38=failboat", // should be a decimal
                                   "10=64"};
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "D";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
Esempio n. 50
0
        public void ValidateWrongTypeInNestedRepeatingGroup()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = {"8=FIX.4.4", "9=185", "35=J", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                     "70=AllocID", "71=0", "626=1", "857=0", "54=1", "55=sym", "53=1", "6=5.5", "75=20110909-09:09:09.999",
                                     "73=1", // NoOrders
                                       "11=clordid",
                                       "756=1", // NoNested2PartyIDs
                                         "757=nested2partyid",
                                         "759=failboat", // supposed to be a int
                                     "10=48"};
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "J";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
Esempio n. 51
0
        public void ValidateWrongTypeInRepeatingGroup()
        {
            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
            QuickFix.FIX44.MessageFactory f = new QuickFix.FIX44.MessageFactory();

            string[] msgFields = {"8=FIX.4.4", "9=111", "35=V", "34=3", "49=sender", "52=20110909-09:09:09.999", "56=target",
                                      "262=mdreqid", "263=0", "264=5",
                                      "267=1", // MDReqGrp
                                        "269=failboat", // should be a char
                                      "146=1", // InstrmtMDReqGrp
                                        "55=sym",
                                      "10=91"};
            string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH;

            string msgType = "V";
            string beginString = "FIX.4.4";

            Message message = f.Create(beginString, msgType);
            message.FromString(msgStr, true, dd, dd, f);

            dd.Validate(message, beginString, msgType);
        }
Esempio n. 52
0
        public void issue95()
        {
            // Parser screws up on triple-nested groups.  Contributes to ResendRequest failures.
            string msgStr = String.Join(Message.SOH, new string[]{
                "8=FIX.4.4","9=999","35=R","34=6","49=sendercompid","52=20130225-10:44:59.149","56=targetcompid", //headers
                    "131=quotereqid",
                    "146=1", // NoRelatedSym
                        "55=ABC","65=CD","48=securityid","22=1", // group
                        "711=1", // NoUnderlyings
                            "311=underlyingsymbol","312=WI","309=underlyingsecurityid","305=1",
                "10=999",""
            });

            var dd = new QuickFix.DataDictionary.DataDictionary();
            dd.Load("../../../spec/fix/FIX44.xml");

            Message msg = new Message();
            msg.FromString(msgStr, false, dd, dd, _defaultMsgFactory);

            // make sure no fields were dropped in parsing
            Assert.AreEqual(msgStr.Length, msg.ToString().Length);

            // make sure repeating groups are not rearranged
            // 1 level deep
            StringAssert.Contains(String.Join(Message.SOH, new string[] { "55=ABC", "65=CD", "48=securityid", "22=1" }), msg.ToString());
            // 2 levels deep
            StringAssert.Contains(String.Join(Message.SOH, new string[] { "311=underlyingsymbol", "312=WI", "309=underlyingsecurityid", "305=1" }), msg.ToString());
        }
Esempio n. 53
0
 public void DuplicateEnumsDoesNotThrow()
 {
     // If this test throws, it failed.
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.Load("../../../spec/test/FIX43_dup_enum.xml");
 }
Esempio n. 54
0
 public void DuplicateEnumsDoesNotThrow()
 {
     // If this test throws, it failed.
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
     dd.LoadTestFIXSpec("FIX43_dup_enum");
 }
Esempio n. 55
0
 public void ComponentFieldsRequirements()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
     Assert.False(dd.Messages["AD"].ReqFields.Contains(55));
     Assert.True(dd.Messages["7"].ReqFields.Contains(55));
 }
Esempio n. 56
0
 public void CheckValidTagTest()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
     Assert.Throws(typeof(InvalidTagNumber),
                   delegate { dd.CheckValidTagNumber(999); });
 }
Esempio n. 57
0
 public void ComponentFieldsRequirements()
 {
     QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX44.xml");
     Assert.False(dd.Messages["AD"].ReqFields.Contains(55));
     Assert.True(dd.Messages["7"].ReqFields.Contains(55));
 }