CME iLink Order Routing Adapter

Introduction

The Spotfire Streaming Adapter for CME Order Routing allows a StreamBase application to connect to iLink, the CME Globex order entry interface, to enter, modify and cancel orders, and to receive order and fill confirmations.

The adapter is comprised of two operators: one Input operator to receive incoming FIX messages from CME and one Output operator to send FIX messages to CME. Both operators are meant to work as a matched set, sharing a FIX session with the counterpart. Multiple pairs can be used to connect to different hosts, for example, to access multiple market segments in one application.

The CME Order Routing adapter provides the following services:

  • Connects to a CME iLink Convenience Gateway or Market Segment Gateway server.

  • Performs start of week, mid-week and in-session logons using CME's secure logon procedure.

  • Exchanges FIX messages with the server.

  • Automatically fails over to a back-up server (if configured) according to the CME Market Segment Gateway procedures.

FIX Engine

To connect to CME servers, the iLink adapter uses the services of the High Performance FIX engine, a high-speed, low-latency engine derived from the B2Bits Antenna FIX engine from EPAM Systems. A separate license and download is required to use this FIX engine—see your TIBCO representative for details.

Linking Input and Output Operators

In order to share a FIX session, an Input and Output operator pair must be configured to point to the same FIX session definition, as shown in Configuration below. You can define multiple sessions and use different sets of the adapter operators to connect to them simultaneously.

Setting Adapter Properties

These sections list the name and usage of each property setting for both operators.

General Tab

Name: Use this required field to specify or change the name of this instance of this component. The name must be unique within the current EventFlow module. The name can contain alphanumeric characters, underscores, and escaped special characters. Special characters can be escaped as described in Identifier Naming Rules. The first character must be alphabetic or an underscore.

Adapter: A read-only field that shows the formal name of the adapter.

Class name: Shows the fully qualified class name that implements the functionality of this adapter. If you need to reference this class name elsewhere in your application, you can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.

Start options: This field provides a link to the Cluster Aware tab, where you configure the conditions under which this adapter starts.

Enable Error Output Port: Select this checkbox to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports to learn about Error Ports.

Description: Optionally, enter text to briefly describe the purpose and function of the component. In the EventFlow Editor canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Adapter Properties Tab

This section describes the Adapter Properties tab for the Input and Output operators.

CME_iLink Configuration

The Edit button is a shortcut to the StreamBase Configuration File Editor, used for adapter configurationor converting an existing application's adapter-configurations.xml file to HOCON format.

FIX Session Definition

Default: none

REQUIRED SETTING. Identifies the name of the session definition (found in the sbd.sbonf configuration file) to which to connect.

Log Level

Default: INFO

Controls the level of verbosity the adapter uses to send notifications to the console. This setting can be higher than the containing application's log level. If set lower, the system log level will be used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL.

Cluster Aware Tab

Use the settings in this tab to enable this operator or adapter for runtime start and stop conditions in a multi-node cluster. During initial development of the fragment that contains this operator or adapter, and for maximum compatibility with releases before 10.5.0, leave the Cluster start policy control in its default setting, Start with module.

Cluster awareness is an advanced topic that requires an understanding of StreamBase Runtime architecture features, including clusters, quorums, availability zones, and partitions. See Cluster Awareness Tab Settings on the Using Cluster Awareness page for instructions on configuring this tab.

Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.

Caution

Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.

Ports And Schemas

Input Operator Ports

Input Ports

The Input operator has one input port to allow applications to send commands such as connect, disconnect, and so on.

The schema for this port is expected to contain the following fields:

Field Name Field Type Field Description
Command string Always required. Should contain the name of the command to execute. Possible values include:
  • Connect—initiate a connection to the server (FIX logon procedure).

  • Disconnect—disconnect from the server (FIX logout procedure).

  • GetSessionState—emits a tuple on the operator's Status output port indicating the current connection state (CONNECTED, DISCONNECTED, and so on).

  • GetSequenceNumbers—emits a tuple on the operator's Status port containing the current incoming and outgoing message sequence numbers.

  • SetSequenceNumbers—sets the incoming and outgoing message sequence numbers for this session. Note that this cannot be done while the session is running.

  • SwitchToPrimary—disconnect from the back-up server (if necessary) and log in to the primary host. If the primary host is already being used, this command has no effect.

  • SwitchToBackup—disconnect from the primary server (if necessary) and log in to the configured back-up host. If the back-up host is already being used, this command has no effect.

  • IsRunningOnBackup—emits a tuple on the operator's Status port with a parameter of true if the adapter is currently connected to the back-up host, and false if it's currently connected to the primary host.

