Menu

MessageFactory ParseField and Groups

jdahl
2009-04-06
2013-04-15
  • jdahl

    jdahl - 2009-04-06

    How does MessageFactory parse incoming message which have Groups or Sequences?

    Example:

    SecurityDefinition(d) : InstrmtLegGrp

    I'm not seeing anything in the code which parses the group field specifically.

    Thanks,

    -jd-

     
    • Charles

      Charles - 2009-04-06

      I only implemented repeating groups in the FIX 4.4 library.  I never had a need for it in the 4.0 & 4.2 libraries.  The concepts to implement repeating groups are applicable to those libraries but I never had the time to implement them.

      Another option would be to use the base FIX library that puts all those fields in a FieldCollection object.  This gives you flexibility to iterate over all fields and build your own lists of repeating groups.

      Hope this helps...

      Charles Easton
      East Tech Incorporated

       
    • jdahl

      jdahl - 2009-04-06

      I have the 4.4 code. You mind telling me what file(s) the Repeating groups are in?

      Thanks,

      -jd-

       
    • Charles

      Charles - 2009-04-06

      You are right.  After take a 2nd look I only implemented the build side.  So it knows how to build a FIX message with repeating groups but doesn't know how to parse them. 

      Since the parse method won't actually do anything with repeating tags it's treated as a custom tag and goes into the FieldCollection.  You can either try to access the field there or make updates to the Helper class parse methods.

      Sorry for leaving it in a half finished state...

      Charles Easton
      East Tech Incorporated

       
    • jdahl

      jdahl - 2009-04-06

      Okay. I thought that was the case. I wanted to make sure I didn't have something missing from source.

      -jd-

       
    • - 2009-06-19

      Hi Charles,

         How is it there was never a need to parse repeating groups as Quotes often come with repeating groups? I find myself in a situation of committing to porting a project to your library and now encountering this dilemma. For FX, Currenex is FIX 4.2 and often repeating Groups are used. I prefer using 100% managed code than QuickFix so hoping I can get a solution. I suppose there is a solution with customizing the parser engine but I'm hoping there is an easier solution based on what you already have there. Any comments/advice appreciated.

      Thanks
      Luke

       
    • Charles

      Charles - 2009-06-19

      I never finished all the FIX 4.2 messages.  It probably wouldn't take long for me to implement the messages you need, even if they have repeating groups, but then you would have to integrate with my new release.  Since this is open source I can not commit to a date but I'm willing to work on it since it's not finished as was meant to be finished.

      What messages would you want to too quickly?

      Charles Easton
      East Tech Incorporated

       
    • - 2009-06-22

      Hi Charles,

        Thanks so much for the quick response. The main Message type I need to implement is MarketDataSnapshotFullRefresh ( "W" ) for FIX 4.4 as well as FIX 4.2. 

        I don't seem to have figured out how to use this message type in FIX 4.4 either. Perhaps if I am able to get FIX 4.4 working I will be able to apply that to the FIX 4.2 message types. Here is a brief description of how I am attempting to implement the library.

      I connect and subscribe to the Received/MessageEventHandler event of the SocketEngine class. Then I try to caste the message type IMessage to the type of message it is. My code looks like this:

      void engineConnect_Received(IEngine engine, IMessage message)
      {
          if (message.MsgType == "W")
                  {
             //one attempt
          FIX4NET.FIX.FIX_4_4.MarketDataSnapshotFullRefresh ms =  (FIX4NET.FIX.FIX_4_4.MarketDataSnapshotFullRefresh)message;

              //another attempt
          FIX4NET.FIX.FIX_4_4.MarketDataSnapshotFullRefresh snapMsg = (FIX4NET.FIX.FIX_4_4.MarketDataSnapshotFullRefresh)engine.MessageFactory.Parse(msg.MessageRaw);

                  }
      }

      In both cases I receive the exception message: System.InvalidCastException: Unable to cast object of type 'FIX4NET.FIX.Message' to type 'FIX4NET.FIX.FIX_4_4.MarketDataSnapshotFullRefresh'

      I've looked into the code but don't really seem to be able to see where it works in this case of casting or parsing these message types.

      Any advice/help appreciated.

      Thanks,
      Luke

       
      • Charles

        Charles - 2009-06-23

        Make sure you initialize the SocketEngine with the FIX 4.4 MessageFactoryFIX.

        SocketEngine engine = new SocketEngine();
        engine.MessageFactory = new FIX4NET.FIX.FIX_4_4.MessageFactoryFIX();

        This is how FIX4NET creates message objects from the raw FIX message.  Depending on what type of factory you give the engine it creates different message objects.

        Charles Easton
        East Tech Incorporated

         
    • - 2009-06-23

      That works great!

      I guess the functionality of parsing the messages from here into RepeatingGroups is missing based on the other comments in this thread. I will give it a shot and see how it goes.

      Thanks,
      Luke

       
    • - 2009-07-10

      I have made a successful implementation of parsing Repeating Groups on Incoming messages. I've only applied it to one or two message types but happy to make it available to others if they want to use it. I'm not that familiar with the best way to post on sourceforge though.

       
  • AndyGrau

    AndyGrau - 2011-10-23

    dumbmoney: its been 2 years since your reply - but if you are still around i would like to have a look at your code wrt parsing repeating groups. It would be nice if you could post the relevant snippet , where ever it is convenient.

    Regards,
    Andy

     

Log in to post a comment.