Warm tip: This article is reproduced from stackoverflow.com, please click
c# fix-protocol quickfix

Trying to convert string to MarketDataIncrementalRefresh

发布于 2020-11-29 17:08:06

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

Questioner
Roey Nissim
Viewed
3
Roey Nissim 2012-05-22 23:32

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.