In FIXEdge C++, users can enable this sequence numbers handing mechanism by setting the session parameter FixLayer.FixEngine.Session.Session_Name.HandleSeqNumAtLogon to true.
The sequence number is too low on Logon
FIX Engine will not accept the session if it detects that a counterparty connects with a sequence lower than expected and ResetSeqNumFlag (141) is not set.This behavior is recommended by the FIX Standard as a serious problem. For example, it identifies the issue that messages on both sides are inconsistent and this may lead to financial losses.
Requesting a single message
Requesting a range of messages
To request a range of messages should be equal to the first message of range, should be equal to the last message of the range.
- To request a range of messages: BeginSeqNo (7) is set to the MsgSeqNum (34) of the first message of the range of missing messages and EndSeqNo (16) is set to the MsgSeqNum (34) of the last message of the range of missing messages.
Requesting all messages from a specific sequence number
- To request all messages subsequent to a particular missing message: BeginSeqNo (7) is set to the MsgSeqNum (34) of the first message of range and EndSeqNo (16) is set to 0. Zero is used to specify all messages after the message with MsgSeqNum (34) = BeginSeqNo (7)
This approach is recommended to recover from out of sequence conditions as it allows for faster recovery in the presence of certain race conditions when both sides are simultaneously attempting to recover a gap.
Setting EndSeqNo(16) to 0 has been the recommended approach since FIX.4.2.
Negative case: Resend request with a correct BeginSeqNo and wrong EndSeqNo
In cases when the counterparty sends EndSeqNo (16) greater than the current counter of outgoing sequence numbers, FIX Antenna sends all messages from BeginSeqNo (7) to the last known message with the current outgoing sequence number.
For example, there is a request is for 1-100 but FIX Engine has only 10 messages so FIX Engine will send messages with sequence from 1 to 10.
Negative case: Resend request with a wrong BeginSeqNo
In cases when the counterparty sends invalid or greater than expected BeginSeqNo (7), the FIX Engine treats it as unexpected and sends back a reject message.
- If BeginSeqNo is greater than expected, QuickFIX doesn’t reject it but sends a Sequence Reset (4) message with NewSeqNo(36) equal to the next expected sequence number expected by the counterparty and doesn’t resend messages.
- If BeginSeqNo is greater than int32, then QuickFIX treats it as a negative integer (-2147483648), sends Sequence Reset message with 34=-2147483648 and 36=2, and then resends all messages.
Modify Sequence Numbers Manually
FIX Antenna C++
The way to modify sequences is described here: FIXEdge Java Administration
Limiting the number of messages in the resend request response from FIXEdge
This option is available starting with FIXEdge version 6.3.0.
If the option is not disabled, FIXEdge will ignore the duplicates of resend requests.
Performance optimizations with the ResendMessagesBlockSize parameter
FIX Engine allows fine-tuning performance by splitting one big resend request in to multiple batches of ResendMessagesBlockSize messages. The best value can be found experimentally. The blocks should be fit in a single MFU.