CME iLink Order Routing Adapter

Introduction

The TIBCO StreamBase® 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, such as 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 backup 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, which must be unique in the current EventFlow module. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. 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 with application: If this field is set to Yes (default) or to a module parameter that evaluates to true, this instance of this adapter starts as part of the JVM engine that runs this EventFlow module. If this field is set to No or to a module parameter that evaluates to false, the adapter instance is loaded with the engine, but does not start until you send an sbadmin resume command, or until you start the component with StreamBase Manager.

Enable Error Output Port: Select this check box 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 component's purpose and function. In the EventFlow 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.

FIX Session Definition

StreamSQL name: sessionDefinitionID

Default: none

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

Log Level

StreamSQL name: logLevel

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.

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 configured 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 backup server (if necessary) and log on 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 on to the configured backup host. If the backup 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 backup 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 inn-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). TIBCO recommends using 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 launch 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 sbd.sbconf file. Here is an example of such a section, containing all supported settings (long lines wrap to the next, for clarity):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<streambase-configuration xmlns:xi="http://www.w3.org/2001/XInclude"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://www.streambase.com/schemas/sbconf/">
  <!--Include common configuration settings for the project. -->
  <sb-include file="./sbd-common.sbconf" />

  <adapter-configurations>
    <adapter-configuration name="cme-ilink">
      <section name="session-definition">

        <!-- Market Segment Gateway session -->
        <setting name="id" val="Test MSGW Session" />

        <!-- Edit these to the correct values as given by CME for the servers 
             you are trying to reach -->
        <setting name="host" val="69.50.112.183" />
        <setting name="port" val="62896" />
        <setting name="backup-host" val="69.50.112.182" />
        <setting name="backup-port" val="62896" />

        <!-- Use this if your system uses multiple NICs
        <setting name="network-interface" val="10.249.81.194"/>-->

        <!-- You can use this to pick up fixengine.properties from another 
             location than the top-level directory of the project.
             This can be usefule when multiple FIX-based adapters want to 
             use different versions of fixengine.properties.
             Note that if one adapter uses this setting in a project, all 
             FIX-based adapters must use it,
             and no fixengine.properties must be present in the default 
             location.
        <setting name="fixengine-properties-file" 
        val="someSubDirectory/fixengine.properties" />
        -->

        <setting name="sender-comp-id" val="UFT004U" /> <!-- Change this to 
        match your client's compID -->
        <setting name="target-comp-id" val="CME" /> <!-- Always 'CME' -->
        <setting name="sender-location-id" val="US,MA,Massachusetts" />  
        <!-- Change this to your client's location -->
        <setting name="sender-sub-id" val="StreamBase" /> <!-- Change this 
        to your client's assigned value -->
        <setting name="target-sub-id" val="70" /> <!-- Match value of tag 
        1300-MarketSegmentID of SecurityDefinition messages -->

        <!-- You may change these to taste -->
        <setting name="application-system-name" val="StreamBase" />
        <setting name="trading-system-version" val="7.7.4" />
        <setting name="application-system-vendor" val="TIBCO" />

        <!-- CME-provided access keys for secure logon -->
        <setting name="access-keys-file" val="cmeKeys.txt" />

      </section>

      <!-- Convenience Gateway session -->
      <section name="session-definition">
        <setting name="id" val="Test CGW Session" />

        <!-- Edit these to the correct values as given by CME for the servers 
             you are trying to reach -->
        <setting name="host" val="69.50.112.143" />
        <setting name="port" val="28210" />
        <setting name="backup-host" val="69.50.112.164" />
        <setting name="backup-port" val="28210" />

        <!-- Set this if your system uses multiple NICs
        <setting name="network-interface" val="xxx.xxx.xxx.xxx"/>
        -->

        <!-- You can use this to pick up fixengine.properties from another 
             location than the top-level directory of the project.
             This can be usefule when multiple FIX-based adapters want to use 
             different versions of fixengine.properties.
             Note that if one adapter uses this setting in a project, 
             all FIX-based adapters must use it,
             and no fixengine.properties must be present in the default 
             location.
        <setting name="fixengine-properties-file" val="someSubDirectory/fixengine.properties" />
        -->

        <!-- You can use this to specify a heartbeat interval different from CME's default value of 30 seconds.
             Note that the CME documentation states that intervals must be between 30 and 60 seconds, and the adapter
             will enforce these limits at runtime.
        <setting name="heartbeat-interval" val="30" />
        -->

        <setting name="sender-comp-id" val="J42004N" /> <!-- Change this to 
          match your client's compID -->
        <setting name="target-comp-id" val="CME" /> <!-- Always 'CME' -->
        <setting name="sender-location-id" val="US,MA,Massachusetts" />  
        <!-- Change this to your client's location -->
        <setting name="sender-sub-id" val="StreamBase" /> <!-- Change this to 
        your client's assigned value -->
        <setting name="target-sub-id" val="G" />

        <!-- You may change these to taste -->
        <setting name="application-system-name" val="StreamBase" />
        <setting name="trading-system-version" val="7.7.4" />
        <setting name="application-system-vendor" val="TIBCO" />

        <!-- CME-provided access keys for secure logon -->
        <setting name="access-keys-file" val="cmeKeys.txt" />

      </section>

      <!-- Other session definitions go here -->

    </adapter-configuration>
  </adapter-configurations>

</streambase-configuration>

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 shipped with 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.
# FIX Specification requires that first message should be Logon. In other case 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