- Index

< Previous |  | Next >

# 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, 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 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.

### Note

Use of the High Performance FIX engine is based on a license agreement between TIBCO StreamBase and EPAM B2Bits that renews every two years. Be aware that production deployments of StreamBase applications that use StreamBaseFIX will need to be upgraded at least once every two years to take advantage of the latest license period. This might require updating your StreamBase release version.

### 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 component's name, which must be unique in the current 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 fragment. 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 epadmin container resume command (or its sbadmin equivalent), 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, etc.

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). CME supports several logon types; the Param1 field should indicate which type to use (StartOfWeek, MidWeek, In-Session). `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.
`Param1` | string | Required for SetSequenceNumbers commands, optional for Connect command, and ignored for all others. Connect command: Should contain one of `StartOfWeek`, `MidWeek`, `InSession`. If no value is specified, MidWeek is used. 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 a 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, etc) 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, etc). 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 `adapter-configurations.xml` file. Here is an example of such a section, containing all supported settings (long lines wrap to the next, for clarity):

    <adapter-configurations>
      <adapter-configuration name="cme-ilink">
        <section name="session-definition">
          <!-- Market Segment Gateway session -->
          <setting name="id" val="Test MSGW Session" />
          <setting name="host" val="69.50.112.183" /> <!-- Segment 70 (Commodity Futures) -->
          <setting name="port" val="62896" />
          <!-- Leave 'backup-host' empty to disable failover support -->
          <setting name="backup-host" val="69.50.112.182" /> <!-- Segment 70 Secondary IP -->
          <setting name="backup-port" val="62896" />
          <!-- Use this if your system uses multiple NICs <setting name="network-interface"
            val="10.249.81.194"/> -->
          <!-- 'true' to use Convenience Gateway, 'false' to use Market Segment
            Gateway -->
          <setting name="use-convenience-gateway" val="false" />
          <setting name="sender-comp-id" val="UFT004U" />
          <setting name="target-comp-id" val="CME" /> <!-- Always 'CME' -->
          <setting name="sender-location-id" val="US,MA,Massachusetts" />
          <setting name="sender-sub-id" val="StreamBase" />
          <setting name="target-sub-id" val="70" /> <!-- Match value of tag
            1300-MarketSegmentID of SecurityDefinition messages -->
          <setting name="application-system-name" val="StreamBase" />
          <setting name="trading-system-version" val="7.7.3" />
          <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" />
          <setting name="host" val="69.50.112.139" />
          <setting name="port" val="27770" />
          <!-- Use this if your system uses multiple NICs <setting name="network-interface"
            val="10.249.81.194"/> -->
          <!-- 'true' to use Convenience Gateway, 'false' to use Market Segment
            Gateway -->
          <setting name="use-convenience-gateway" val="true" />
          <setting name="sender-comp-id" val="J42004N" />
          <setting name="target-comp-id" val="CME" /> <!-- Always 'CME' -->
          <setting name="sender-location-id" val="US,MA,Massachusetts" />
          <setting name="sender-sub-id" val="StreamBase" />
          <setting name="target-sub-id" val="G" />
          <setting name="application-system-name" val="StreamBase" />
          <setting name="trading-system-version" val="7.7.3" />
          <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>

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.

## Related Topics

- Using Embedded Adapters