Definition of Session

Imported from previous forum

[ original email was from Sarah Ash - ash@itginc.com ]

I wanted to know what comprises a single session.

For example, if someone sends us a Logon and we pass messages back and forth so that they’ve sent us 100 messages. Then they send us a Logout. Later that same day they send us another Logon.

Is this the same session and we should expect the sequence number to be 101? Or is this a new session and we should expect the sequence number to be 1?

Does the same apply if they don’t Logout but accidentally lose their connection to us?

Thank You, Sarah Ash

[ original email was from Ryan Pierce - rpierce@taltrade.com ]
> For example, if someone sends us a Logon and we pass messages back and forth so that they’ve sent us 100 messages. Then they send us a Logout. Later that same day they send us another Logon.
>
> Is this the same session and we should expect the sequence number to be 101? Or is this a new session and we should expect the sequence number to be 1?

The definition of a session is generally established by bilateral agreement. While defining a session as ending after the parties exchange Logouts may technically be within the specification, it certainly isn’t common practice.

In general practice, people define trading sessions on a daily basis. Someone sending a Logout and then a Logon, within the same day, generally will keep going at 101. If the person did a Logout at the end of the day, they almost certainly will want to do a Logon with sequence number 1 the following day.

This becomes more complicated once you enter the international scene where there may be markets open around the clock, hence there isn’t any good time to Logout, resent sequence numbers and Logon. FIX 4.1 introduced 24-hour sessions to accomodate this. One can send a Logon with a ResetSeqNumFlag to cue the other party to reset their sequence numbers and keep going.

> Does the same apply if they don’t Logout but accidentally lose their connection to us?

In this case, you would not want to reset sequence numbers. Doing so would prevent recovery of messages possibly lost while the parties are down, since all recovery is based upon sequence numbers.

An exception is if a party breaks the connection without a Logout at the end of the day, and establishes it the next day. This is a particularly sloppy thing to do, as messages sent around the time of the Logout could be lost. Usually in that case, the sequence numbers reset overnight, and the client comes in with 1 the next morning.