- Index

< Previous |  | Next >

# Morningstar Quotes Feed Input Adapter

## Introduction

The TIBCO StreamBase® Adapter for Morningstar Quotes Feed allows a StreamBase application to receive market data from Morningstar servers. Both Interactive and broadcast feeds are supported. The types of data delivered depend on how the Morningstar adapter is configured, in combination with what services the Morningstar server has enabled for your account.

## Properties

This section describes the properties you can set for this adapter, using the various tabs of the Properties view for the adapter's icon in StreamBase Studio.

### 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 properties on the Adapter Properties tab in the Properties view for the Morningstar Quotes Feed adapter.

Property | Description
--- | ---
Morningstar Server Name and Port Number | A semicolon-separated list of Morningstar Quotes Feed servers in the form `ServerName:PortNumber`
Connect on startup | Determines if a connection to the Morningstar server should be made as soon at the adapter starts.
Reconnect Interval | When a connection fails, the number of seconds to wait before trying to reconnect.
User Name | Your Morningstar account user name.
Password | Your Morningstar account password.
Feed Type | Select which type of Quotes Feed you wish to use. Must be either `Interactive` or `Broadcast`.
Use Compression | Request the Morningstar server to use data compression.
Field Dictionary | Optionally supply a path to a customized dictionary file that maps field IDs to field names. See below for description of this dictionary.
Enable Admin Messages | Select if you wish to receive Admin Messages. An output port is created for this message type.
Enable Trade Messages | Select if you wish to receive Trade Messages. An output port is created for this message type.
Enable Quote Messages | Select if you wish to receive Quote Messages. An output port is created for this message type.
Enable Recap Messages | Select if you wish to receive Recap Messages. An output port is created for this message type.
Enable Close Messages | Select if you wish to receive Close Messages. An output port is created for this message type.
Enable Static Messages | Select if you wish to receive Static Messages. An output port is created for this message type.
Enable News Messages | Select if you wish to receive News Messages. An output port is created for this message type.
Enable Chart Messages | Select if you wish to receive Chart Messages. An output port is created for this message type.
Log Level | 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 is used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE.
Skip Missing Fields | If selected, do not emit a warning for fields present in an incoming message with no corresponding StreamBase field.

### Edit Schemas Tab

Use the Edit Schemas tab to specify the schema for message types selected on the Adapters Properties tab. See Using the Adapter section below for information on field names to use.

For general instructions on using the Edit Schemas tab, see Defining Input Streams.

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

## Using the Adapter in a StreamBase Application

The StreamBase Morningstar Quotes Feed adapter can be configured to emit eight different data message types. The Morningstar account configuration determines which data message types, markets, and security types are available from the Morningstar server.

As with other StreamBase adapters and operators, you can optionally enable an Error Output Port, as described in Using Error Ports and Error Streams.

### Morningstar Quotes Feed Data Messages

All Morningstar data messages are composed of a small header and a variable number of field ID-data type-value triplets. A Field Dictionary is used to map a Morningstar Field ID to a StreamBase field name.

A Morningstar data message header has four fields that are common across all data messages. These fields are:

- SecurityType

- ExchangeId

- MarketCenter

- Symbol

Unlike all other Morningstar fields, these field names are not configurable via the field dictionary.

For message types that are selected, Morningstar field IDs that appear in Morningstar messages and do not have a corresponding StreamBase field name defined cause a warning to be emitted by StreamBase Server. This warning can be disabled by selecting the Skip Missing Fields option.

Field names defined in a StreamBase message type schema that do not appear in a Morningstar message are set to null. Since individual Morningstar messages within a single message type can have a varying number of fields, it is not uncommon to have StreamBase tuples with a varying number of null fields.

### Mapping Morningstar Field IDs to StreamBase Schema Fields

All Morningstar data messages are composed of a variable number of field ID-data type-value triplets. Morningstar field IDs are integer values. An optionally configurable field dictionary is used to map a Morningstar field ID integer to a StreamBase field name. A default field dictionary is included with the StreamBase adapter and is used if a custom dictionary is not specified. The default Morningstar field ID to StreamBase field name mapping can be seen in the file `MSFieldDictionary.csv` delivered as part of the Morningstar sample application.

Some field IDs are common across many message types, while other field IDs are unique to individual message types, security types, and so on. You must consult Morningstar documentation to determine the field IDs provided by various message types, and what fields are of particular interest.

