Query a remote server using QuickFix/J in Java to get position of an instrument -
i'm building client trading remote server using fix protocol , quickfix/j api.
i can send order, receive price updates, cancel orders etc...
i'm asked "query api current position of instrument".
so let's can submit order buying instrument, , doesn't executed, receive server information "you long on intrument x quantity y etc".
is possible using quickfix/j api?
i have written method
static void positionreport() throws sessionnotfound{ quickfix.fix50.positionreport order = new quickfix.fix50.positionreport(); sessionid sessionid = (sessionid) initiator.getsessions().get(0); order.set(new account("1005390")); order.set(new securityid("4663789")); order.set(new securityexchange("xetr")); order.set(new symbol("sap")); session.sendtotarget(order, sessionid); }
which sends fix messages
8=fix.4.29=9835=ap34=4949=hiq6_order52=20140324-
15:54:10.14256=hiqfix1=100539048=466378955=sap207=xetr10=199
and receives messages this:
8=fix.4.29=9935=334=6949=hiqfix52=20140324-15:54:10.89156=hiq6_order45=4958=invalid msgtype372=ap373=1110=242
as can see "invalid message" error
no cannot using quickfix, unless , until counterparty modelled give fix acknowledgements specific liking. why can add customized fix fields fix xml config file.
373 tag says 11 -> 11 = invalid msgtype 58 confirms again.
check fix xml config , check if message complete , if counterparty allows messages of type ap.
Comments
Post a Comment