Trying to convert string to MarketDataIncrementalR

2019-08-04 02:10发布

问题:

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

回答1:

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.



回答2:

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.