QuickFIX/J User Manual

Configuring QuickFIX/J

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 by sessions 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.

QuickFIX Settings

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.
Note: This qualifier must be non-empty if JDBC access to an Oracle database is used. See Special notes for Oracle.
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 [timezone]. The time zone is optional. The TimeZone setting will be used, if set, or UTC will be used by default. The timezone string should be one that the Java TimeZone class can resolve. For example, "15:00:00 US/Central".  
EndTime Time of day that this FIX session becomes deactivated time in the format of HH:MM:SS [timezone]. The time zone is optional. The TimeZone setting will be used, if set, or UTC will be used by default. The timezone string should be one that the Java TimeZone class can resolve. For example, "09:00:00 US/Eastern".  
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
ClosedResendInterval Use actual end of sequence gap for resend requests rather than using "infinity" as the end sequence of the gap. Not recommended by the FIX specification, but needed for some counterparties. 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 Valid XML data dictionary file, QuickFIX comes with the following defaults in the etc directory: FIX44.xml, FIX43.xml, FIX42.xml, FIX41.xml, FIX40.xml.

If DataDictionary is not specified and UserDataDictionary=Y, then QuickFIX/J will look for a default dictionary based on the session's BeginString (e.g., FIX.4.2 = FIX42.xml). The DataDictionary file search strategy is to use a URL, then the file system, and then the thread context classloader (if any), and then the DataDictionary instance's classloader. Default data dictionary files are included in the QuickFIX/J jar file.

 

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
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
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  
SocketConnectProtocol Specifies the initiator communication protocol. The SocketConnectHost is not used with the VM_PIPE protocol, but the SocketConnectPort is significant and must match the acceptor configuration. "TCP" or "VM_PIPE". "TCP"
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.
SocketAcceptProtocol Specifies the acceptor communication protocol. The SocketAcceptAddress is not used with the VM_PIPE protocol, but the SocketAcceptPort is significant and must match the initiator configuration. "TCP" or "VM_PIPE". "TCP"
RefreshOnLogon Refresh the session state when a logon is received. This allows a simple form of failover when the message store data is persistent. The option will be ignored for message stores that are not persistent (e.g., MemoryStore). Y
N
N
Secure Communication Options
SocketUseSSL Enables SSL usage for QFJ acceptor or initiator. "Y" or "N" N
SocketKeyStore KeyStore to use with SSL File path
SocketKeyStorePassword KeyStore password
Socket Options (Acceptor or Initiator)
Acceptor socket options must be set in settings default section.
Initiator socket options can be set in either defaults or per-session settings.
SocketKeepAlive When the keepalive option is set for a TCP socket and no data has been exchanged across the socket in either direction for 2 hours (NOTE: the actual value is implementation dependent), TCP automatically sends a keepalive probe to the peer. This probe is a TCP segment to which the peer must respond. One of three responses is expected:
  1. The peer responds with the expected ACK. The application is not notified (since everything is OK). TCP will send another probe following another 2 hours of inactivity.
  2. The peer responds with an RST, which tells the local TCP that the peer host has crashed and rebooted. The socket is closed.
  3. There is no response from the peer. The socket is closed.
The purpose of this option is to detect if the peer host crashes.
"Y" or "N"
SocketOobInline When the OOBINLINE option is set, any TCP urgent data received on the socket will be received through the socket input stream. When the option is disabled (which is the default) urgent data is silently discarded. "Y" or "N"
SocketReceiveBufferSize Set a hint the size of the underlying buffers used by the platform for incoming network I/O. When used in set, this is a suggestion to the kernel from the application about the size of buffers to use for the data to be received over the socket. Integer value.
SocketReuseAddress Sets SO_REUSEADDR for a socket. This is used only for MulticastSockets in java, and it is set by default for MulticastSockets. "Y" or "N"
SocketSendBufferSize Set a hint the size of the underlying buffers used by the platform for outgoing network I/O. When used in set, this is a suggestion to the kernel from the application about the size of buffers to use for the data to be sent over the socket. Integer value.
SocketLinger Specify a linger-on-close timeout. This option disables/enables immediate return from a close() of a TCP Socket. Enabling this option with a non-zero Integer timeout means that a close() will block pending the transmission and acknowledgement of all data written to the peer, at which point the socket is closed gracefully. Upon reaching the linger timeout, the socket is closed forcefully, with a TCP RST. Enabling the option with a timeout of zero does a forceful close immediately. If the specified timeout value exceeds 65,535 it will be reduced to 65,535. Integer value.
SocketTcpNoDelay Disable Nagle's algorithm for this connection. Written data to the network is not buffered pending acknowledgement of previously written data. "Y" or "N"
SocketTrafficClass Sets traffic class or type-of-service octet in the IP header for packets sent from this Socket. As the underlying network implementation may ignore this value applications should consider it a hint.

