The TIBCO StreamBase® Adapter for Bloomberg Server API is an embedded adapter that can connect to a Bloomberg Server API process to subscribe to and get data from the process.
The adapter can be configured to connect to a Bloomberg service that supports subscriptions to receive subscription data and send it downstream. The service name and connection details can be configured in the adapter properties.
The adapter can be configured to connect to the server two ways:
-
It can connect at startup time.
-
It can connect to the server only when it receives a
connect
command through its input port.
If the adapter is configured to connect on startup, it attempts to establish server
connection when it starts up. If the server is down or if the adapter cannot
establish a connection for other reasons, it keeps retrying until it succeeds. Once
the connection is established, it proceeds to connect to the required services and
subscribe for data, if configured to do so. If the server goes down or if the
adapter otherwise loses the connection afterwards, it keeps trying to reestablish
the connection until it succeeds. A connect
command
does not have any effect at this time. A disconnect
command disconnects from the server, if it is currently connected, and does not
attempt to reconnect until it receives a connect
command. If the adapter receives a disconnect
command
when it is not connected to the server, it stops trying to establish a connection,
until it receives a further connect
command.
If the adapter is not configured to connect on startup, it waits to receive a
connect
command on its input port before it attempts
to establish connection with the server. Once it receives the connect
command, it keeps trying to establish the connection until
it succeeds or until it receives a disconnect
command.
The adapter has one input port and five output ports with two being optional, as shown in the diagram below.
The Commands input port is used to send commands to the adapter to connect to or disconnect from the server, subscribe or unsubscribe for data, or to request metadata, including information about Bloomberg data fields.
The Command input port has the following schema:
-
Command, string
-
SubscriptionParameters, tuple
-
Topic, string
-
Options, string
-
-
FieldParameters, tuple
-
Id, string
-
SearchSpec, string
-
ProductType, string
-
FieldType, string
-
-
ReferenceDataParameters, tuple
-
Securities, list(string)
-
-
MarketListSnapshotParameters, tuple
-
Topic, string
-
SubscriptionParameters contain fields that you use when subscribing or unsubscribing for data. FieldParameters contain fields that you use when requesting information about Bloomberg data fields.
Supported commands are:
-
Connect: Connects to the Bloomberg server. This command does not take any additional parameters.
-
Disconnect: Disconnects from the Bloomberg server. This command does not take any additional parameters.
-
Subscribe: Subscribes to the specified topic. A
Topic
value must be specified with the Subscribe command, and must conform to a topic as specified in Bloomberg API Developer's Guide. If anOptions
value is specified, it is used to override any default options specified in the adapter properties tab. If the adapter is already subscribed to the specified topic, a resubscribe is issued to avoid losing any updates. -
Unsubscribe: Unsubscribes from the specified topic.
Topic
value must be specified with the Unsubscribe command. -
ListSubscriptions (or ListSub): Lists the currently active subscriptions. This command does not take any additional parameters. The subscriptions are output through the
Metadata
output port. -
FieldInfo: This command can be used to get more information about Bloomberg data fields. Field information is output through the
Metadata
output port.Id
orSearchSpec
must be specified when using this command. Multiple values may be specified forId
, separated by commas. If anId
value is specified, a list of Bloomberg fields whose mnemonic or alphanumeric IDs exactly match the specified values is output. IfSearchSpec
is specified, a list of fields matching the SearchSpec value is output. The value is used to search across mnemonics, descriptions, and definitions. The field search may be further narrowed by specifyingProductType
and/orFieldType
. For more information, please refer to API Field Information Service section of Bloomberg's BLPAPI Developer's Guide. -
ReferenceData: This command may be used to request reference data. Field information will be output through the
Reference data
output port if enabled. One or more Securities must be supplied as part of this request. -
MarketListSnapshot: This command may be used to request market list snapshot data. Field information will be output through the
Market List Snapshot
output port if enabled. A single Topic must be supplied with this request.
The adapter has three output ports and two optional ports:
-
Status: Output is produced on this port to notify of changes in connection and subscription status and to indicate error in input commands. Status output port has the following schema:
-
type, string: Contains one of the following values that describes the type of event that occurred:
-
Session
-
Service
-
Subscription
-
User Input
-
Suspend/Resume
-
-
object, string: the object associated with the event, such are connection destination or subscription string.
-
action, string: the action associated with the event, such as Connected, Disconnected or Subscription Failed.
-
message, string: a human readable message string.
-
-
Metadata: This output port is used to emit output for ListSubscriptions and FieldInfo commands. This output port has the following schema:
-
Subscriptions, tuple
-
SubscriptionString, string
-
CorrelationID, string
-
-
FieldsResult, tuple
-
FinalResult, boolean
-
FieldsResult
-
Id, string
-
Mnemonic, string
-
DataType, string
-
Description, string
-
Category, string
-
FieldError, string
-
-
Subscriptions field in the schema is used to list the active subscriptions. FieldsResult field is used to list the Bloomberg fields that the user searched for. The boolean
FinalResult
is used to indicate if this is the final set of results of the fields search request. -
-
MarketData: This output port emits the data that the user subscribed for. The schema of this port will contain SubscriptionString and CorrelationID fields, in addition to the fields specified by the user using Edit Schema tab.
-
ReferenceData (Optional): This output port emits the data for reference data requests. The schema of this port will contain a Security field, in addition to the fields specified by the user using Edit Schema the tab under the Reference Data section.
-
MarketListSnapshotData (Optional): This output port emits the data for market list snapshot requests. The schema of this port follows the Bloomberg field list for market list snapshot data.
This section describes the properties you can set for this adapter, using the tabs of the Properties view in StreamBase Studio.
The tables in this section have a Property column that shows each property name as found in the one or more adapter properties tabs of the Properties view.
Use the StreamSQL names of the adapter's properties when using this adapter in a StreamSQL program with the APPLY JAVA statement.
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.
Property | Data Type | Default | Description | StreamSQL Property |
---|---|---|---|---|
Connect on Startup | check box | Selected |
Leave this selected if you would like the adapter to connect to the
Bloomberg server when the adapter starts up. Clear this if the adapter
should connect to the Bloomberg server only on receiving a |
ConnectOnStartup |
Enable command input port | check box | Selected |
Clear this if the input port will not be used at all. In this case, all
subscriptions must be made using |
EnableCmdInput |
Enable reference data output port | check box | Cleared |
Select this if the adapter should enable reference data requests. |
EnableReferenceOutputPort |
Enable market list snapshot output port | check box | Cleared |
Select this if the adapter should enable market list snapshot data requests. |
EnableMarketListSnapshotOutputPort |
Bloomberg Server Host | string | None |
The host name of the Bloomberg server. |
ServerHost |
Bloomberg Server Port | int | None |
The port number of the Bloomberg server. |
ServerPort |
UUID | string | None |
The universally unique ID used to log into the Bloomberg service. To
determine this value, log into your Bloomberg terminal, type |
uuid |
Service Name | string | None |
The name of the service that the adapter should use to subscribe for data. |
ServiceName |
Default Topic Prefix | string | None |
The default topic prefix that should be used in subscriptions when no prefix is specified by user while subscribing. |
DefaultTopicPrefix |
Default Subscription Options | string | None |
The default options to be used in subscriptions when no options are specified by user while subscribing. |
DefaultOptions |
Log Missing Output Fields | check box | Cleared |
If the subscription data received from Bloomberg contains fields other
than the ones specified by the user using |
LogMissingOutputFields |
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. | LogLevel |
Property | Data Type | Default | Description | StreamSQL Property |
---|---|---|---|---|
Initial Subscriptions | map of (string, string) | None | Specify the subscriptions to process at start up time. Zero or more subscriptions can be specified. Topic must be specified. Options is optional. | InitialSubscriptions |
Property | Data Type | Default | Description | StreamSQL Property |
---|---|---|---|---|
Subscription Output Schema | schema | None | The fields that should be included in the output produced by the adapter must be specified here. These fields are used by the adapter as the fields of interest at subscription time. | OutputSchema |
Reference Data Output Schema | schema | None | The fields that should be included in the reference data request. These fields are used by the adapter as the fields of interest at the time a reference data command is received. | OutputSchema |
The StreamBase field types specified for the fields must be compatible with the Bloomberg field type. If a Bloomberg field cannot be converted to the specified type, a warning message is logged at startup. However, the adapter still tries to process the subscriptions to the best it can. See the table below for the valid conversions. Bloomberg types that are not listed in the table are not allowed.
Bloomberg Type | Valid StreamBase Types |
---|---|
BOOL | boolean, int, long, double, string |
CHAR | int, long, double, string |
DATE | timestamp, string |
DATETIME | timestamp, string |
FLOAT32 | double, string |
FLOAT64 | double, string |
INT32 | int, long, double, string |
INT64 | long, string |
STRING | string |
TIME | timestamp, string |
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.
On suspend, the adapter stops processing any subscription data that it receives from the Bloomberg server. However, the events stay in the queue, so that they can be output by the adapter when it resumes.
On resumption, the adapter continues to process the events in its event queue.