An individual field ID always corresponds to a particular StreamBase field name. As Morningstar messages are parsed, their field IDs are looked up in the field ID dictionary to yield a StreamBase field name. The resulting StreamBase field name is used to set the field in the output tuple with the value parsed out of the Morningstar Field ID-value pair.

Morningstar value data types are represented by one of four StreamBase data types:

StreamBase Data Type | Morningstar Data Type
--- | ---
Integer | Byte, Short, Int, Long (Morningstar Long is 32 bits)
Long | All above Integer types, plus Unsigned Int, Unsigned Long (Morningstar Long is 32 bits)
Double | Proprietary Fractional format, double
String | char, string, binary, Julian Date. In addition, any Morningstar data type can be coerced into a string.

Trying to set a Morningstar data type to an incompatible StreamBase data type results in a warning message at runtime.

### Morningstar Quotes Feed Adapter Input Port

The Morningstar Quote Feed adapter has one command input port. The schema for this port has the following fields:

- command (string). Specifies the command to send to the Quotes Server. The supported commands are:

  - Connect — Connect to the Morningstar servers. Only valid if currently disconnected.

  - Disconnect — Disconnect from the Morningstar servers. Only valid if currently connected.

  - SendCommand — only valid for the Interactive Feed type.

  - SetFlag

- parameter (string). Any parameters needed by the command sent.

  - For the SendCommand command, this parameter can be any valid Quote Server command. For example:

        "symbolrequest /qsymbol=EURUSDCOMP.fx /actreal"

  - For the SetFlag command, this parameter specifies the message or field to be enabled or disabled. For SetFlag, the parameter strings must be one of:

    Market
    News
    Message
    Security
    Field

- Parameter for the SetFlag command, ignored for SendCommand (int). This parameter is the field ID that is to be set.

- Parameter for the SetFlag command, ignored for SendCommand (int). This parameter is either `0` to disable or `1` to enable.

### Morningstar Quotes Feed Adapter Output Ports

The StreamBase Morningstar Quotes Feed adapter has one output status port, plus a configurable number of data message ports. The status port has the following fields:

Field | Data Type | Description
--- | --- | ---
Type | string | The basic state reported, always one of the following:
CONNECTION | ADMIN
COMMAND | ERROR
Object | string | The name on the EventFlow canvas of the adapter reporting the status.
Action | string | The action that occurred, one of the following:
CONNECTED | CONNECTING
DISCONNECTED | UNAVAILABLE
INITIALIZING | WARNING
RESUMING | WAITING_CONNECT_REQUEST
Message | string | A human-readable string that provides additional context for the status message.
Time | timestamp | The time the action occurred.

The Morningstar Quotes Feed adapter has an optional Admin output port plus one or more data message output ports. The schema for these ports are defined in the Edit Schemas tab in the adapter's Properties view. The field names you specify must be present in the field dictionary currently being used.

The seven data message ports have four fields derived from the data header, and have fixed field names. These are: Symbol, SecurityType, ExchangeId, MarketCenter.

### Adding the Adapter to an EventFlow Application

Add an instance of the adapter to a new StreamBase EventFlow application as follows:

1. In StreamBase Studio, create a project, including an empty StreamBase EventFlow Application file to host the adapter.

2. From the Operators and Adapters drawer of the Palette view, drag the Output Adapter icon to the palette. This opens the Insert Output Adapter dialog.

3. In the search field, type a string such as `morning` to narrow the list of adapters. When found, select the icon for the Morningstar Feed adapter, then click OK.

4. Double-click the adapter icon and select the Adapter Properties tab in the Properties view. You must provide the Morningstar host name, port number, and your account name and password. You must also select which message types you are interested in.

5. Select the Edit Schemas tab. For each message type selected, you must provide a schema for the output port. If you are using the default field dictionary, refer to sample file `MSFieldDictionary.csv` in the Morningstar sample for the list of acceptable field names.

## Typechecking and Error Handling

The StreamBase Morningstar Quotes Feed adapter uses typecheck messages to help you configure the adapter.

The adapter generates warning messages at runtime under various conditions, including:

- A field in the output port schema is not present in the field dictionary.

- The data type of a Morningstar field can not be coerced into the corresponding StreamBase field data type.

## Suspend and Resume Behavior

When suspended, the adapter continues to receive and process Morningstar messages, but no longer emits tuples on its primary output port.

When resumed, the adapter once again starts emitting tuples on its primary output port.

## Related Topics

- Using Embedded Adapters