Search code examples
c++quickfix

reset sequence number in quickfix


I am working with a broker that tells me not to reset the sequence numbers on logon, except at the beginning of the week. However, if the sequence numbers get out of wack, I am supposed to use tag 141 in the logon message to request a sequence number reset. Obviously I can check the rejected logons for being rejected for sequence number too low, and set the tag in the onlogon, but how do I tell quickfix that it needs to reset it's sequence numbers? this is a difficult feature to test since connection issues that fowl the sequence numbers dont happen very often.

Im using the C++ version of quickfix.


Solution

  • You can monitor for the proper message in the LOGOUT message. If it's something like "msgseqnum too low" set a flag to reset on the next LOGON message. This is from the FIX::Application::fromAdmin implementation.

    Then in your FIX::Application::toAdmin implementation check if the message is a LOGON and there's a reset flag set. If so, lookup your session (FIX::Session::lookupSession) and call setNextSenderMsgSeqNum(1) and setNextTargetMsgSeqNum(1). Also reset your flag :)