Param1 string Required for SetSequenceNumbers commands, optional for Connect command, and ignored for all others.

Connect command: Leave null to do a normal Logon, or set to InSession to perform an in-session logon procedure as defined by the CME documentation.

SetSequenceNumbers command: Should contain the desired sequence number for the next incoming FIX message. Set to -1 to leave this sequence number unchanged.

Param2 string Only required for SetSequenceNumbers command, optional for Connect command, and ignored for all others.

Connect command: When using MidWeek in Param1, setting this to AdjustSequenceNumbersFromLogout causes the initial sequence numbers to be adjusted according to the last logout message's reported expected values. This can be useful in cases where a logon attempt is refused because sequence numbers are out of sync.

SetSequenceNumbers command: Should contain the desired sequence number for the next outgoing FIX message. Set to -1 to leave this sequence number unchanged.

Output Ports

The Input operator has seven output ports: one for each of the possible business-level FIX messages sent by CME, one for all session-level messages (such as Logon, Logout, and so on) and one to communicate status events (errors, connections, results of commands, and so on).

Business-level FIX Message Ports

Ports 1 through 5 emit business-level messages as they are received from CME. The ports are:

  1. ExecutionReport (msgtype="8") messages

  2. OrderCancelReject (msgtype="9") messages

  3. SecurityDefinition (msgtype="d") messages

  4. QuoteAcknowledge/QuoteCancelAcknowledge (msgtype="b") messages

  5. MassActionReport (msgtype="BZ") messages

The schema for these business-level message ports is set according to the schemas defined by CME. Each field in the schema is the direct equivalent of the incoming message's field of the same name.

Admin-level FIX Message Port

All admin-level messages are routed to the sixth port. Its schema includes every field of every such message types (Logon, Logout, Reject, and so on).

Status Port

Finally, the seventh port is the Status port and has the following schema:

Field Name Field Type Description
status string Describes this event. Possible values can include: Connected, Disconnected, Error.
info list<string> This is an all-purpose field used to convey additional information describing this event. For example, in the case of an Error event this will contain the text describing the error.

Output Operator Ports

The Output operator has one input port to receive business-level FIX messages to be sent to CME, and one output port to communicate status events.

Input port

The input port is expected to contain fields named after their FIX message counterparts (MsgType, Symbol, BidPrice, and so on). It is a best practice to use schema that is a union of all possible fields for all possible business-level messages that can be sent to CME (or a subset thereof). Only one field is mandatory: a string field named MsgType, to indicate the type of message represented by the current tuple. Set all other fields according to CME's rules of engagement for this message type or left null if they correspond to another message type.

As of this writing, CME supports the following message types that can be sent from the client to its server:

  • NewOrder (msgtype="D")

  • OrderCancelRequest (msgtype="F")

  • OrderCancelReplaceRequest (msgtype="G")

  • OrderStatusRequest (msgtype="H")

  • QuoteRequest (msgtype="R")

  • SecurityDefinitionRequest (msgtype="c")

  • NewOrderCross (msgtype="s")

  • MassQuote (msgtype="i")

  • QuoteCancel (msgtype="Z")

  • OrderMassStatusRequest (msgtype="AF")

  • OrderMassActionRequest (msgtype="CA")

Note

Other than the MsgType field, there is no need to specify any header fields for the outgoing messages. These are automatically filled out by the operator before the message is sent.

Note

It will be convenient to open the Schema FIX Designer and select CMEOrderRoutingQFJDictionary.xml dictionary to generate a schema that includes all the fields needed for the desired messages. See FIX Adapter for details on how to use the FIX Schema Designer.

Configuration

