java - How to convert a String FIX message to FIX FIX50SP2 format using QuickFixJ -
need quick help. newbie in quickfixj. have fix message in txt file. need convert fix50sp2 format. enclosing code snippet.
string fixmsg = "1128=99=25535=x49=cme34=47134052=20100318-03:21:11.36475=20120904268=2279=122=848=336683=607400107=esu2269=1270=140575271=152273=121014000336=2346=521023=1279=122=848=336683=607401107=esu2269=1270=140600271=206273=121014000336=2346=681023=210=159"; system.out.println("fixmsg string:"+fixmsg); message fixmessage = new message(); datadictionary dd = new datadictionary("fix50sp2.xml"); fixmessage.fromstring(fixmsg, dd, false); system.out.println("fixmessage output:" + fixmessage.tostring()); // print message after parsing msgtype msgtype = new msgtype(); system.out.println(fixmessage.getfield(msgtype));
here output:
fixmsg string:1128=99=15835=x49=cme34=47164052=2012090312102051175=20120904268=1279=122=848=336683=607745107=esu2269=1270=140575271=123273=121020000336=2346=501023=110=205 fixmessage output:9=6135=x34=47164049=cme52=2012090312102051175=20120904268=110=117 quickfix.fieldnotfound: field [35] not found in message. @ quickfix.fieldmap.getfield(fieldmap.java:216) @ quickfix.fieldmap.getfieldinternal(fieldmap.java:353) @ quickfix.fieldmap.getfield(fieldmap.java:349) @ mainapp.main(mainapp.java:52)
i want extract msgtype field (field 35). please tell me wrong? thing have observed after parsing fix50sp2 format, convert fix message missing many data element (for details see output)
thanks
like others mentioned msgtype header field , using following
string msgtype = null; if(fixmessage.getheader().issetfield(msgtype.field)) { msgtype = fixmessage.getheader().getstring(msgtype.field); } system.out.println("msgtype " + msgtype);`
the reason missing many data element after parsing is, message have custom tags(like tag 2346), not defined in data dictionary(fixsp02.xml). hence parsing of tags failed , missing in output.
to fix this, data dictionary party sending message , use parse message
Comments
Post a Comment