Skip to main content

FIX Sequence Numbers

FIX sessions use sequence numbers to track every message sent and received. Both sides of a session maintain their own counters, and if they fall out of sync, the session will stall until the gap is resolved.

This page explains what sequence numbers are, what happens when they go wrong, and how to fix it.


What sequence numbers are

Every FIX message has a sequence number. When you connect to a venue:

  • Your outbound sequence number (SenderSeqNum) starts where it left off from the last session, or at 1 if it's a fresh start
  • The venue's inbound expectation is whatever number they received last, plus one

If those two don't match, the venue will either request a resend or reject the logon.

In practice, sequence numbers usually take care of themselves. The platform tracks them automatically across reconnects. You only need to intervene when something unusual happens.


When sequence numbers go wrong

The venue rejects the logon

If your adapter connects but the session immediately disconnects, check the event log for a logout event. A sequence number mismatch at logon usually means one side's numbers drifted while the connection was down, for example if messages were sent in one direction during a network interruption.

The session stalls with a resend request

If the venue sends a resend request (you'll see this in the FIX message log), the platform will automatically replay the missing messages. This usually resolves itself. If it doesn't, the session may need a reset.

Numbers are wildly out of sync

This can happen after:

  • A disaster recovery event where the database was restored from a backup
  • A venue resets their side and starts from 1
  • A test environment being promoted to production

What you can do

Option 1: Reset the session

Resetting the session tells the platform to close the current FIX connection and reopen it with a fresh logon. This is the safest first step.

From the Portal: Open the adapter, find the session controls, and click Reset Session.

This will appear in the event log as: Session reset initiated

The venue and platform will negotiate sequence numbers as part of the new logon. Most venues accept a sequence reset request during logon.

Option 2: Set sequence numbers manually

If the venue tells you exactly what sequence numbers they expect (this sometimes happens in venue support calls), you can set them directly.

From the Portal: Open the adapter, find the session's sequence number controls, enter the new SenderSeqNum and TargetSeqNum, and save.

This will appear in the event log as: Sequences updated manually

caution

Setting sequence numbers manually while the session is active will cause the next message to use the new number. If the number doesn't match what the venue expects, the session will reject. Only do this when the venue has explicitly told you what numbers to use.


When to ask the venue

If resetting the session doesn't resolve the issue, contact the venue's technical support. They can tell you exactly what sequence numbers they have recorded for your session and confirm whether a sequence reset is acceptable.

Most venues have a support process for resetting sequence numbers outside of market hours.


Sequence numbers and adapter restarts

If the adapter restarts (for example, during a rolling update or an unexpected pod restart), the platform recovers sequence numbers from the database automatically. On reconnect, the counterparty detects the sequence gap and replays any messages that were missed. This requires no manual intervention.

However, if the session is configured with ResetOnLogon=Y, this recovery is negated. Both sides reset to sequence 1 on reconnect, which means neither side knows a gap exists. Messages sent during the downtime are permanently lost.

Recommendation: Set ResetOnLogon=N for production sessions. See Configuring FIX Connections for details.


Sequence numbers and disaster recovery

If you restore the platform from a database backup, the sequence numbers stored in the database will be from the backup point. Any messages sent or received after the backup point will not be reflected.

Before reconnecting after a restore, contact the venue to align on the correct sequence numbers before re-enabling your adapters.