The Input and Output operators share a connection to the same FIX session, provided they are configured to do so. Each operator lists the sessions available in a drop-down box (see FIX Session Definition). The list's values are specified in a dedicated section of the application's CME_iLink.conf file. Here is an example of such a section, containing all supported settings (long lines wrap to the next, for clarity):

name = "CME_iLink.conf"
        type = "com.tibco.ep.streambase.configuration.adapter"
        version = "1.0.0"
        configuration = {
        
        // An adapter group type defines a collection of EventFlow adapter configurations, indexed 
        // by adapter type.
            AdapterGroup = {
        
        // A collection of EventFlow adapter configurations, indexed by adapter type. This key is 
        // required and must contain at least one configuration.
                adapters = {
        
        // The root section for an EventFlow adapter configuration.
                    cme-ilink = {
        
        // Section list. This key is optional and has no default value.
                        sections = [
        
        // A configuration for an EventFlow adapter named section.
                            {
        
        // Section name. The value does not have to be unique; that is, you can have multiple 
        // sections with the same name in the same array of sections. This key is required.
                                name = "session-definition"
        
        // Section property bag. All values must be strings. This key is optional and has no default value.
                                settings = {
                                    access-keys-file = "cmeKeys.txt"
                                    application-system-name = "StreamBase"
                                    application-system-vendor = "TIBCO"
                                    backup-host = "69.50.112.182"
                                    backup-port = "62896"
                                    heartbeat-interval = "30"
                                    host = "69.50.112.183"
                                    id = "Test MSGW Session"
                                    port = "62896"
                                    sender-comp-id = "UFT004U"
                                    sender-location-id = "US,MA,Massachusetts"
                                    sender-sub-id = "StreamBase"
                                    target-comp-id = "CME"
                                    target-sub-id = "70"
                                    trading-system-version = "7.7.4"
                                }
                            }
        
        // A configuration for an EventFlow adapter named section.
                            {
        
        // Section name. The value does not have to be unique; that is, you can have multiple 
        // sections with the same name in the same array of sections. This key is required.
                                name = "session-definition"
        
        // Section property bag. All values must be strings. This key is optional and has no 
        // default value.
                                settings = {
                                    access-keys-file = "cmeKeys.txt"
                                    application-system-name = "StreamBase"
                                    application-system-vendor = "TIBCO"
                                    backup-host = "69.50.112.164"
                                    backup-port = "28210"
                                    heartbeat-interval = "30"
                                    host = "69.50.112.143"
                                    id = "Test CGW Session"
                                    port = "28210"
                                    sender-comp-id = "J42004N"
                                    sender-location-id = "US,MA,Massachusetts"
                                    sender-sub-id = "StreamBase"
                                    target-comp-id = "CME"
                                    target-sub-id = "G"
                                    trading-system-version = "7.7.4"
                                }
                            }
                        ]
                    }
                }
            }
        }

A best practice is to define your sessions before placing operator instances on the canvas, so that the lists are already available in the Properties view and the operators can be configured right away.

High-Performance FIX Properties Files

In addition to the configuration file described in the previous section, the HPFIX engine also requires the presence of a second file named fixengine.properties, which helps specify engine-wide settings. Place this file in your project's top-level directory, or use the adapter configuration file's <fixengine-properties-file> setting (as described in the previous section) to specify another location. Here is an example of a typical file, the same one provided in the CME iLink adapter sample included in StreamBase.

The HPFIX engine is derived from the B2Bits Antenna FIX engine from EPAM Systems. Refer to the B2BITS FIX Antenna Java Programmer's Guide for a complete description of the available settings for the fixengine.properties file.

# Sets path to fixaj home.
fixaj.home=.

# Storage directory could be either absolute path (like /tmp/logs or c:\fixengine\logs)
# or relative path e.g. logs (this one is relative to the application start directory).
# If fixaj.home is not defined the value was taking from system environment.
storageDirectory=${fixaj.home}/logs

# The max requested messages in block. This parameter defines how many messages
# will be request in one block.
# The value must be integer and not less than 0.
maxRequestResendInBlock=2499

