I am a newbie with a quick fix but trust me, I have searched all the forums thoroughly and haven't found the solution to this scenario. I am using quick fix 1.6 libs. I have a FIX message which has got a repeating group. When I send this message using sendToTarget() method, the message is forwarded to the FIX server without issues, but the fields get reordered due to which exchange rejects it. Reading through the posts, I got to know that using data dictionary will solve the problem. But when I use data dictionary with the same message I get "quick fix.InvalidMessage: Equal sign not found in field" exception. I know it's a valid message as per the data dictionary. Below are the message and code. Can someone please help. Thanks in advance.
FIX Message: 8=FIXT.1.1|9=00331|35=AE|49=AAA_FIX|56=BBB_FIX|34=29|52=20170124-09:47:14|1041=firm_trade_id_07|48=XS0102233434|22=4|25004=GBP|470=ZZ|32=100|31=6.33|15=GBP|64=20170125|60=20170124-09:47:14|1430=O|574=1|487=0|552=2|54=1|528=P|29=4|581=3|453=1|448=H7XNBB4851XX0REQ1F70|447=N|452=1|54=2|453=1|448=549300F2CCROIO4RRZ97|447=N|452=17|10=189|
Code:
BufferedReader reader = new BufferedReader(new FileReader ("Message.txt"));
String line = null;
StringBuilder stringBuilder = new StringBuilder();
String ls = System.getProperty("line.separator");
while((line = reader.readLine()) != null) {
stringBuilder.append(line);
stringBuilder.append(ls);
}
String messageString = stringBuilder.toString();
messageString = messageString.replace('|','\u0001');
Message FIXOrder = new Message(messageString, new DataDictionary("DD.xml"));
Run Code Online (Sandbox Code Playgroud)
-Cheers MJ
小智 5
我有同样的例外,并且设法找到了它的根本原因。
FIX消息字符串很可能是从文件中加载的,并且可能具有:\n或\r\n字符串的末尾。
然后....在解析“预告片”时,由于=找不到,所以最后一个字符失败。
在字段中找不到等号
尝试:
public static final String NEW_LINE = System.getProperty("line.separator");
String msgText= loadedText.replace(NEW_LINE, "");msgText = msgText.replace(';', '\001');message.fromString(msgText, dataDictionary, false);