public void ToXMLWithGroupsTest() { var dd = new QuickFix.DataDictionary.DataDictionary(); dd.Load(Path.Combine(TestContext.CurrentContext.TestDirectory, "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! var expectedArr = new List <string>(); expectedArr.Add("<message>"); expectedArr.Add("<header>"); expectedArr.Add(@"<field number=""8""><![CDATA[FIX.4.4]]></field><field number=""9""><![CDATA[638]]></field><field number=""34""><![CDATA[360]]></field><field number=""35""><![CDATA[8]]></field><field number=""49""><![CDATA[BLPTSOX]]></field><field number=""52""><![CDATA[20130321-15:21:23]]></field><field number=""56""><![CDATA[THINKTSOX]]></field><field number=""57""><![CDATA[6804469]]></field><field number=""128""><![CDATA[ZERO]]></field>"); expectedArr.Add("</header>"); expectedArr.Add("<body>"); expectedArr.Add(@"<field number=""6""><![CDATA[122.255]]></field><field number=""11""><![CDATA[61101189]]></field><field number=""14""><![CDATA[1990000]]></field><field number=""15""><![CDATA[GBP]]></field><field number=""17""><![CDATA[VCON:20130321:50018:5:12]]></field><field number=""22""><![CDATA[4]]></field><field number=""31""><![CDATA[122.255]]></field><field number=""32""><![CDATA[1990000]]></field><field number=""37""><![CDATA[116]]></field><field number=""38""><![CDATA[1990000]]></field><field number=""39""><![CDATA[2]]></field><field number=""48""><![CDATA[GB0032452392]]></field><field number=""54""><![CDATA[1]]></field><field number=""55""><![CDATA[[N/A]]]></field><field number=""60""><![CDATA[20130321-15:21:23]]></field><field number=""64""><![CDATA[20130322]]></field><field number=""75""><![CDATA[20130321]]></field><field number=""106""><![CDATA[UK TSY 4 1/4% 2036]]></field><field number=""118""><![CDATA[2436321.85]]></field><field number=""150""><![CDATA[F]]></field><field number=""151""><![CDATA[0]]></field><field number=""157""><![CDATA[15]]></field><field number=""159""><![CDATA[3447.35]]></field><field number=""192""><![CDATA[0]]></field><field number=""198""><![CDATA[3739:20130321:50018:5]]></field><field number=""223""><![CDATA[0.0425]]></field><field number=""228""><![CDATA[1]]></field><field number=""236""><![CDATA[0.0291371041]]></field><field number=""238""><![CDATA[0]]></field><field number=""381""><![CDATA[2432874.5]]></field><field number=""423""><![CDATA[1]]></field><field number=""453""><![CDATA[6]]></field><field number=""470""><![CDATA[GB]]></field><field number=""541""><![CDATA[20360307]]></field><group><field number=""447""><![CDATA[D]]></field><field number=""448""><![CDATA[VCON]]></field><field number=""452""><![CDATA[1]]></field><field number=""802""><![CDATA[1]]></field><group><field number=""523""><![CDATA[14]]></field><field number=""803""><![CDATA[4]]></field></group></group><group><field number=""447""><![CDATA[D]]></field><field number=""448""><![CDATA[TFOLIO:6804469]]></field><field number=""452""><![CDATA[12]]></field></group><group><field number=""447""><![CDATA[D]]></field><field number=""448""><![CDATA[TFOLIO]]></field><field number=""452""><![CDATA[11]]></field></group><group><field number=""447""><![CDATA[D]]></field><field number=""448""><![CDATA[THINKFOLIO LTD]]></field><field number=""452""><![CDATA[13]]></field></group><group><field number=""447""><![CDATA[D]]></field><field number=""448""><![CDATA[SXT]]></field><field number=""452""><![CDATA[16]]></field></group><group><field number=""447""><![CDATA[D]]></field><field number=""448""><![CDATA[TFOLIO:6804469]]></field><field number=""452""><![CDATA[36]]></field></group>"); expectedArr.Add("</body>"); expectedArr.Add("<trailer>"); expectedArr.Add(@"<field number=""10""><![CDATA[152]]></field>"); expectedArr.Add("</trailer>"); expectedArr.Add("</message>"); expectedArr.Add(""); var expected = string.Join(Environment.NewLine, expectedArr); Assert.AreEqual(expected, msg.ToXML()); }
public void MessageHasDecimalWithNoLeadingZero() { // issue 160 var dd = new QuickFix.DataDictionary.DataDictionary(); dd.Load("../../../spec/fix/FIX44.xml"); string[] msgFields = { "8=FIX.4.4", "9=122", "35=8", "34=2", "49=sender", "52=20121024-12:21:42.170", "56=target", "37=orderid", "17=execid", "150=0", "39=0", "55=ibm", "228=.23", // Instrument component; 228 is a float type in the spec "54=1", "151=1", "14=1", "6=1", "10=45" }; string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH; QuickFix.FIX44.ExecutionReport msg = new QuickFix.FIX44.ExecutionReport(); msg.FromString(msgStr, true, dd, dd, _defaultMsgFactory); Assert.AreEqual(0.23, msg.Factor.getValue()); }
public void NestedRepeatingGroupParseGroupTest() { 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 subGrp = msg.GetGroup(1, Tags.NoPartyIDs).GetGroup(1, Tags.NoPartySubIDs); Assert.That(subGrp.GetString(Tags.PartySubID), Is.EqualTo("OHAI123")); }
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()); }
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()); }
public void MessageHasDecimalWithNoLeadingZero() { // issue 160 var dd = new QuickFix.DataDictionary.DataDictionary(); dd.Load("../../../spec/fix/FIX44.xml"); string[] msgFields = { "8=FIX.4.4", "9=122", "35=8", "34=2", "49=sender", "52=20121024-12:21:42.170", "56=target", "37=orderid", "17=execid", "150=0", "39=0", "55=ibm", "228=.23", // Instrument component; 228 is a float type in the spec "54=1", "151=1", "14=1", "6=1", "10=45" }; string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH; QuickFix.FIX44.ExecutionReport msg = new QuickFix.FIX44.ExecutionReport(); msg.FromString(msgStr, true, dd, dd, _defaultMsgFactory); Assert.AreEqual(0.23, msg.Factor.getValue()); }
public void NestedRepeatingGroupParseGroupTest() { 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 subGrp = msg.GetGroup(1, Tags.NoPartyIDs).GetGroup(1, Tags.NoPartySubIDs); Assert.That(subGrp.GetString(Tags.PartySubID), Is.EqualTo("OHAI123")); }
public void ToXMLWithGroupsTest() { 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! string xmlDoc = msg.toXML(); System.Diagnostics.Debug.Print(xmlDoc.ToString()); XDocument doc = null; try { doc = XDocument.Parse(xmlDoc); } catch (Exception e) { Assert.Fail("Badly formed XML generated: " + e.Message); } var groups = doc.Descendants("message").Descendants("body").Elements("group") .Select(group => new { numbers = group.Descendants("field").Attributes("number"), values = group.Descendants("field") }) .ToList(); int ct = 0; foreach (var elem in groups) { int number = 0; Group group = msg.GetGroup(++ct, 453); var valueEnum = elem.values.GetEnumerator(); foreach (var numberEnum in elem.numbers) { valueEnum.MoveNext(); string value = valueEnum.Current.Value; if (int.TryParse(numberEnum.Value.ToString(), out number) == false) { Assert.Fail("should be number " + numberEnum.Value.ToString()); } else { if (group.IsSetField(number)) { string msgValue = group.GetField(number); Assert.That(value, Is.EqualTo(msgValue)); } } } } }
public void TestQuickFIXCompatibleGroups() { // allow QuickFIX compatible group parsing (note test MissingDelimiterField proves the reverse) var dd = new QuickFix.DataDictionary.DataDictionary(); dd.Load("../../../spec/fix/FIX44.xml"); // group 555 does not begin with 600 string[] msgFields = { "8=FIX.4.4", "9=296", "35=8", "34=2", "49=XXXXX", "52=20150731-12:00:00.000", "56=CLIENT2", "1=C", "11=T01", "17=123", "37=ST1", "39=0", "44=10000", "54=1", "55=CAD", "60=20150731-12:00:00.000", "75=20150731", "109=BRK","150=0","167=F", "375=ABC", "423=0","555=1", "687=1","943=R1", "5296=1", "5322=ABC","5442=MST1", "5444=1", "5474=S", "5475=MAR16", "5476=PRIV1", "5477=PUB1", "5478=0","5479=0","5681=0","7931=0","10=43" }; string msgStr = String.Join(Message.SOH, msgFields) + Message.SOH; QuickFix.FIX44.ExecutionReport msg = new QuickFix.FIX44.ExecutionReport(); msg.QuickFIXCompatibleGroups = true; Assert.DoesNotThrow(delegate { msg.FromString(msgStr, true, dd, dd, _defaultMsgFactory); }); Group group = msg.GetGroup(1, 555); Assert.IsNotNull(group, "Group should be created"); }