{{Quickfixn}} Using QuickFix on a flat file
Grant Birchmeier
gbirchmeier at connamara.com
Tue Sep 11 21:27:31 PDT 2012
It looks like a FIX message, but it isn't exactly. It has no beginstring
(e.g. "8=FIX.4.4"), and I'm not sure what that 1128 is.
So (1) is happening because the header is invalid. Maybe if you replace
1128=9 with 8=FIX.4.4 it could get past that, but it might trip up on
something else, like checksum.
I'm not sure what you're trying with (2). If you're not receiving a
message over the wire, then MessageCracker shouldn't come into play.
Theoretically, for each line, you should be able to call FromString().
Something like this:
for each line in file:
msgStr = <line from file, possibly after you replace 1128=9 with proper
beginstring>
// not sure if FIX44, but let's say it is
QuickFix.FIX44.SecurityDefinition msg = new
QuickFix.FIX44.SecurityDefinition();
msg.FromString(msgStr, false, dd, dd, _defaultMsgFactory);
Have a look at test CheckGroupCountTest() in this file:
https://github.com/connamara/quickfixn/blob/master/UnitTests/DataDictionaryTests.cs
You can see how it uses Message.FromString().
The dd will need to be your CME DD. The boolean is whether to use
validation. Steal the _defaultMsgFactory part from that test file.
Let me know if that will get you rolling.
-Grant
On Tue, Sep 11, 2012 at 8:37 PM, Ted Tworek <ttworek at theleaguecorp.com>wrote:
> Hi,
>
>
>
> I'm trying to read the static securities definition file from the CME,
> located at:ftp://ftp.cmegroup.com/fix/Production/secdef.dat.gz
>
> Since they seem to be standard fix messages, I thought I could use
> QuickFix to help me read them into C# rather than parsing the file myself.
> I created a test app that basically does what I want, but I'm having 2
> issues:
>
> 1) I'm getting a QuickFix exception "Invalid message: Header fields out of
> order" when forming the message from the string. If I set the "validate"
> boolean to false, this message disappears and the constructor succeeds, but
> may be an indicator for the next issue.
>
> 2) Upon calling p.Crack, I'm getting the QuickFix exception
> "QuickFix.UnsupportedMessageType", but there doesn't seem to be any
> indication of what the message type is that is supposedly unsupported.
>
> Anyway, maybe QuickFix wasn't intended to be used in this way, but any
> ideas on how to get this to work?
>
> Thanks,
>
> Ted
>
>
>
> using System;
>
> using System.IO;
>
> using System.Collections.Generic;
>
> using System.Text;
>
> using QuickFix;
>
>
>
> namespace TestQuickFix
>
> {
>
> class Program : QuickFix.MessageCracker
>
> {
>
> static void Main(string[] args)
>
> {
>
> int count = 0;
>
> string line;
>
>
>
> Program p = new Program();
>
> StreamReader file = new StreamReader(@"C:\secdef.dat");
>
>
>
> while (((line = file.ReadLine()) != null && count < 10))
>
> {
>
> // ISSUE #1 REQUIRES false 2ND ARG WHEN CREATING THE
> MESSAGE
>
> Message m = new Message(line, false);
>
>
>
> // ISSUE #2 Exception of type
> 'QuickFix.UnsupportedMessageType' was thrown.
>
> p.Crack(m, new SessionID("beginString", "senderCompID",
> "targetCompID"));
>
> }
>
>
>
> file.Close();
>
>
>
> }
>
>
>
> public void OnMessage(QuickFix.FIX50.SecurityDefinition secDef,
> SessionID sessionID)
>
> {
>
> Console.WriteLine(secDef.ToString());
>
> }
>
> }
>
> }
>
> _______________________________________________
> Quickfixn mailing list
> Quickfixn at lists.quickfixn.com
> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>
>
--
Grant Birchmeier
*Connamara Systems, LLC*
*Made-To-Measure Trading Solutions.*
Exactly what you need. No more. No less.*
*
http://connamara.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quickfixn.com/pipermail/quickfixn-quickfixn.com/attachments/20120911/e1494121/attachment-0002.htm>
More information about the Quickfixn
mailing list