2

I have a text file with FIX messages (all of them and MarketDataIncrementalRefresh (Type X)) and I'm trying to find a way using QuickFIX in C# to create MarketDataIncrementalRefresh messages out of the strings.

Any suggestions?

here is an example of how one line looks like:

1128=9 9=263 35=X 49=CME 34=10568699 52=20110110205433535 75=20110110 268=2 279=1 22=8 48=812201 83=1243518 107=GEZ2 269=1 270=9825.0 271=153 273=205433000 336=2 346=14 1023=1 279=122=8 48=812201 83=1243519 107=GEZ2 269=1270=9826.0 271=453 273=205433000 336=2 346=21 1023=3 10=058

Karan
  • 12,059
  • 3
  • 24
  • 40
Roey Nissim
  • 555
  • 8
  • 25

3 Answers3

3

Basically this is how its done:

string line = sr.ReadLine();
QuickFix42.MessageFactory fac = new QuickFix42.MessageFactory();
QuickFix.MsgType msgType = QuickFix.Message.identifyType(line);
QuickFix.Message message = fac.create("", msgType.getObject() as string);
message.setString(line, false);

The factory creates the proper message type once its given, so in this case since the type was {X}, QuickFix.Message message is a pointer to MarketDataIncrementalRefresh and then message.setString sets the rest of the props from the given string.

Roey Nissim
  • 555
  • 8
  • 25
1

in Java you can use either

MessageUtils.parse(MessageFactory messageFactory, DataDictionary dataDictionary, java.lang.String messageString)

see here.

of the Message object itself, see here either using the constructor:

Message(java.lang.String string, DataDictionary dd, boolean validate) 

or the fromString method:

fromString(java.lang.String messageData, DataDictionary sessionDictionary, DataDictionary applicationDictionary, boolean doValidation) 

You should be able to find similar things for quickfix/n

I have only found this, which only allows you to build a message from the string using the constructor. Never the less this should work if you cannot find the equivalent of the above in your chosen API.

robthewolf
  • 7,343
  • 3
  • 29
  • 29
  • Thanks you I will look at quickfix/n. I know that the quickfix .net wrapper doesn't have MessageUtils.parse hopefully quickfix/n has it. As for the string ctor in FIX.message it does work but all it does is create message. I need it to create the proper message type in my case MarketDataIncrementalRefresh, to put it in other words can you find me a way to convert message to MarketDataIncrementalRefresh? – Roey Nissim May 22 '12 at 09:38
  • try MessageCracker http://www.quickfixengine.org/quickfix/doc/html/class_f_i_x_1_1_message_cracker.html, I am not sure how it works exactly in c# have a look at this example. http://quickfixn.org/tutorial/receiving-messages It is for a FIX application that receives message from a server. However have your app also inherit MessageCracker, read the FIX string in to a Message as above, then call crack on the Message. Override the relevant onMessage Method ie onMessage(MarketDataIncrementReferesh msg){} and you should be good to go. – robthewolf May 22 '12 at 10:29
0

I want to perform the same conversion but I do not found setString in QuickFix.Message. I am using QuickFIXn. I searched more and check few more methods in Message and found a way. You can use Message.FromString method like below.

If you do not want to use DataDictionary then just pass it as null.

string strMsg = "8=FIX.4.49=54735=AE34=4";

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

var tradeCaptureReport = new QuickFix.FIX44.TradeCaptureReport();
tradeCaptureReport.FromString(strMsg, false, dataDictionary, dataDictionary, _defaultMsgFactory);
Karan
  • 12,059
  • 3
  • 24
  • 40