- Index

< Previous |  | Next >

# EBS Live XML Input Adapter

## Introduction

The TIBCO StreamBase® Adapter for ICAP/EBS Live XML allows a StreamBase application to connect to the ICAP/EBS Live data feed to receive XML-based market data. The EBS Live XML adapter is an input-only adapter.

The EBS Live XML Input adapter has the following capabilities:

- Establishes a TCP-based connection to the EBS Live market data server.

- Converts incoming market data messages (snapshot, update) in XML form from the EBS Live server and sends them as tuples to the StreamBase application.

- Optionally, can receive commands from the StreamBase application to log on to, or log out from, the EBS Live server.

The Input adapter exposes a set of input and output ports, the fields for which are defined later in this document. In addition, the adapter exposes a set of adapter properties as decribed in the next section.

## Properties

This section describes the properties you can set for this adapter, using the Adapter Properties tab of the Properties view in StreamBase Studio.

In the table in this section, the Property column shows each property name as found in the one or more adapter properties tabs of the Properties view for this adapter.

When using this adapter in a StreamSQL program with the APPLY JAVA statement, you must convert the Studio property names to parameter names using the simple formula described in APPLY Statement. For cases where the Studio property name is not convertible in an obvious way, the StreamSQL parameter name is included in the Description column.

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

Property | Data Type | Default | Description
--- | --- | --- | ---
Server Hostname | string | `localhost` | The name (or IP address) of the EBS Live server to which to connect.
Port Number | int | 4002 | The port to which to connect on the EBS Live server.
Add Command Input Port | check box | false (cleared) | If this option is selected, an input port is added to allow the application to send commands to the adapter. The schema used by this port and the available commands are described in Input Ports. (StreamSQL property name: addCommandPort)
Add Status Output Port | check box | false (cleared) | If this option is selected, an output port is added on which status tuples are emitted on connection state transitions.
Log Level | drop-down list | 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.

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

## Adapter Ports And Schemas

### Output Ports

The EBS Live XML Input adapter has an output port, to which will be routed all `Snapshot` (rates_update type="snapshot") and `Update` (rates_update type="update") messages sent by the EBS Live server. The schema for this port is described below. A second, optional status output port, which is used to report connection state transitions, can be enabled by checking the Add Status Output Port property.

The EBS Live documentation describes `Snapshot` messages as follows: “A snapshot message contains the current state of the EBS market. It is the initial message sent to a subscriber upon the establishment of a connection.”

The same documentation describes the `Update` message as follows: “An update message contains all market changes since the previously sent update message.”

### Notes

While the EBS Live XML specification defines a third type of message, `heartbeat`, those are managed by the adapter internally and are never passed on to the application.

The XML messages sent by EBS Live usually contain repeating data groups. This is handled in the StreamBase schema by having a field of type list with an element type of tuple, the fields of which match the fields of the message's repeating group.

#### Output Port Schema

The output port routes incoming `Snapshot` (rates_update type="snapshot") and `Update` (rates_update type="update") messages to the StreamBase application. Each field in the schema is named to match its XML counterpart's tag name.

The schema for this port is pre-set by the adapter, and is described in the following table:

