MarketFactory™ Enhanced Market Data Input Adapter

This adapter is part of the TIBCO StreamBase CEP Connectivity Package.

Introduction

The TIBCO StreamBase® Adapter for MarketFactory allows a StreamBase application to receive enhanced FX market data from MarketFactory. The Enhanced Market Data adapter is an input-only adapter.

The adapter has the following capabilities:

  • Establishes a connection to the MarketFactory Enhanced Market Data server.

  • Subscribes to specific currency pairs and obtains market data for this currency pair from a specified source venue, and receives this data either in the venue's format or in a alternate format. This alternate format may be the format of some other venue, or a custom-defined format.

  • Converts the incoming market data messages from the MarketFactory server and sends them as tuples to the StreamBase application.

  • Optionally receives commands from the StreamBase application to log on to, or log out from, the MarketFactory 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 described in the next section.

Properties

Settings are used to control most of the behavior of the adapter. The settings are grouped under several tabs in 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 field to specify or change the component's name, which must be unique in the application. 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: A field that shows the fully qualified class name that implements the functionality of this adapter. Use this class name when loading the adapter in StreamSQL programs with the APPLY JAVA statement. 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 or to a module parameter that evaluates to true, an instance of this adapter starts as part of the containing StreamBase Server. If this field is set to No or to a module parameter that evaluates to false, the adapter is loaded with the server, but does not start until you send an sbadmin resume command, or until you start the component with StreamBase Manager. With this option set to No or false, the adapter does not start even if the application as a whole is suspended and later resumed. The recommended setting is selected by default.

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 and Error Streams 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
Configuration File drop-down list none The name or the MarketFactory configuration to use to connect to the MarketFactory server. Refer to your particular MarketFactory product installation to determine the file to use.

This control is a drop-down list that shows the available files in the current Studio project. Import the MarketFactory configuration into your Studio project so that it can be selected in the list.

(StreamSQL property name: configFile)

Use Automatic Failover check box false (clearedd) When selected, the adapter does not try to connect to the host and port specified in the Host Name and Port Number properties, but rather looks in the MarketFactory configuration file for a list of hosts and ports to which to connect. If a connection cannot be established (or is subsequently lost), the next host in the list is contacted instead, thus implementing a form of failover strategy.

(StreamSQL property name: useAutomaticFailover)

Host Name string none The name or IP address of the MarketFactory Enhanced Market Data server to which to connect.

Only enabled if Use Automatic Failover is cleared.

(StreamSQL property name: hostName)

Port Number int none The port to which to connect on the MarketFactory server.

Only enabled if Use Automatic Failover is cleared.

(StreamSQL property name: hostPort)

Connect On Startup check box true (selected) When selected, the adapter attempts to connect to the MarketFactory server immediately after starting. When cleared, the adapter remains idle after starting and waits for a Connect command as described in Input Ports.

(StreamSQL property name: connectOnStartup)

Reconnect Retries int 0 The number of times the adapter is to attempt reconnection if the first connection attempt is unsuccessful.

(StreamSQL property name: reconnectRetries)

Reconnect Interval (in seconds) int 10 Specifies the number of seconds to wait between reconnection attempts. This value is ignored unless Reconnect Retries has a non-zero positive value.

(StreamSQL property name: reconnectInterval)

Logging Tab

Property Data Type Default Description
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, and ALL.
Report Profiling Data check box false (cleared) When selected, the adapter collects data on how long it takes to process incoming messages, and regularly reports the results to the console. Reported data includes the average, standard deviation, minimum and maximum times (in microseconds) taken to receive each market data message, convert it into a tuple and send it to the application. This is useful when troubleshooting performance issues in your application.

(StreamSQL property name: isReportingProfilingData)

