Thursday, August 4, 2022

FIX Session is not connecting how to diagnose it? Example Tutorial

In this blog post of the FIX protocol tutorial series I would like to share my experience with connectivity issues around Fix Engines. to exchange messages or say to trade electronically clients connect to the broker using FIX protocol and for that, they use FIX Engine. In FIX protocol connection between two FIX Engines is refereed as FIX Session and we normally say whether FIX Session is connected or not connected. FIX Session normally has their start time, end time, and EOD time (End of day time) also called TradingSession start time, Trading Session End Time, and Trading Session EOD time.

Fix Session Start time is the time when FIX Engine tries to connect each others, to connect successfully both client and broker must have agreed on Fix Session start time and there FIX engine must be running on that time to make them connect to each other.

Here I will mainly discuss issues I have faced during FIX Session establishment

These are very classic problems and should I say most common problem working with FIX protocol and almost everybody face this problem in there day to day work and has there own way to figure out what exactly is wrong and how to fix that.


here I am listing some guideline or say an approach for people who just started working on FIX protocol to figure out what is wrong and how to fix that hope this would help specially to newcomers on FIX protocol.




As per FIX protcol FIX Engine connects to each other over TCP connection on agreed host and port that's why first check in your log that if there is any logon message 35=A ,if there is no logon message something is wrong on TCP(socket ) level and TCP connection between client FIX Engine  and  broker Fix Engine has not been established.




to verify this just check whether your host is connected to broker host or not by issuing following command.


netstat -a | grep port (port is the one which you are using to connect to broker)


if you don't see a connection ESTABLISHED means no TCP connection has been established between your host and broker host and something is wrong either with broker FIX engine host or network.


Now check if broker host is pingable or not , to check broker host is alive and not down. you can use "telnet" command for checking that.

Fix Session is not connecting how to diagnose it? Example Tutorial



telnet hostname port  (here hostname and port is broker host and port)


if you just see "trying ........." means host is not reachable and something is wrong with the network may network link issue or any firewall rule
issue, you need to involve the network team here for further diagnosis.


Now come to other part , in case you see logon message (MsgType=A or 35=A) in your log and still session is not establish then check for logout
message (MsgType=5 or 35=5) by seeing Text(tag 58) here you can figure out why session is not connecting may be sequence number mismatch.


Now there could be two reasons:

1. Either broker is logging you out because you are sending sequence no less than what broker is expecting.In this case you need to reset your Outgoing Sequence Number to what broker is expecting.


2. In case your Fix engine is logging out broker because the broker is sending sequence number less than what your Fix Engine is expecting, In this case, you need to reset your Incoming sequence number.


Sequence number reset can also be done on broker side in opposite way you are doing but before doing that intranet you need to think why sequence number got mismatched and in case of any replay there would not be any side effect.



to read more about FIX protocol , please see my FIX protocol tutorial series


16 comments :

Anonymous said...

Thanks Javin,

I am new to FIX protocol and really looking for some FIX protocol tutorial to learn it and grasp quickly.

you are doing great job, thanks again for your FIX protocol tutorial blog.

Anonymous said...

Hi Javin,

I am facing issues where my FIX Session not able to connect everyday morning but after some times it automatically gets connected. I have checked my FIX Configuration and also FIX specification my SenderCompID , socket , port all looks good , Can you please suggest what could be wrong ?

Divi said...

Hello Javin, I am also new to FIX fraternity and really nice to receive this bit of information from you. Keep up the good work mate.

Javin @ FIX Protocol Tutorial said...

Thanks for Roses Anonymous, It feel good that you like the information and find it useful and that's the whole purpose of writing those blog post. Completely agree that information related to FIX Protocol is only on FIX Specification or you can achieve by years of experience. this is just a small effort.

javin @ electronic trading said...

Hi Anonymous 1,
Sorry for late reply but your issue may be with sequence number , it looks like EOD of FIX Session is not happening on acceptor side and when your application trying to connect with sequence number 1 , acceptor is logging it out and then may be your application keep increasing sequence number until it catches with what acceptor was accepting also check start time for both initiator and acceptor.

Anonymous said...

your links on fix protocol tutorials are not working on this page please correct.

Bijay Thakur said...

Hi,
This is Bijay Kumar Thakur and I have been working in FIX 4.2 protocol testing (option/stock)with different modes such as BATS,ISE, PHLX, KNIGHT,CBOE for option and ISE,BATS,CBSX for stock as a Sr. QA. I also worked in other protocols like ARCA Direct 4.0 and INET.

I would like to say this notes really very good for beginners who just started working on it as well as experience people too.

Thanks
Bijay Kumar Thakur (India)
email: bijay27.bit@gmail.com
voice: 960-846-6149

Anonymous said...

Hey Javin,

Thanks for publishing this easy to follow guide on FIX. It feels like the clouds are clearing.

Magoo Ireland.

Anonymous said...

Hello there, I see lots of TCP connection in TIME_WAIT state, when I do a netstat and grep, what does this mean, Can you please help?

Anonymous said...

Hi Javin:
I am having hard time to get to the Fix Tutorial section - would you please forward me the link. I have been thinking to learn FIX for a long time. My Email address is: muktasaha@hotmail.com
Thanks and much appreciated.

Anonymous said...

Recently, I have faced an strage issue with FIX session connectivity. I had a QuickFIXJ based FIX engine listening on 127.0.0.1 and port 7003, but I am not able to telnet this FIX engine when I use my LAN IP address, something like 192.168.20.43. I wasn't even telent on this host and port, but I can connect using my client FIX engine, when using 127.0.0.1. Once I change the configuration to my LAN IP, I was able to connect this FIX engine from both from inside and outside the host, but not when I use localhost or 127.0.0.1. I am sure this is nothing to do with FIX, but something related to DNS or IP address to hostname mapping, where both LAN IP and localhost, or 127.0.0.1 not resolving to same host.

Anonymous said...

I am also using QuickFIXJ and getting following exception error on client side "Connection failed: No connection could be made because the target machine actively refused it ". I am not able to connect to my FIX Server. I checked FIX Server is up and running but we are not able to connect. Do you see any network or firewall issue? Any pointer. I also tried telnet without any success. Telnet says "Could not open connection to the host, on port 15502: Connect failed

DAY-TRADER said...

Hi guys, i am looking for help, any one would like to help me with fix connectivity issue for money ? (i would like to hire someone to fix this)

my skype: sed.pl

Maybe someone would like to help me.
Thanks guys.

Rohin said...

Please check session timings

ajitg said...

Can I use AMQP based connectivity and FIX session connectivity via AMQP messages in FIX 4.4

ajitg said...

Hi,

Can we have setup like network connectivity different than FIX protocol.
Foe example -
can I use AMQP for connecting to a outside FIX system and then receive FIX messages from outside FIX system.

Post a Comment