# This parameter specifies whether to issue subsequently duplicates
# (PossDupFlag(43) = 'Y') of last Resend Request for continuing gaps resting on
# LastMsgSeqNumProcessed(369) field values of incoming messages.
# The counterparty then must respond only to the original request or
# a subsequent duplicate Resend Request if it missed the original.
# The duplicate(s), otherwise, can be discarded, as it does not have a unique
# message sequence number of its own.
# Valid values: Yes | No
advancedResendRequestProcessing=Yes

#This parameter specifies whether to process 789-NextExpectedMsgSeqNum tag.
#If true, outgoing sequence number must be updated by 789-NextExpectedMsgSeqNum tag value. 
adjustSequencesFromLogoffMessage=true

# This parameter specifies whether respond only to the original request or
# a subsequent duplicate Resend Request if it missed the original.
# If this option is disabled, FIXAJ will respond to any Resend Request.
# Valid values: Yes | No
# Default value: No
skipDuplicatedResendRequests=Yes
switchOffSendingMultipleResendRequests=true

# Maximum message size supported by this FIX engine instance.
# Parameter must be integer and not negative. Otherwise, FIXAJ will use the standard
# values for these parameters.
# Maximum message size supported by this FIX engine instance
# should be greater than expected by approximately 1-5%
maxMessageSize=1048576

# Include last processed sequence 369 tag in every message for FIX versions>4.2
includeLastProcessed=true

# Enable this option if it need to quiet handle Logout as a first session message.
# The FIX Specification requires that the first message should be Logon. In other cases,
# it needs to send with answer Logout message warning "First message is not logon". 
# Also sometimes first incoming Logout has a wrong sequence (for example if you send 
# Logon with 141=Y). This option allow to skip sending ResendRequest and warning
# to counterparty.
quietLogonMode=true

# This parameter specifies whether to check the OrigSendingTime(122) field
# value for incoming possible duplicated messages (PossDupFlag(43) = 'Y').
# For iLink it OrigSendingTime(122) field wasn't send in duplicated ResendRequest
# Valid values: true | false
# Default value: true
origSendingTimeChecking=false

# Sets global/per message handler(s), handler will be called upon each and every incoming message.
# NOTE: Handler numbers should be unique and sequential
# NOTE: Handler could prevent further message processing
system.messagehandler.global.0=com.epam.fixengine.session.messagehandler.global.MessageValidatorHandler
system.messagehandler.global.1=com.epam.fixengine.session.messagehandler.global.PossDupMessageHandler
system.messagehandler.global.2=com.epam.fixaj.ilinkadaptor.handler.global.MSGWFailoverSequenceHandler
system.messagehandler.global.3=com.epam.fixengine.session.messagehandler.global.RRSequenceRangeResponseHandler
system.messagehandler.global.4=com.epam.fixaj.ilinkadaptor.handler.global.EnhancedRRMessageHandler
system.messagehandler.global.5=com.epam.fixengine.session.messagehandler.global.SendingTimeAccuracyHandler
system.messagehandler.global.6=com.epam.fixengine.session.messagehandler.global.VersionConsistencyHandler
system.messagehandler.global.7=com.epam.fixaj.ilinkadaptor.handler.global.MSGWFailoverListener
system.messagehandler.global.8=com.streambase.sb.adapter.fix.engine.antenna.messagehandlers.ILinkQuietLogonModeHandler
system.messagehandler.global.9=com.streambase.sb.adapter.fix.engine.antenna.messagehandlers.AdjustSequencesHandler
system.messagehandler.global.10=com.epam.fixaj.ilinkadaptor.handler.global.SenderTargetIdMSGWConsistencyHandler
system.messagehandler.global.11=com.epam.fixengine.session.messagehandler.global.GarbledMessageHandler

# Resend Requests already processed by global handler
system.messagehandler.2=com.epam.fixaj.ilinkadaptor.handler.global.IgnoreMessageHandler
system.messagehandler.3=com.epam.fixaj.ilinkadaptor.handler.global.ILinkRejectMessageHandler

rejectMessageHandler.rejectMessageTextForDisconnect=Range of messages to resend is greater than maximum allowed

Related Topics