An acceptor or initiator can maintain as many FIX sessions as you would like. A FIX session is defined in QuickFix/N as a unique combination of a BeginString (the FIX version number), a SenderCompID (your ID), and a TargetCompID (the ID of your counterparty). A SessionQualifier can also be used to disambiguate otherwise identical sessions.
Each session can have several settings associated with them. Some of these settings may not be known at compile time and are therefore passed via a class called SessionSettings
. SessionSettings
behaves as a data dictionary that can be set and queried.
The SessionSettings
class has the ability to parse settings out of any System.IO.TextReader
. You can also simply pass it a filename. If you decide to write your own components (eg, storage for a particular database) you may also use this to store settings.
A settings file is set up with two types of heading; [DEFAULT] and [SESSION]. [SESSION] tells QuickFIX/N that a new Session is being defined. [DEFAULT] is a section to define settings which will be associated with sessions that don't explicitly define them. QuickFIX/N itself will not define default values for all required settings. If you do not provide a setting that QuickFIX/N needs, it will throw a ConfigError
telling you what setting is missing or improperly formatted.
Below are the settings that can be associated with a session based on the default functionality provided with QuickFIX/N, followed by an example.
Setting | Description | Valid Values | Default |
---|---|---|---|
BeginString | Version of FIX this session uses |
FIXT.1.1
FIX.4.4
FIX.4.3
FIX.4.2
FIX.4.1
FIX.4.0
|
|
SenderCompID | Your ID as associated with this FIX session | case-sensitive alpha-numeric string | |
SenderSubID | (Optional) Your subID as associated with this FIX session | case-sensitive alpha-numeric string | |
SenderLocationID | (Optional) Your locationID as associated with this FIX session | case-sensitive alpha-numeric string | |
TargetCompID | Counterparty's ID as associated with this FIX session | case-sensitive alpha-numeric string | |
TargetSubID | (Optional) Counterparty's subID as associated with this FIX session | case-sensitive alpha-numeric string | |
TargetLocationID | (Optional) Counterparty's locationID as associated with this FIX session | case-sensitive alpha-numeric string | |
SessionQualifier | Additional qualifier to disambiguate otherwise identical sessions | case-sensitive alpha-numeric string | |
DefaultApplVerID | Required only for FIXT 1.1 (and newer). Ignored for earlier transport versions. Specifies the default application version ID for the session. This can be the ApplVerID enum (see the ApplVerID field) or the BeginString for the default version. |
FIX.5.0SP2
FIX.5.0SP1
FIX.5.0
FIX.4.4
FIX.4.3
FIX.4.2
FIX.4.1
FIX.4.0
|
- |
ConnectionType | Defines if session will act as an acceptor or initiator |
initiator
acceptor
|
- |
StartTime | Time of day that this FIX session becomes activated | Time in the format of HH:MM:SS, time is represented in UTC | - |
EndTime | Time of day that this FIX session becomes deactivated | Time in the format of HH:MM:SS, time is represented in UTC | - |
StartDay | For week long sessions, the starting day of week of the session. Use in combination with StartTime. | Day of week in English using any abbreviation (ie mo, mon, mond, monda, monday are valid) | - |
EndDay | For week long sessions, the ending day of week for the session. Use in combination with EndTime. | Day of week in English using any abbreviation (ie mo, mon, mond, monda, monday are valid) | - |
MillisecondsInTimeStamp | Determines if milliseconds should be added to timestamps. Only available for FIX.4.2 and greater. |
Y
N
|
Y |
ResetOnLogon | Determines if sequence numbers should be reset when receiving a logon request. Acceptors only. |
Y
N
|
N |
ResetOnLogout | Determines if sequence numbers should be reset to 1 after a normal logout termination. |
Y
N
|
N |
ResetOnDisconnect | Determines if sequence numbers should be reset to 1 after an abnormal termination |
Y
N
|
N |
RefreshOnLogon | Determines if session state should be restored from persistence layer when logging on. Useful for creating hot failover sessions. |
Y
N
|
N |
EnableLastMsgSeqNumProcessed | Add the last message sequence number processed in the header (optional tag 369). |
Y
N
|
N |
MaxMessagesInResendRequest | Sets the maximum number of messages to retransmit in a single resend request. | Any integer greater than 0 is valid. Use 0 for infinity (default). | 0 |
SendLogoutBeforeDisconnectFromTimeout | Specifies whether a logout message should be sent before a connection is disconnected due to a timeout. |
Y
N
|
N |
IgnorePossDupResendRequests | Specifies whether to ignore a resend request when PossDupFlag (tag 43) is set to true |
Y
N
|
N |
UseLocalTime | Specifies whether to use local machine time for session schedule (StartTime and EndTime). |
Y
N
|
N |
TimeZone | Specifies time zone ID used for session schedule. Cannot be used with UseLocalTime. Supplied ID will be passed to TimeZoneInfo.FindSystemTimeZoneById. (See here for how to get a list of valid IDs on your system.) | Any time zone ID supported on target system. | - |
Setting | Description | Valid Values | Default |
---|---|---|---|
UseDataDictionary | Tells session whether or not to expect a data dictionary. You should always use a DataDictionary if you are using repeating groups. |
Y
N
|
Y |
DataDictionary |
XML definition file for validating incoming FIX messages. If no DataDictionary is supplied, only basic message validation will be done. This setting should only be used with FIX transport versions older than FIXT.1.1. See TransportDataDictionary and AppDataDictionary for FIXT.1.1 settings.
|
Valid XML data dictionary file. QuickFIX/N comes with the following defaults in the spec/fix directory FIX44.xml
FIX43.xml
FIX42.xml
FIX41.xml
FIX40.xml
|
- |
TransportDataDictionary |
XML definition file for validating admin (transport) messages. This setting is only valid for FIXT.1.1 (or newer) sessions. See DataDictionary for older transport versions (FIX.4.0-FIX.4.4) for additional information.
|
Valid XML data dictionary file. QuickFIX/N comes with the following defaults in the spec/fix directory FIXT1.1.xml
|
- |
AppDataDictionary |
XML definition file for validating application messages. This setting is only valid for FIXT.1.1 (or newer) sessions. See DataDictionary for older transport versions (FIX.4.0-FIX.4.4) for additional information. This setting supports the possibility of a custom application data dictionary for each session. This setting would only be used with FIXT.1.1 and newer transport protocols. This setting can be used as a prefix to specify multiple application dictionaries for the FIXT transport. For example:
DefaultApplVerID=FIX.4.2
# For default application version ID
AppDataDictionary=FIX42.xml
# For nondefault application version ID
# Use BeginString suffix for app version
AppDataDictionary.FIX.4.4=FIX44.xml
|
Valid XML data dictionary file, QuickFIX/N comes with the following defaults in the spec/fix directory FIX50SP2.xml
FIX50SP1.xml
FIX50.xml
FIX44.xml
FIX43.xml
FIX42.xml
FIX41.xml
FIX40.xml
|
- |
ValidateFieldsOutOfOrder | If set to N, fields that are out of order (ie, body fields in the header, or header fields in the body) will not be rejected. Useful for connecting to systems which do not properly order fields. |
Y
N
|
Y |
ValidateFieldsHaveValues | If set to N, fields without values (empty) will not be rejected. Useful for connecting to systems that improperly send empty tags. |
Y
N
|
Y |
ValidateUserDefinedFields | If set to N, user defined fields will not be rejected if they are not defined in the data dictionary, or are not present in messages they do not belong to. |
Y
N
|
Y |
Setting | Description | Valid Values | Default |
---|---|---|---|
ReconnectInterval | Time between reconnection attempts in seconds. Only used for initiators. | Positive integer | 30 |
HeartBtInt | Heartbeat interval in seconds. Only used for initiators. | Positive integer | - |
LogonTimeout | Number of seconds to wait for a logon response before disconnecting. | Positive integer | 10 |
LogoutTimeout | Number of seconds to wait for a logout response before disconnecting. | Positive integer | 2 |
SocketConnectPort | Socket port for connecting to a session. Only used for initiators. | Positive integer | - |
SocketConnectHost | Host to connect to. Only used for initiators. | Valid IP address in the format of x.x.x.x or a domain name | - |
SocketConnectPort<n> | Alternate socket ports for connecting to a session for failover, where n is a positive integer. ie, SocketConnectPort1, SocketConnectPort2... must be consecutive and have a matching SocketConnectHost<n> | Positive integer | - |
SocketConnectHost<n> | Alternate socket hosts for connecting to a session for failover, where n is a positive integer. ie, SocketConnectHost1, SocketConnectHost2... must be consecutive and have a matching SocketConnectPort<n> | Valid IP address in the format of x.x.x.x or a domain name | - |
SocketNodelay | Disable Nagle's algorithm for this connection. Written data to the network is not buffered pending acknowledgement of previously written data. Currently, this must be defined in the [DEFAULT] section. |
Y
N
|
Y |
Setting | Description | Valid Values | Default |
---|---|---|---|
SocketAcceptPort | Socket port for listening to incoming connections. Only used with acceptors. | Positive integer, valid open socket port | - |
SocketAcceptHost | Socket host for listening to incoming connections. If not provided, the acceptor will listen on all network interfaces (0.0.0.0) | Valid IP address in the format of x.x.x.x | 0.0.0.0 |
SocketNodelay | Disable Nagle's algorithm for this connection. Written data to the network is not buffered pending acknowledgement of previously written data. Currently, this must be defined in the [DEFAULT] section. |
Y
N
|
Y |
Setting | Description | Valid Values | Default |
---|---|---|---|
PersistMessages | If set to N, no messages will be persisted. This will force QuickFIX to always send GapFills instead of resending messages. Use this if you know you never want to resend a message. Useful for market data streams. |
Y
N
|
Y |
Setting | Description | Valid Values | Default |
---|---|---|---|
FileStorePath | Directory to store sequence number and message files. | Valid directory for storing files, must have write access. | - |
Setting | Description | Valid Values | Default |
---|---|---|---|
FileLogPath | Directory to store logs. | Valid directory for storing files, must have write access | - |
##Sample Initiator Settings File
Here is a typical initiator settings file you might find in a firm that wants to connect to several ECNs.
# default settings for sessions
[DEFAULT]
FileStorePath=store
FileLogPath=log
ConnectionType=initiator
ReconnectInterval=60
SenderCompID=TW
# session definition
[SESSION]
# inherit FileStorePath, FileLogPath, ConnectionType,
# ReconnectInterval and SenderCompID from default
BeginString=FIX.4.1
TargetCompID=ARCA
StartTime=12:30:00
EndTime=23:30:00
HeartBtInt=20
SocketConnectPort=9823
SocketConnectHost=123.123.123.123
DataDictionary=somewhere/FIX41.xml
[SESSION]
BeginString=FIX.4.0
TargetCompID=ISLD
StartTime=12:00:00
EndTime=23:00:00
HeartBtInt=30
SocketConnectPort=8323
SocketConnectHost=23.23.23.23
DataDictionary=somewhere/FIX40.xml
[SESSION]
BeginString=FIX.4.2
TargetCompID=INCA
StartTime=12:30:00
EndTime=21:30:00
# overide default setting for RecconnectInterval
ReconnectInterval=30
HeartBtInt=30
SocketConnectPort=6523
SocketConnectHost=3.3.3.3
# (optional) alternate connection ports
# and hosts to cycle through on failover
SocketConnectPort1=8392
SocketConnectHost1=8.8.8.8
SocketConnectPort2=2932
SocketConnectHost2=12.12.12.12
DataDictionary=somewhere/FIX42.xml
##Sample Acceptor Settings File
Here is a typical acceptor settings file.
# default settings for sessions
[DEFAULT]
FileStorePath=store
FileLogPath=log
ConnectionType=acceptor
ReconnectInterval=60
SenderCompID=ARCA
# session definition
[SESSION]
# inherit FileStorePath, FileLogPath, ConnectionType,
# ReconnectInterval and SenderCompID from default
BeginString=FIX.4.1
TargetCompID=TW
StartTime=12:30:00
EndTime=23:30:00
HeartBtInt=20
SocketAcceptPort=9823
DataDictionary=somewhere/FIX41.xml
[SESSION]
BeginString=FIX.4.0
TargetCompID=TW
StartTime=12:00:00
EndTime=23:00:00
HeartBtInt=30
SocketAcceptPort=8323
DataDictionary=somewhere/FIX40.xml
[SESSION]
BeginString=FIX.4.2
TargetCompID=TW
StartTime=12:30:00
EndTime=21:30:00
# overide default setting for RecconnectInterval
ReconnectInterval=30
HeartBtInt=30
SocketAcceptPort=6523
# (optional) only listen for incoming connections on a specific host
SocketAcceptHost=127.0.0.1
DataDictionary=somewhere/FIX42.xml