A quickfix acceptor or initiator can maintain as many FIX sessions as you would like. A FIX session is defined in QuickFIX 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 use to disambiguate otherwise identical sessions.
Each of the sessions can have several settings associated with them. Some of these settings may not be known at compile time and are therefore passed around in a class called SessionSettings.
The SessionSettings class has the ability to pull settings out of any input stream such as a file stream. You can also simply pass it a filename. If you decide to write your own components, (storage for a particular database, a new kind of connector etc...), you may also use the session settings to store settings for your custom component.
A settings file is set up with two types of heading, a [DEFAULT] and a [SESSION] heading. [SESSION] tells QuickFIX that a new Session is being defined. [DEFAULT] is a place that you can define settings which will be inherited bysessions that don't explicitly define them. If you do not provide a setting that QuickFIX needs, it will throw a ConfigError telling you what setting is missing or improperly formatted.
These are the settings you can associate with a session based on the default components provided with QuickFIX, followed by an example.
| ID | Description | Valid Values | Default |
|---|---|---|---|
| Session | |||
| BeginString | Version of FIX this session should use | 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 | |
| TargetCompID | counter parties ID as associated with this FIX session | case-sensitive alpha-numeric string | |
| SessionQualifier | additional qualifier to disambiguate otherwise identical sessions | case-sensitive alpha-numeric string | |
| ConnectionType | Defines if session will act as an acceptor or an initiator | initiator acceptor |
|
| TimeZone | Time zone for this session; if specified, the session start and end will be converted from this zone to UTC. | Time zone ID (America/New_York, Asia/Tokyo, Europe/London, etc.) | |
| StartTime | Time of day that this FIX session becomes activated | time in the format of HH:MM:SS -- in UTC by default, or in the time zone specified by TimeZone | |
| EndTime | Time of day that this FIX session becomes deactivated | time in the format of HH:MM:SS -- in UTC by default, or in the time zone specified by TimeZone | |
| StartDay | For week long sessions, the starting day of week for the session. Use in combination with StartTime. | Day of week in the default locale (e.g. Monday, mon, lundi, lun. etc.) | |
| EndDay | For week long sessions, the ending day of week for the session. Use in combination with EndTime. | Day of week in the default locale (e.g. Monday, mon, lundi, lun. etc.) | |
| MillisecondsInTimeStamp | Determines if milliseconds should be added to timestamps. Only available for FIX.4.2 and greater. | Y N |
Y |
| Validation | |||
| UseDataDictionary | Tell 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 | valid XML data dictionary file, QuickFIX comes with the following defaults in the spec directory FIX44.xml FIX43.xml FIX42.xml FIX41.xml FIX40.xml |
|
| ValidateFieldsOutOfOrder | If set to N, fields that are out of order (i.e. 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 which 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 present in messages they do not belong to. | Y N |
N |
| CheckLatency | If set to Y, messages must be received from the counterparty within a defined number of seconds (see MaxLatency). It is useful to turn this off if a system uses localtime for it's timestamps instead of GMT. | Y N |
Y |
| MaxLatency | If CheckLatency is set to Y, this defines the number of seconds latency allowed for a message to be processed. Default is 120. | positive integer | 120 |
| Initiator | |||
| 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. Default is 10. | positive integer | 10 |
| SocketConnectPort | Socket port for connecting to a session. Only used with a SocketInitiator | positive integer | |
| SocketConnectHost | Host to connect to. Only used with a SocketInitiator | 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. (i.e.) 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. (i.e.) 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 | |
| Acceptor | |||
| SocketAcceptPort | Socket port for listening to incomming connections, Only used with a SocketAcceptor | positive integer, valid open socket port. Currently, this must be defined in the [DEFAULT] section. | |
| SocketAcceptAddress | Local IP address to for binding accept port. | A hostname or IP address parseable by java.net.InetAddress. Currently, this must be defined in the [DEFAULT] section. | Accept connections on any network interface. |
| Storage | |||
| FileStorePath | Directory to store sequence number and message files. Only used with FileStoreFactory. | valid directory for storing files, must have write access | |
| JdbcDriver | JDBC driver for JDBC logger. Also used for JDBC log. | Classname for the JDBC driver. | |
| JdbcURL | JDBC database URL. Also used for JDBC log. | Depends on the JDBC database driver. | |
| JdbcUser | JDBC user. Also used for JDBC log. | ||
| JdbcPassword | JDBC password. Also used for JDBC log. | ||
| JdbcStoreMessagesTableName | Table name for messages table. This also works for the MySQL store. | A valid SQL table name. | messages |
| JdbcStoreSessionsTableName | Table name for sessions table. This also works for the MySQL store. | A valid SQL table name. | sessions |
| MySQLStoreDatabase | Name of MySQL database to access for storing messages and session state. Only used with MySQLStoreFactory. | valid database for storing files, must have write access and correct DB shema | quickfix |
| MySQLStoreUser | User name logging in to MySQL database. Only used with MySQLStoreFactory. | valid user with read/write access to appropriate tables in database | root |
| MySQLStorePassword | Users password. Only used with MySQLStoreFactory. | correct MySQL password for user | empty password |
| MySQLStoreHost | Address of MySQL database. Only used with MySQLStoreFactory. | valid IP address in the format of x.x.x.x or a domain name | localhost |
| MySQLStorePort | Port of MySQL database. Only used with MySQLStoreFactory. | positive integer | standard MySQL port |
| Logging | |||
| CommonsLogEventCategory | Log category for logged events. | Depends on log engine. | |
| CommonsLogIncomingMessageCategory | Log category for incoming messages. |
Depends on log engine. | |
| CommonsLogOutgoingMessageCategory | Log category for outgoing messages. | Depends on log engine. | |
| FileLogPath | Directory to store logs. Only used with FileLogFactory. | valid directory for storing files, must have write access | |
| JdbcDriver | JDBC driver for JDBC logger. Also used for JDBC message store. | Classname for the JDBC driver. | |
| JdbcURL | JDBC database URL. Also used for JDBC message store. | Depends on the JDBC database driver. | |
| JdbcUser | JDBC user. Also used for JDBC message store. | ||
| JdbcPassword | JDBC password. Also used for JDBC message store. | ||
| MySQLLogDatabase | Name of MySQL database to access for logging. Only used with MySQLLogFactory. | valid database for storing files, must have write access and correct DB shema | quickfix |
| MySQLLogUser | User name logging in to MySQL database. Only used with MySQLLogFactory. | valid user with read/write access to appropriate tables in database | root |
| MySQLLogPassword | Users password. Only used with MySQLLogFactory. | correct MySQL password for user | empty password |
| MySQLLogHost | Address of MySQL database. Only used with MySQLLogFactory. | valid IP address in the format of x.x.x.x or a domain name | localhost |
| MySQLLogPort | Port of MySQL database. Only used with MySQLLogFactory. | positive integer | standard MySQL port |
| ScreenLogEvents | Log events to screen. | Y or N | Y |
| ScreenLogIncoming | Log incoming messages to screen. | Y or N | Y |
| ScreenLogOutgoing | Log outgoing messages to screen. | Y or N | Y |
| Miscellaneous | |||
| 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 |
| SendResetSeqNumFlag | Send a sequence number reset when initiating a logon. | Y or N | N |
| ContinueInitializationOnError | Continue initializing sessions if an error occurs. | Y or N | N |
Here is a typical settings file you might find in a firm that wants to connect to several ECNs.
# default settings for sessions
[DEFAULT]
ConnectionType=initator
ReconnectInterval=60
SenderCompID=TW
# session definition
[SESSION]
# inherit 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