FIX 4.4: Connection and Logon¶
The Logon process is the first step in establishing a FIX session between two counterparties (client and server).\ It ensures that both sides agree on session parameters and synchronize message sequence numbers.
Logon Message (MsgType = A)¶
A Logon message must be the first message sent by each side when initiating a FIX session.
Current ScaleTrade Example¶
8=FIX.4.4|9=116|35=A|34=1|49=CLIENT_1|52=20260408-20:33:33|56=SERVER|
98=0|108=30|141=Y|553=304|554=<fix-slot-password>|10=050|
Key Fields¶
- 35=A -- MsgType = Logon\
- 34 -- MsgSeqNum, first message in the session (typically
1)\ - 49 -- SenderCompID (FIX slot code, for example
CLIENT_1)\ - 56 -- TargetCompID (server CompID, usually
SERVER)\ - 52 -- SendingTime\
- 98 -- EncryptMethod (0 = None, 1 = PKCS, etc.)\
- 108 -- HeartBtInt (heartbeat interval in seconds)\
- 141 -- ResetSeqNumFlag (Y = reset sequence numbers, N = continue)\
- 553 -- Username (must equal account
login)\ - 554 -- Password (must equal current FIX slot password)
Logon Workflow in Current Server¶
- Client sends Logon using:
49 = slot_code56 = server sender_comp_id553 = login554 = slot password\
- Server validates the request through
FixManager.\ - If accepted, the server replies with its own Logon.\
- Runtime FIX session becomes active.\
- The slot runtime state is moved to
logged_on.\ - Trading and market-data messages can be exchanged.
Session Management Considerations¶
- Both sides must maintain message sequence numbers (
34).\ - If numbers are out of sync, the Resend Request (2) is used.\
- Heartbeats ensure connectivity; if not received within timeout, the session is terminated.\
- To close the session properly, the Logout (5) message is used.
Validation Rules¶
The current server accepts Logon only if all conditions are satisfied:
- slot exists
- slot is assigned to an account
- slot is enabled
- slot is license-enabled
- slot rules allow logon
Username == loginPassword == current slot password
Example Logon Exchange¶
Client → Server
8=FIX.4.4|9=116|35=A|34=1|49=CLIENT_1|56=SERVER|52=20260408-20:33:33|
98=0|108=30|141=Y|553=304|554=<fix-slot-password>|10=050|
Server → Client
8=FIX.4.4|9=75|35=A|34=1|49=SERVER|52=20260408-20:33:33.374|56=CLIENT_1|
98=0|108=30|141=Y|10=094|
At this point, the FIX session is active and ready for message exchange.
Best Practices¶
- Use the FIX slot code as
SenderCompID, not the server CompID.\ - Always reset sequence numbers (
141=Y) at the start of a new day/session unless your engine manages continuation intentionally.\ - Ensure accurate system time synchronization (NTP).\
- Protect credentials (553/554) -- use secure transport if possible.\
- Log all session messages for audit and troubleshooting.