The tc must be in the range 0 <= tc <= 255 or an IllegalArgumentException will be thrown.

Notes:

for Internet Protocol v4 the value consists of an octet with precedence and TOS fields as detailed in RFC 1349. The TOS field is bitset created by bitwise-or'ing values such the following :-

  • IPTOS_LOWCOST (0x02)
  • IPTOS_RELIABILITY (0x04)
  • IPTOS_THROUGHPUT (0x08)
  • IPTOS_LOWDELAY (0x10)
The last low order bit is always ignored as this corresponds to the MBZ (must be zero) bit.

Setting bits in the precedence field may result in a SocketException indicating that the operation is not permitted.

An integer value or a set of string options separated by "|" (e.g., "IPTOS_LOWCOST|IPTOS_LOWDELAY")
Storage
Note: The QuickFIX database-specific classes (MySQLStore, etc.) are not included in QuickFIX/J. Use the JDBC support instead. The message store and logging schema are simple and should be easily adapted to any JDBC-supported database.
PersistMessages If set to N, no messages will be persisted. This will force QFJ 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
N
FileStorePath Directory to store sequence number and message files. Only used with FileStoreFactory. valid directory for storing files, must have write access  
JdbcDataSourceName JNDI name for the JDBC data source. This technique for finding the data source can be used as an alternative to specifying the driver details. It allows better integration with application servers and servlet containers that are already configured with JDBC data sources. JNDI name of the data source. Configuration of the initial context must be done by an application server, through a property file or through system properties. See JNDI documentation for more information.  
JdbcDriver JDBC driver for JDBC logger. Also used for JDBC log. Class name for the JDBC driver. Specify driver properties directly will cause the creation of a Proxool data source that supports connection pooling. If you are using a database with it's own pooling data source (e.g., Oracle) then use the setDataSource() method on the Jdbc-related factories to set the data source directly.  
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. A valid SQL table name. messages
JdbcStoreSessionsTableName Table name for sessions table. A valid SQL table name. sessions
JdbcLogHeartBeats Controls filtering of heartbeats for message logging (both in and out). Y or N N
Logging
FileLogPath Directory to store logs. Only used with FileLogFactory. valid directory for storing files, must have write access  
FileLogHeartbeats Controls logging of heartbeat messages. Y or N N
FileIncludeMilliseconds Controls whether milliseconds are included in log time stamps. "Y" or "N" "N"
FileIncludeTimeStampForMessages Controls whether time stamps are included on message log entries. "Y" or "N" "N"
SLF4JLogEventCategory Log category for logged events. Depends on log engine. The SLF4J adapter for JDK 1.4 logging is included by default. An adapter for Log4J and the Log4J JAR are in the lib/optional directory. See slf4j.org for other options. The SLF4J category options support Session ID variables in the category names. The variables are:
  • ${fixMajorVersion}
  • ${fixMinorVersion}
  • ${senderCompID}
  • ${targetCompID}
  • ${qualifier}
For example, a category value "${senderCompID}.events" (without the quotes) would become "BANZAI.events" in the log file if BANZAI is the senderCompID for the session. This can be used with advanced logging libraries like Log4J to create sophisticated session-specific logging policies.
quickfixj.event
SLF4JLogIncomingMessageCategory

Log category for incoming messages.

Depends on log engine. See "SL4JLogEventCategory". quickfixj.msg.incoming
SLF4JLogOutgoingMessageCategory Log category for outgoing messages. Depends on log engine. See "SL4JLogEventCategory". quickfixj.msg.outgoing
SLF4JLogPrependSessionID Controls whether session ID is prepended to log message. Y or N Y
SLF4JLogHeartbeats Controls whether heartbeats are logged. Y or N N
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.    
ScreenLogEvents Log events to screen. Y or N Y
ScreenLogShowIncoming Log incoming messages to screen. Y or N Y
ScreenLogShowOutgoing Log outgoing messages to screen. Y or N Y
ScreenLogShowHeartBeats Filter heartbeats from output (both incoming and outgoing) Y or N N
Miscellaneous
ResetOnLogon Determines if sequence numbers should be reset before sending/recieving a logon request. 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
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
SendRedundantResendRequests Allows sending of redundant resend requests. Y or N N

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