Field Name | Field Type | Description
--- | --- | ---
type | string | The value for this field is either `snapshot` or `update`.
sequence_number | long | The sequence_number element is used to maintain a running count of all messages sent to a subscriber from the EBS MRFv3 Server. When a subscriber connects, the sequence_number will be incremented starting from one for each EBS MRFv3 message sent to the connection. The sequence_number is a positive integer value. Its range is 1 through 2,147,483,647. Though unlikely to occur, should the sequence_number reach its maximum value, it resets to one and resumes incrementing. The sequence_number field always starts from one for new and reestablished connections.
msg_date | timestamp | The msg_date field holds the date on which the EBS MRFv3 Server generated the message. In this timestamp, only the date (year, month, date) part is meaningful; the time part (hours, minutes, etc.) is always set to midnight.
msg_time | timestamp | The msg_time field holds the Coordinated Universal Time (UTC) at which the EBS MRFv3 Server generated the message. In this timestamp, only the time part (hours, minutes, seconds, milliseconds) are meaningful. The date part (year, month, date) is always set to Jan 1st 1970.
update_element | list<tuple> | An EBS MRFv3 XML message can contain multiple update_element elements. It can contain only one update_element per unique currency pair and trading instrument defined in the description, such as EUR.USD.SPOT.
| description | string | A description is an uppercase string of the currency pair and instrument type (such as Spot or NDF). Spot descriptions consist of the two currencies and `SPOT`, delimited by periods. Non-Deliverable Forward (NDF) currency pairs contain an additional code for the tenor appended to the instrument type. Each currency is three characters in length. Tenors are expressed in weeks (W), months (M) or years (Y). An example description element value is `EUR.USD.SPOT`. For NDFs, the value includes the tenor, as in this example: `USD.KRW.NDF.1M`.
| update_detail | list<tuple> | Contains a list of all the updates that apply to the currency pair represented by this `update_element`. Note that some numerical values contained in this tuple are of type `string` in the schema. This is to accommodate the fact that EBS Live may use a value of '`?`' (stale) or '`-`' (inactive) for those numerical fields.
|  | type | string | Indicates the category of the market event. Refer to the EBS Live XML documentation for a list of possible values.
|  | amount | string | An integer value representing an aggregated amount of all Bids at a corresponding price or an aggregated amount of all Offers at a corresponding price. The amount field reflects units of the base currency scale. For example, for precious metals, the unit is in ounces, and 10 million USD is reported as 10. The value can also be '`?`' or '`-`'.
|  | amounts | list<string> | A list of an aggregated amount of all Bids at a corresponding price or a list of an aggregated amount of all Offers at a corresponding price. The amounts element is only non-null in the `update_detail` elements of type `order_book_bid` and `order_book_offer`. Amounts can contain up to five values. Amounts reflect units of the base currency scale. For example, for precious metals, the unit is in ounces, and 10 million USD is reported as 10. Values also allow for '`?`' and '`-`'.
|  | bid | string | All `price`, `bid`, and `offer` field values are sent as decimal numbers, such as 1.4350, with the number of decimal places displayed dependent on the currency pair. The field's actual type is string, allowing for '`?`' and '`-`'. Field values for `price`, `bid`, and `offer` of '`?`' indicate the field's data is unavailable. Clients must handle this as a stale rates error condition. Field values for `price`, `bid`, and `offer` of '`-`' indicate there is no price in the market or insufficient data to calculate a derived data element. This usually occurs for infrequently traded currency pairs. It does not represent an error condition. For both TWAP and VWAP, the field value for `price` will be zero (not '`-`') for no market price or insufficient data condition. All `update_detail` elements include a non-null `price` element, except those of type `open`, `prev_open`, and `prev_close`, which contain non-null `bid` and `offer` fields instead. Value also may be '`?`' or '`-`'.
|  | offer | string | See the description for the `bid` field above. Value also may be '`?`' or '`-`'.
|  | price | string | See the description for the `bid` field above. Value also may be '`?`' or '`-`'.
|  | count | int | An integer value representing either the number of deals or quotes depending on the context. For VWAP, the field value for `count` is zero for no market price or insufficient data condition.
|  | error | double | A decimal number representing the confidence factor associated with the benchmark.
|  | interval | int | The amount of time over which the Traded Average Price or the Volume Average Price was calculated. Interval is in terms of seconds.
|  | prices | list<string> | A list of prices that comprise the order book, or a list of Bids or Offers that comprise the order book. The `prices` field only contains values in `update_detail` fields of type `order_book_bid` and `order_book_offer`. Prices can contain up to five values. Values also may be '`?`' or '`-`'.
|  | price_date | timestamp | The date of the price event as recorded by the EBS system is stored in the `price_date` field. This is used for updating or revising reported events. `price_date` denotes when the price occurred whereas `upd_date` (see below) denotes when the event driving the price occurred. In this timestamp, only the date (year, month, date) part is meaningful; the time part (hours, minutes, etc.) is always set to midnight.
|  | price_time | timestamp | The UTC time of the price event as recorded by the EBS system is stored in this field. This is used for updating or revising reported events for Market High/Low calculations. `price_time` denotes when the price occurred whereas `upd_time` (see below) denotes when the event driving the price occurred. In this timestamp, only the time part (hours, minutes, seconds, milliseconds) is meaningful. The date part (year, month, date) is always set to Jan 1st 1970.
|  | trader_count | string | Total number of unique Trader IDs for a specific Bid amount or a specific Offer amount. Value also may be '`?`' or '`-`'.
|  | trader_counts | list<string> | A list of the total number of unique Trader IDs for a specific Bid amount or a specific Offer amount comprising the order book. The `trader_counts` field is only non-empty in the `update_detail` fields of type `order_book_bid` and `order_book_offer`. `trader_counts` can contain up to five values. Values also may be '`?`' or '`-`'.
|  | upd_date | timestamp | The date of the market event as recorded by the EBS system. In this timestamp, only the date (year, month, date) part is meaningful; the time part (hours, minutes, etc.) is always set to midnight.
|  | upd_time | timestamp | The UTC time of the market event as recorded by the EBS system. In this timestamp, only the time part (hours, minutes, seconds, milliseconds) is meaningful. The date part (year, month, date) is always set to Jan 1st 1970.
|  | volume | double | Aggregate number of units traded for all deals within an interval. The volume field reflects units of the base currency scale. For example, for precious metals, the unit is in ounces, and 10 million USD is reported as 10. For VWAP and Net Volume Flow, the field value for `volume` is zero for no market price or insufficient data.
|  | price_attr | string | For an `update_detail` type equal to `benchmark`, contains the data's source; such as EBS. Contains the associated regional time zone when `update_detail` type equals `high/low` or `open/close`. Valid times zones are LN (London), NY (New York), SY (Sydney), TK (Tokyo), HK (Hong Kong/Singapore), and GL (global). The `price_attr` field value is always in uppercase.

#### Status Output Port

The optional status output port is used to report connection status transitions.

The schema for this port is pre-set by the adapter, and is described in the following table:

Field Name | Field Type | Description
--- | --- | ---
type | string | The type of status tuple, which is currently always `Connection`.
action | string | The action associated with the connection state change: `Connected`, `Failed`, or `Disconnected`.
object | string | The server host and port number.
message | string | A human-readable description of the event.

### Input Ports

By default, the EBS Live XML Input adapter has no input ports. If the Add Command Input Port option is enabled, an input port is created to allow applications to send commands to the adapter.

The schema for this port is expected to contain a single field:

Field Name | Field Type | Field Description
--- | --- | ---
`Command` | string | Always required. Contains the name of the command to execute. See below for a list of the available commands.

Available commands include:

- Connect: Log on to the configured EBS Live server.

- Disconnect: Log out of the configured EBS Live server.

## Typechecking and Error Handling

The EBS Live XML Input adapter uses typecheck messages to help you configure the adapter in your StreamBase application. In particular, the adapter generates typecheck messages for the following reasons:

- A required property is missing.

- One or more required fields in the Command input port is missing or is of the wrong type or size.

## Suspend/Resume Behavior

When suspended, the adapter closes the connection to the EBS Live server.

When resumed, the adapter reconnects to the EBS Live server.

## Related Topics

- Using Embedded Adapters