The Financial Information eXchange ("FIX") Protocol is a series of messaging specifications for the electronic communication of trade-related messages. FIX Protocol helps in an automated, electronic, transparent, reliable, cost efficient and timely communication between counterparties in financial services sector.
FIXInitiator is a FIX engine which can be used by buy side firms such as financial institutions to send FIX messages like order placements to sell side firms such as brokers or dealers. FIXInitiator supports data persistence for storing session state and messages. It supports FIX Protocol versions FIX.4.0 - FIX.4.4 and FIX.5.0 as well as Transport Independence version FIXT.1.1. Apart from FIX Session protocol for session layer communication, FIXInitiator can also be used to communicate over Java Messaging Service.
Configuration
Common Session Configuration
Session details that are common across all FIX sessions should be configured here.
General Configuration
Figure 1: General Configuration
- Transport Type – The transport type used by session layer communication. Transport Type can be either TCPIP or JMS.
- TCPIP - Session communication is done using FIX Session Protocol i.e., using socket layer communication.
- JMS - Session communication is done using Java Messaging Service.
- Storage Type – The storage type used for storing sessions' and messages' details. Storage Type can be either FILE or DATABASE.
- FILE - Details regarding sessions and messages are stored in files.
- DATABASE - Details regarding sessions and messages are stored in a database.
When storage type is DATABASE, the database details panel is shown.
- DB Store configuration
- Database - The database that is used to store details regarding sessions and messages. One of the databases present in the drop down can be selected. The default driver and url values are shown which may be edited as required.
- Driver - The driver class using which the component connects to database. The resource file containing the driver class should be added as a resource to FIXLib service in System Lib category.
- URL - The database URL to which the component connects to.
- Username - The database username with which the component connects to database.
Password - The database password with which the component connects to database.
Dictionary configuration
Figure 2: Common Properties Configuration
Properties which are common across all FIX sessions can be specified in common session dictionary. The properties which may be provided here are explained in Properties section.
Session Configuration
A single FIXInitiator instance can be configured to create several FIX sessions. Session details that are specific to each individual FIX session should be configured by adding a session using + on left hand side.
General Configuration
Figure 3: General Session Configuration
Properties related to a specific session such as BeginString, TargetCompID, SenderCompID are provided here. The properties which may be provided here are explained in Properties section.
Transport Configuration
Transport Configuration is shown based on the transport type selected in the previous panel. In case of JMS transport type, transport configuration panel is not shown.
Figure 4: Transport Configuration
Socket Transport Configuration
General
Socket configuration details in case TCPIP transport type can be provided here.
- Host - The hostname of the system on which the acceptor is running to which the initiator will connect to.
- Port - The port on which the acceptor is running to which the initiator will connect to.
- Enable SSL - Whether to use SSL while creating socket connections between initiator and acceptor.
- Keystore - Keystore used for creating secure connection between initiator and acceptor.
- Keystore Password - Password of the keystore specified above.
Additional Properties
Figure 5: Additional Transport Configuration Properties
Additional properties that are used while creating socket connections. The properties which may be provided here are explained in Properties section.
Storage Configuration
Details regarding FIX sessions and messages can be persisted for further use such as in case of resend requests. This can be achieved by using either file or database storage. Storage Configuration is shown based on the storage type selected in the previous panel.
Enable Storage:
All the sessions that are created and messages that are processed by FIX engine will be stored for further use. If set to false, no messages will be persisted. This will force the engine to always send GapFills instead of resending messages. It can be set to false if resending a message is not required such as in case of market data streams.
File Store Configuration
Figure 6: File Store Configuration
- Store Location - Directory to store sequence number, message and session files. The value should be a valid directory and must have write access.
- Store Sync - Boolean option for controlling whether the FileStore syncs to the hard drive on every write. It's safer to synchronize, but it's also much slower (100x or more slower in some cases).
- Max. No. of cached messages - Maximum number of message index entries to cache in memory. The value should be an Integer. A zero will not cache any entries.
Database Store Configuration
Figure 7: Database Store Configuration
- Sessions Table Name: Valid SQL table name for sessions table. If a table by this name does not already exist when the component is launched, the component will create a table with the name specified with following columns -
beginstring VARCHAR(8) NOT NULL, sendercompid VARCHAR(64) NOT NULL,sendersubid VARCHAR(64) NOT NULL, senderlocid VARCHAR(64) NOT NULL,targetcompid VARCHAR(64) NOT NULL, targetsubid VARCHAR(64) NOT NULL,targetlocid VARCHAR(64) NOT NULL, session_qualifier VARCHAR(64) NOT NULL, creation_time TIMESTAMP NOT NULL, incoming_seqnum INT NOT NULL,outgoing_seqnum INT NOT NULL
and primary key:
PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid, targetcompid, targetsubid, targetlocid, session_qualifier)
- Messages Table Name: Valid SQL table name for messages table. If a table by this name does not already exist when the component is launched, the component will create a table with the name specified with following columns:
beginstring VARCHAR(8) NOT NULL, sendercompid VARCHAR(64) NOT NULL, sendersubid VARCHAR(64) NOT NULL, senderlocid VARCHAR(64) NOT NULL,targetcompid VARCHAR(64) NOT NULL, targetsubid VARCHAR(64) NOT NULL,targetlocid VARCHAR(64) NOT NULL, session_qualifier VARCHAR(64) NOT NULL, msgseqnum INT NOT NULL, message VARCHAR(4000) NOT NULL
and primary key:
PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid, targetcompid, targetsubid, targetlocid, session_qualifier, msgseqnum)
Properties
The properties that can be specified in all properties tables across the configuration are mentioned below. All the Boolean type properties' value should be specified as either 'true' or 'false'.
Session Properties
- BeginString - Version of FIX this session should use. Valid values are FIXT.1.1, FIX.4.4, FIX.4.3, FIX.4.2, FIX.4.1, FIX.4.0. Each session should have a BeginString specified in its properties.
- SenderCompID - Sender's compID as associated with this FIX session, a case-sensitive alpha-numeric string. SenderCompID is a required property for each session.
- SenderSubID - Sender's subID as associated with this FIX session, a case-sensitive alpha-numeric string.
- SenderLocationID - Sender's locationID as associated with this FIX session, a case-sensitive alpha-numeric string.
- TargetCompID - counterparty's compID as associated with this FIX session, a case-sensitive alpha-numeric string. TargetCompID is a required property for each session.
- TargetSubID - counterparty's subID as associated with this FIX session, a case-sensitive alpha-numeric string.
- TargetLocationID - counterparty's locationID as associated with this FIX session, a case-sensitive alpha-numeric string.
- SessionQualifier - Additional qualifier to disambiguate otherwise identical sessions.
- DefaultApplVerID - This must and should be specified 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 in FIX specification) or the beginString for the default version.
For example:
Enum. FIX 5.0 over FIXT 1.1
DefaultApplVerID=7
BeginString: FIX 5.0 over FIXT 1.1
DefaultApplVerID=FIX.5.0
BeginString: FIX 4.2 over FIXT 1.1
DefaultApplVerID=FIX.4.2
- HeartBtInt - The interval, in seconds, at which the FIXInitiator sends heartbeat messages to a counter party. HeartbtInt is a required property for each session.
- 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 should be specified 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". StartTime is a required property for each session.
- EndTime - Time of day that this FIX session becomes deactivated. Time should be specified 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". EndTime is a required property for each session.
- 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(Boolean) - Boolean to determine if milliseconds should be added to timestamps. Only available for FIX.4.2 and greater. Default value is true.
- ClosedResendInterval(Boolean) - Boolean to determine whether to 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 counter parties. Default value is false.
- ReconnectInterval - Time between reconnection attempts in seconds.
- LogonTimeout - Number of seconds to wait for a logon response before disconnecting.
- LogoutTimeout - Number of seconds to wait for a logout response before disconnecting.
Validation Properties
- ValidateFieldsOutOfOrder(Boolean) - If set to false, 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. Default value is true.
- ValidateFieldsHaveValues(Boolean) - If set to false, fields without values (empty) will not be rejected. Useful for connecting to systems which improperly send empty tags. Default value is true.
- ValidateUserDefinedFields(Boolean) - If set to false, 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. Default value is false.
- AllowUnknownMsgFields(Boolean) - Allow unknown fields in messages. This is intended for unknown fields with tags < 5000 (not user defined fields). Use ValidateUserDefinedFields for controlling validation of tags >= 5000. Default value is false.
- CheckCompID(Boolean) - If set to true, messages must be received from the counterparty with the correct SenderCompID and TargetCompID. Some systems will send different CompIDs by design, so this must be set to false. Default value is true.
- CheckLatency(Boolean) - If set to true, 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 local time for it's timestamps instead of GMT. Default value is true.
- MaxLatency(Boolean) - If CheckLatency is set to true, this defines the number of seconds latency allowed for a message to be processed. Default is 120. It should be a valid positive integer.
Socket Properties
FIXInitiator socket properties can be set in either common or per-session dictionary.
- SocketKeepAlive(Boolean) - When the keep alive 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 keep alive probe to the peer. This probe is a TCP segment to which the peer must respond. One of the following three responses are expected:
- 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.
- The peer responds with an RST, which tells the local TCP that the peer host has crashed and rebooted. The socket is closed.
- There is no response from the peer. The socket is closed. The purpose of this option is to detect if the peer host crashes.
- SocketOobInline(Boolean) - 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.
- 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. A valid Integer value should be specified.
- SocketReuseAddress(Boolean) - Sets SO_REUSEADDR for a socket. This is used only for MulticastSockets in java, and it is set by default for MulticastSockets.
- 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. A valid Integer value should be specified.
- 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. It should be an Integer value.
- SocketTcpNoDelay(Boolean) - Disable Nagle's algorithm for this connection. Written data to the network is not buffered pending acknowledgement of previously written data. Default value is true.
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.
- SocketSynchronousWrites(Boolean) - Write messages synchronously. This is not generally recommended as it may result in performance degradation. The MINA communication layer is asynchronous by design, but this option will override that behavior if needed. Default value is false.
- SocketSynchronousWriteTimeout - The time in milliseconds to wait for a write to complete. An Integer value should be specified. Defaults to 30000 ms if SocketSynchronousWrites is true.
Storage Properties
JdbcSessionIdDefaultPropertyValue - The default value for Session ID bean properties (namely BeginString, SenderCompID, SenderSubID, SenderLocationID, TargetCompID, TargetSubID, TargetLocationID) is an empty string. Oracle treats this as a SQL NULL and that causes problems. This configuration setting allows to set the default value for unspecified Session ID properties. This property takes any nonempty string value.
Miscellaneous Properties
- ResetOnLogon(Boolean) - Determines if sequence numbers should be reset before sending/receiving a logon request. Default value is false.
- ResetOnLogout(Boolean) - Determines if sequence numbers should be reset to 1 after a normal logout termination. Default value is false.
- ResetOnDisconnect(Boolean) - Determines if sequence numbers should be reset to 1 after an abnormal termination. Default value is false.
- ForceResync(Boolean) - When logout response contains "expecting XXX", the sequence numbers of forcibly resynchronized. Default value is false.
- NonStopSession(Boolean) - Session scheduling setting to specify that session never ends/resets. Default value is false.
- ContinueInitializationOnError(Boolean) - Continue initializing sessions if an error occurs. Default value is false.
- SendRedundantResendRequests(Boolean) - Allows sending of redundant resend requests. Default value is false.
Functional Demonstration
Configure the FIXInitiator as described in Configuration section and send sample input to the component.
Scenario 1
Configure FIXInitiator and FIXAcceptor with TCPIP transport type.
Figure 8: TCPIP Transport Type scenario
FIXInitiator sends Logon message (35=A) as soon as it is started to establish a session using FIX Session protocol. It then sends a NewOrderSingle message (35=D) for FIXAcceptor to execute the order. When FIXInitiator is not sending any messages like order requests to FIXAcceptor, it keeps pinging the FIXAcceptor by sending Heartbeat messages (35=0) for keeping the session alive.
Scenario 2
Configure FIXInitiator and FIXAcceptor with JMS transport type.
Figure 9: JMS Transport Type scenario
Communication between FIXInitiator and FIXAcceptor is similar to Scenario 1 with the only difference being the medium. Here, the communication is done over JMS. FIXInitiator sends admin messages like logon, heartbeat and application messages like order requests to FIXAcceptor via JMS. FIXAcceptor also sends admin messages to FIXInitiator in the same way.
The following is a sample input and output display :
The sample input used is:
8=FIX.4.29=14535=D34=449=EFGHID52=20090323-15:40:2956=ABCDID115=XYZ11=NF 0542/0323200954=138=10055=CVS40=159=060=20090323-15:40:2921=1207=N10=173 |
Figure 10: Input in Feeder window and output in Display window
Useful Tips
- After FIXInitiator is started, it sends a FIX session Logon message for each session configured to a counter party and awaits a response. If a response is not received within time limit specified by LogonTimeout property, the session is disconnected.
- In case of JMS transport type, inorder for FIXAcceptor not to send application messages back to FIXInitiator and to limit the communication from FIXAcceptor to FIXInitiator to just admin messages, a JMS selector (ADMIN_MSG_PROPERTY IS NOT NULL) should be specified on route between outport of FIXAcceptor and inport of FIXInitiator (route3 as shown in the image above).