Reporting Interval (in # of messages) int 10000 When Report Profiling Data is checked, this property specifies the number of incoming messages after which performance data is reported to the console. A positive integer is expected. This property is ignored if Report Profiling Data is cleared.

(StreamSQL property name: profilingDataReportingInterval)

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 MarketFactory Enhanced Market Data Input adapter has four output ports:

  • The first port is routes the Symbol Map messages received on connection to the MarketFactory server.

  • The second port routes incoming market data messages from the server.

  • The third port routes incoming Event Reports from the MarketFactory server.

  • The fourth port routes interesting events, such as connection and disconnection from the server, error conditions, and so on.

The schema for each output port is described in the following subsections.

Symbol Map Output Port Schema

The first output port routes incoming Symbol Map messages to the StreamBase application. Typically one such message will be sent by the server upon connection, to describe the available feeds, styles and currency pairs.

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

Field Name Field Type Description
styles list<tuple> Contains the list of styles available on this server.
^ id int Id of this style.
name string Name of this style.
feeds list<tuple> Contains the list of feeds available on this server.
^ id int Id of this feed.
name string Name of this feed.
currencyPairs list<tuple> Contains the list of currency pairs available on this server.
^ id int Id of this currency pair.
name string Name of this currency pair.

Market Data Output Port Schema

The second output port routes incoming Market Data messages to the StreamBase application. These messages use a complex structure, and the validity and meaning of each field may vary depending on the feed and style requested when the currency pair was subscribed to. Because of this, this document does not attempt to describe each field's semantics in detail and defers to the MarketFactory Enhanced Market Data product's own documentation instead. Specifically, consult the documents MarketFactory Java API Programming Guide, Revision 1.3 and MarketFactory Style Specification, Revision 1.0.

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

Field Name Field Type Description
customerSignalId int The Customer Signal ID specified in the incoming message's MarketView data member.
traderRequestId long The Trader Request ID specified in the incoming message's MarketView data member.
marketData list<tuple> Contains the list of all the MarketData objects contained in the incoming message.
^ feedId int  
^ marketId int  
^ styleId int  
^ feedName string  
^ styleName string  
^ currencyPair string  
^ isSnapshot bool  
^ estExchDelta long This timestamp is expressed in nanoseconds since 1970/01/01 00:00:00 UTC (the Java epoch). It cannot be expressed by a StreamBase timestamp without losing precision, so it is left as a long.

To convert this value to a StreamBase timestamp, divide the value by 1000000 (one million) before assigning it to the timestamp field.

^ exchTimestamp long
^ updateTimestamp long
^ marketDataEntries list<tuple> Contains the list of all the MarketDataEntry objects contained in this MarketData object.
^ ^ id int  
^ ^ entryType string One of:
  • BID

  • CLOSINGPRICE

  • INDEXVALUE

  • OFFER

  • OPENINGPRICE

  • PENDING

  • SETTLEMENTPRICE

  • TRADE

  • TRADINGSESSIONHIGHPRICE

  • TRADINGSESSIONVWAPPRICE

  • INVALID

^ ^ updateAction string One of:
  • CHANGE

  • DELETE

  • NEW

  • NOTAPPLICABLE

  • INVALID

^ ^ elementName string One of:
  • BESTBID

  • BESTOFFER

  • BESTREGULARBID

  • BESTREGULAROFFER

  • DEALABLEBID

  • DEALABLEOFFER

  • DEALABLEOUTSIDEBID

  • DEALABLEPLUSBID

  • DEALABLEPLUSOFFER

  • DEALABLEREGULARBID

  • DEALABLEREGULAROFFER

  • DEALABLEOUTSIDEOFFER

  • GIVEN

  • LOCALBID

  • LOCALOFFER

  • NOTAPPLICABLE

  • ORDERBOOKBID

  • ORDERBOOKOFFER

  • PAID

  • INVALID

^ ^ localTraderId string  
^ ^ priceTimestamp long This timestamp is expressed in nanoseconds since 1970/01/01 00:00:00 UTC (the Java epoch). It cannot be expressed by a StreamBase timestamp without losing precision, so it is left as a long.

To convert this value to a StreamBase timestamp, dividie the value by 1000000 (one million) before assigning it to the timestamp field.

^ ^ numOrders int  
^ ^ price tuple  
^ ^ ^ price double  
^ ^ ^ specialValue string Contains the string representation of the special value, or is null if this amount does not represent a special value.
^ ^ ^ isNAN bool  
^ ^ ^ isNoDataAvailable bool  
^ ^ ^ isNoMarketActivity bool  
^ ^ ^ isNotApplicable bool  
^ ^ amount tuple  
^ ^ ^ amount double  
^ ^ ^ specialValue string Contains the string representation of the special value, or is null if this amount does not represent a special value.
^ ^ ^ isNAN bool  
^ ^ ^ isNoDataAvailable bool  
^ ^ ^ isNoMarketActivity bool  
^ ^ ^ isNotApplicable bool  

Event Report Output Port Schema

The third output port routes incoming Event Report messages to the StreamBase application.

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

Field Name Field Type Description
seqNumber long  
batchId long  
eventReportEntries list<tuple> Contains a list of Event Reports contained in this message.
^ feedId int  
marketId int  
eventType string One of:
  • TRADEDATEROLLOVER

  • TRADINGDAYROLLOVER

  • VALUEDATEROLLOVER

  • INVALID

eventContents string  

Events Output Port Schema

The fourth output port routes incoming events from the MarketFactory server to the StreamBase application. These events may include connection and disconnection from the server, subscription failures, and so forth.

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

Field Name Field Type Description
eventType string The type of event represented by this tuple. Possible values are:
  • Connected: The adapter has connected to the MarketFactory server.

  • Disonnected: The adapter has disconnected from the MarketFactory server.

  • Connection Lost: The adapter lost its connection to the MarketFactory server.

  • Connection Failed: The adapter failed to connect to the MarketFactory server.

  • Subscription Failed: The adapter failed to subscribe to the requested currency pair.

  • Unsubscription Failed: The adapter failed to unsubscribe from the requested currency pair.

This field is guaranteed to be non-null for all events.

text string Contains explanatory text for the event.

This field is guaranteed to be non-null for all events.

code string If relevant, contains an error code.

This field may be null for some events.

actionId long For the subscription-related events Subscription Failed and Unsubscription Failed, contains the value of the actionId field originally passed to the Subscribe or Unsubscribe command. See Input Ports.

This field may be null for some events.

traderReqId long For the subscription-related events Subscription Failed and Unsubscription Failed, contains the value of the traderReqId field originally passed to the Subscribe or Unsubscribe command. See Input Ports.

This field may be null for some events.

rejectReason string

Explains the reason for a subscription rejection.

This field will only be non-null when eventType='Subscription Failed'.

feedMarketStyleList list<tuple>

Contains the list of Feed/Market/Style items for which the subscription failed.

This field will only be non-null when eventType='Subscription Failed'.

^ feedName string  
currencyPair string  
styleName string  

Input Ports

The adapter has only one input port, to allow applications to send commands to the adapter.

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

Field Name Field Type Field Description
command string Contains the name of the command to execute. This field is required to be non-null for all supported commands. See below for a list of the available commands.
feedName string This field may be left null for some types of commands. See description below.
styleName string This field may be left null for some types of commands. See description below.
currencyPair string This field may be left null for some types of commands. See description below.
actionId long Unique identifier which will be associated with this request and shall be passed back as a reference in any subsequent market data request reject message. This field may be left null for some types of commands.
traderReqId long Unique identifier associated with the subscription being managed by this request. It shall be generated by the customer application and is referred to in the following subsequent subscription reject or enhanced market data messages. This field may be left null for some types of commands.

Available commands include:

  • Connect: Log on to the configured MarketFactory Enhanced Market Data server. Required fields:

    • command: Should contain the value Connect. Case is unimportant.

  • Disconnect: Log out of the MarketFactory Enhanced Market Data server. Required fields:

    • command: Should contain the value Disconnect. Case is unimportant.

  • Subscribe: Subscribe to a currency pair from a specific feed using a specific style. Required fields:

    • command: Should contain the value Subscribe. Case is unimportant.

    • currencyPair: The currency pair to which a subscription is desired.

    • feedId: The feed id of the feed on which the subscription is desired.

    • styleId: The style ID to use for the desired subscription.

    • actionId: An arbitrary unique identifier which will be used to refer back to this subscription request in subsequent events (such as request reject messages).

    • traderReqId: An arbitrary unique identifier which will be used to refer to this subscription in subsequent events (such as market data messages).

  • Unsubscribe: Unsubscribe to a currency pair from a specific feed using a specific style. Required fields:

    • command: Should contain the value Unsubscribe. Case is unimportant.

    • currencyPair: The currency pair to which a subscription is desired.

    • feedId: The feed ID of the feed on which the subscription is desired.

    • styleId: The style id to use for the desired subscription.

    • actionId: An arbitrary unique identifier which will be used to refer back to this subscription request in subsequent events (such as request reject messages).

    • traderReqId: An arbitrary unique identifier which will be used to refer to this subscription in subsequent events (such as market data messages).

Typechecking and Error Handling

The 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 remains connected to the MarketFactory server if it was already connected, but all incoming messages and events from the server are dropped.

When resumed, the adapter starts routing incoming messages and events from the server to the StreamBase application again.

Related Topics