Search code examples
fix-protocol

Using FIX protocol to connect to the broker


I am currently trying to build a program using FIX protocol to communicate with a broker (currenex). I sent my (self-generated) logon message to the server and got something back. This is what I sent

8=FIX.4.49=8835=A49=xxxxxxxx56=CNX34=152=20140718-11:40:18.24498=0108=30141=Y554=xxxxxx10=128

(the SenderCompID and the password were replaced) and I got

8=FIX.4.49=7635=A34=149=CNX52=20140718-11:40:33.22456=xxxxxxxx141=Y98=0108=3010=1458=FIX.4.49=7035=h34=249=CNX52=20140718-11:40:33.22656=xxxxxxxx336=0340=210=128

back from the server. I think I built the logon message correct (or did I?). But when I sent a second request MarketDataRequest

8=FIX.4.49=13735=V49=xxxxxxxx56=CNX34=252=20140718-11:42:53.504262=363263=1264=0265=1266=N267=2269=1269=0146=155=GBP/USD554=xxxx10=013

I had no response at all. I asked the broker and they said the connection dropped right away every time after I logged in. I thought it was some connection problem and I tried using RESTClient (Postman) to send the message but the result was the same. Could any one take a look at my messages and point out if there is something stupid please? All I need is the real-time exchange rate so a simple FIX message example will be very helpful. Thanks a lot!

Regards, Bo


Solution

  • Your logon response message says that your trading session is open (340=2) so it's not broker-side problem. I think your program disconnects TCP/IP connection from server after login message. FIX protocol insists that TCP/IP connection must be kept alive during the whole FIX session - otherwise the session will be closed. So you need rewrite your program to keep connection alive and just send there yor requests and listen for responses. Don't close the connection.