# Configuring QuickFIX

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 which acts as a data dictionary that can be queried.

The SessionSettings class has the ability to pull settings out of any c++ 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 this to store settings.

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 associated with sessions that don't explicitly define them. QuickFIX itself will not define any default settings for you. 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.

## QuickFIX Settings

- Session
- Validation
- Miscellaneous
- Initiator
- Acceptor
- Storage
- Logging
- Sample Settings File

ID | Description | Valid Values | Default
--- | --- | --- | ---
Session
BeginString | Version of FIX this session should use | 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 |
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 |
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 either 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 9 8 7 6 5 4 3 2 |
ConnectionType | Defines if session will act as an acceptor or an 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 for the session. Use in combination with StartTime. | Day of week in English using any abbreviation (i.e. mo, mon, mond, monda, monday are all 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 (i.e. mo, mon, mond, monda, monday are all valid) |
UseLocalTime | Indicates StartTime and EndTime are expressed in localtime instead of UTC. Times in messages will still be set to UTC as this is required by the FIX specifications. | Y N | N
MillisecondsInTimeStamp | Determines if milliseconds should be added to timestamps. Only available for FIX.4.2 and greater. | Y N | Y
SendRedundantResendRequests | If set to Y, QuickFIX will send all necessary resend requests, even if they appear redundant. Some systems will not certify the engine unless it does this. When set to N, QuickFIX will attempt to minimize resend requests. This is particularly useful on high volume systems. | Y N | N
ResetOnLogon | Determines if sequence numbers should be reset when recieving 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
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
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 comes with the following defaults in the spec 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 comes with the following defaults in the spec 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 new 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 comes with the following defaults in the spec 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 (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 | Y
CheckCompID | If set to Y, messages must be received from the counterparty with the correct SenderCompID and TargetCompID. Some systems will send you different CompIDs by design, so you must set this to N. | Y N | Y
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
Miscellaneous
HttpAcceptPort | Port to listen to HTTP requests. Pointing a browser to this port will bring up a control panel. Must be in DEFAULT section. | positive integer |
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. | 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 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 |
SocketNodelay | Indicates a socket should be created with TCP_NODELAY. Currently, this must be defined in the [DEFAULT] section. | Y N | N
Acceptor
SocketAcceptPort | Socket port for listening to incoming connections, Only used with a SocketAcceptor | positive integer, valid open socket port. Currently, this must be defined in the [DEFAULT] section. |
SocketReuseAddress | Indicates a socket should be created with SO_REUSADDR, Only used with a SocketAcceptor | Y N | Y
SocketNodelay | Indicates a socket should be created with TCP_NODELAY. Currently, this must be defined in the [DEFAULT] section. | Y N | N
Storage
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 Y | N
FILE
FileStorePath | Directory to store sequence number and message files. | valid directory for storing files, must have write access |
MYSQL
MySQLStoreDatabase | Name of MySQL database to access for storing messages and session state. | valid database for storing files, must have write access and correct DB shema | quickfix
MySQLStoreUser | User name logging in to MySQL database. | valid user with read/write access to appropriate tables in database | root
MySQLStorePassword | Users password. | correct MySQL password for user | empty password
MySQLStoreHost | Address of MySQL database. | valid IP address in the format of x.x.x.x or a domain name | localhost
MySQLStorePort | Port of MySQL database. | positive integer | standard MySQL port
MySQLStoreUseConnectionPool | Use database connection pools. When possible, sessions will share a single database connection. Otherwise each session gets its own connection. | Y N | N
POSTGRESQL
PostgreSQLStoreDatabase | Name of PostgreSQL database to access for storing messages and session state. | valid database for storing files, must have write access and correct DB shema | quickfix
PostgreSQLStoreUser | User name logging in to PostgreSQL database. | valid user with read/write access to appropriate tables in database | postgres
PostgreSQLStorePassword | Users password. | correct PostgreSQL password for user | empty password
PostgreSQLStoreHost | Address of MySQL database. | valid IP address in the format of x.x.x.x or a domain name | localhost
PostgreSQLStorePort | Port of PostgreSQL database. | positive integer | standard PostgreSQL port
PostgreSQLStoreUseConnectionPool | Use database connection pools. When possible, sessions will share a single database connection. Otherwise each session gets its own connection. | Y N | N
ODBC
OdbcStoreUser | User name logging in to ODBC database. | valid user with read/write access to appropriate tables in database. Ignored if UID is in the OdbcStoreConnectionString. | sa
OdbcStorePassword | Users password. | correct ODBC password for user. Ignored if PWD is in the OdbcStoreConnectionString. | empty password
OdbcStoreConnectionString | ODBC connection string for database | Valid ODBC connection string | DATABASE=quickfix;DRIVER={SQL Server};SERVER=(local);
Logging
FILE
FileLogPath | Directory to store logs. | valid directory for storing files, must have write access |
FileLogBackupPath | Directory to store backup logs. | valid directory for storing backup files, must have write access |
MYSQL
MySQLLogDatabase | Name of MySQL database to access for logging. | valid database for storing files, must have write access and correct DB shema | quickfix
MySQLLogUser | User name logging in to MySQL database. | valid user with read/write access to appropriate tables in database | root
MySQLLogPassword | Users password. | correct MySQL password for user | empty password
MySQLLogHost | Address of MySQL database. | valid IP address in the format of x.x.x.x or a domain name | localhost
MySQLLogPort | Port of MySQL database. | positive integer | standard MySQL port
MySQLLogUseConnectionPool | Use database connection pools. When possible, sessions will share a single database connection. Otherwise each session gets its own connection. | Y N | N
MySQLLogIncomingTable | Name of table where incoming messages will be logged. | Valid table with correct schema. | messages_log
MySQLLogOutgoingTable | Name of table where outgoing messages will be logged. | Valid table with correct schema. | messages_log
MySQLLogEventTable | Name of table where events will be logged. | Valid table with correct schema. | event_log
POSTGRESQL
PostgreSQLLogDatabase | Name of PostgreSQL database to access for logging. | valid database for storing files, must have write access and correct DB shema | quickfix
PostgreSQLLogUser | User name logging in to PostgreSQL database. | valid user with read/write access to appropriate tables in database | postgres
PostgreSQLLogPassword | Users password. | correct PostgreSQL password for user | empty password
PostgreSQLLogHost | Address of PostgreSQL database. | valid IP address in the format of x.x.x.x or a domain name | localhost
PostgreSQLLogPort | Port of PostgreSQL database. | positive integer | standard PostgreSQL port
PostgreSQLLogUseConnectionPool | Use database connection pools. When possible, sessions will share a single database connection. Otherwise each session gets its own connection. | Y N | N
PostgresSQLLogIncomingTable | Name of table where incoming messages will be logged. | Valid table with correct schema. | messages_log
PostgresSQLLogOutgoingTable | Name of table where outgoing messages will be logged. | Valid table with correct schema. | messages_log
PostgresSQLLogEventTable | Name of table where events will be logged. | Valid table with correct schema. | event_log
ODBC
OdbcLogUser | User name logging in to ODBC database. | valid user with read/write access to appropriate tables in database | sa
OdbcLogPassword | Users password. | correct ODBC password for user. Ignored if UID is in the OdbcLogConnectionString. | empty password
OdbcLogConnectionString | ODBC connection string for database | Valid ODBC connection string. Ignored if PWD is in the OdbcStoreConnectionString. | DATABASE=quickfix;DRIVER={SQL Server};SERVER=(local);
OdbcLogIncomingTable | Name of table where incoming messages will be logged. | Valid table with correct schema. | messages_log
OdbcLogOutgoingTable | Name of table where outgoing messages will be logged. | Valid table with correct schema. | messages_log
OdbcLogEventTable | Name of table where events will be logged. | Valid table with correct schema. | event_log

## Sample Settings File

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=initiator 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