Bloomberg BPOD Subscribing Input Adapter

Introduction

The Bloomberg BPOD Subscribing Input Adapter allows a StreamBase application to receive market data messages from a Bloomberg server. The adapter is embedded in the StreamBase application and has five or more output ports: one that emits status tuples, a second that emits metadata tuples (dictionary information, active subscription status), and the remaining ports that emit admin and application Bloomberg messages.

The adapter processes one or more subscription strings during startup and asynchronously and continuously receives and converts incoming Bloomberg messages into StreamBase tuples, which it sends downstream. Additional subscriptions can be requested through a command port after start-up.

The adapter supports all StreamBase data types, including tuples and lists, though lists may not contain elements of type list. The schema of the admin and application message output ports is set through the Admin and Application Message Schema tabs of the adapter's Properties view.

The adapter is configured through several properties set in the adapter's Properties view in StreamBase Studio. The properties include the name of the Bloomberg B-Pipe On-Demand configuration file, check boxes that determines whether the adapter connects to the Bloomberg server at start-up and whether the adapter reports unprocessed Bloomberg message fields.

The adapter is supported on 64-bit Linux and 32-bit Windows versions of StreamBase. On 64-bit Windows, you can run the adapter and its sample by selecting the Use 32-bit SteamBase Server check box on the Main tab of the Run Configurations dialog in StreamBase Studio.

Environment Variable Settings Required on Linux

The following environment variables must be set to run this adapter on Linux:

  • LD_PRELOAD — should include libbpod.so.

  • LD_LIBRARY_PATH — should include the directory containing libbpod.so (typically /opt/streambase/lib64/).

The following shows a command line to start the Bloomberg BPOD sample on Linux. This is a single command, shown on two lines for publication clarity.

LD_PRELOAD=libbpod.so:$LD_PRELOAD 
  LD_LIBRARY_PATH=/opt/streambase/lib64:$LD_LIBRARY_PATH sbd bloomberg-bpod.sbapp

Adapter Properties

Property Description
BPOD Configuration File The name of the Bloomberg B-Pipe On-Demand configuration file.
Connect on Startup If enabled, the adapter connects to the Bloomberg sever at start-up. Otherwise, a Connect tuple can be queued to the adapter's command port to force the adapter to connect to the server. A Disconnect tuple can be used to disconnect from the Bloomberg server. Due to a limitation in the Bloomberg BPOD API, the adapter cannot reconnect to the Bloomberg server once disconnected.
Report Missing Admin Fields If enabled, the adapter logs a warning once per field name when a received admin message contains a field for which there is no corresponding StreamBase field in the admin message output port schema.
Report Missing Application Fields If enabled, the adapter logs a warning once per field name when a received application message contains a field for which there is no corresponding StreamBase field in the application message output port schema.
Log Level Controls the level of verbosity the adapter uses to issue informational traces to the console. This setting is independent of the containing application's overall log level. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL.
Initial Subscriptions(s) Zero or more subscription strings to process at startup.
BPOD-to-StreamBase Field Mappings Maps Bloomberg BPOD field names to StreamBase field names. By default, StreamBase field names are derived from BPOD field names by removing all embedded dots. For example, BPOD field MD.Security.ID.BSID maps to StreamBase field MDSecurityIDBSID. To use BSID as the StreamBase field name, enter MD.Security.ID.BSID in the Key column and BSID in the Value column.
Admin Message Schema Specifies the schema of the AdminMessages output port.
Application Message Types 1-10 Specifies a comma-delimited list of application message types emitted on the corresponding application message output port. Up to 10 application message output ports can be enabled by specifying one or more message types to emit on that port. A specific message type can be specified for only one application output port. Use * to specify all unspecified application message types. Application message ports must be enabled consecutively starting at 1 (the fifth adapter output port).
Application Message Schema 1-10 Species the schema to be used for the corresponding application message output port. Application message port schemas must be specified consecutively starting at 1 (the fifth adapter output port).
Log Admin Messages If enabled, the adapter logs raw Bloomberg admin messages as they are received.
Admin Message Filter Type Determines whether the Admin Message Filter specifies the set of message to include or exclude from logging.
Admin Message Filter A comma-separated list of admin message types to include or exclude. An empty list means all admin message types. For example: Admin.Client.Connected.Message, Admin.Client.Provisioned.Message
Log Application Messages If enabled, the adapter logs raw Bloomberg application messages as they are received.
Application Message Filter Type Determines whether the Application Message Filter specifies the set of message to include or exclude from logging.
Application Message Filter A comma-separated list of application message types to include or exclude. An empty list means all application message types. For example, Summary.Message, Reference.Security.Index.Message

Adapter Ports

As shown in the diagram below (depicting the adapter's sample application), the Bloomberg BPOD adapter has one input port and five or more output ports to communicate with the surrounding application.

The Bloomberg BPOD Subscribing Input Adapter's ports are used as follows:

  • Command: This input port receives tuples to connect to and disconnect from the Bloomberg server, to processing subscribe and unsubscribe requests after the adapter has started, and top request metadata, including the fields and messages in the Bloomberg data dictionary and the list of active subscriptions. The Command port has the following schema:

    • Command, string: Contains the command to execute.

      • Connect — connects to the Bloomberg server.

        Related fields: none

      • Disconnect — disconnects from the Bloomberg server.

        Related fields: none

      • Subscribe — Subscribes to the instrument specified in the SubscriptionString field.

        Related fields: SubscriptionString

      • Unsubscribe — Unsubscribes from the instrument specified in the SubscriptionString field.

        Related fields: SubscriptionString

      • ListSubscriptions — emits a tuple on the metadata port containing the set of active subscriptions.

        Related fields:none

      • ListSub — alias for ListSubscriptions.

        Related fields:none

      • ReadDictionary — emits a tuple on the metadata port containing the set of fields and messages in the data dictionary.

        Related fields:none

      • ReadDict — alias for ReadDictionary.

        Related fields:none

  • Status: This output port emits status, information, and error tuples. The Status port has the following schema:

    • type, string: Contains one of the following values describing the type of event that occurred:

      • Connection

      • Client SDK State

      • Data Model

      • Entitlement

      • Provision

      • Session

      • Subscription

      • Subscription Info

      • Subscription State

      • Suspend/Resume

      • User Input

    • object, string: the name of the object associated with the event, such as the connection destination or subscription string..

    • action, string: the action associated with the event, such as Connected, Disconnected, or subscription Acknowledged or Not Acknowledged.

    • message, string: A human-readable message string

  • Admin Messages: The adapter emits a tuple on this output port when it receives a Bloomberg admin message. The port's schema is derived from the Admin Message Schema propery. Fields in this schema can be of a StreamBase data type, including lists and (nested) tuples to accommodate hierarchy in Bloomberg messages. The adapter adds the following metadata fields to the user-supplied schema:

    • MessageType, string

    • SubscriptionString, string

    • CorrelationID, string

    • DuplicateCorrelationID, string

  • Application Messages 1-10: The adapter emits a tuple on one of up to 10 application message output ports when it receives a Bloomberg application message. The specific port is determined by the 10 Application Message Types properties, which list the application messages to emit on each port. An application message is discarded if its type is not explicitly specified, or implicitly specified with a wildcard (*), in any Application Message Types properties. The application message ports' schemas are derived from the corresponding Application Message Schema properties.

    For both the admin and application message ports, Bloomberg fields are mapped by default to tuple fields by case-sensitive names with the dots in the Bloomberg field names removed. The default mapping can be overridden on a per-field basis by adding entries to the Field Mappings property. List fields may contain all StreamBase types except list types. List fields are used to capture the contends of Bloomberg arrays, which are fields containing multiple values. Fields not present in a Bloomberg message are sent as null in the tuple. Fields present in a Bloomberg message but not in the schema of the corresponding port schema result in a warning one time per field name if the Report Missing Admin Fields property is enabled.

    In processing incoming Bloomberg messages, the adapter converts BPOD data types to StreamBase data types. Not all possible conversions are valid. When an attempt to perform an invalid conversion occurs, a warning is displayed, a status tuple is emitted, and the corresponding tuple field is set to null. The following table shows the set of valid conversions.

    BPOD Type Valid StreamBase Types
    BYTEARRAY blob, list<string>, string
    CHAR string, list<string>
    CHOICE string, list<string>
    COMPOSITE tuple, list<tuple>
    DATE timestamp, list<timestamp>, string
    DECIMAL tuple, list<tuple>, string
    FLOAT64 double, list<double>, string
    INT32 int, list<int>, long, double, string
    INT64 long, list<long>, long, double, string
    STRING string, list<string>
    TIME timestamp, list<timestamp>, string
    TIMESTAMP timestamp, list<timestamp>, string

Using the Adapter in a StreamBase Application

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

  1. In StreamBase Studio, create a project, and create an EventFlow application file to host the adapter.

  2. Drag an instance of the Bloomberg BPOD Subscribing Input Adapter from the Operators and Adapter drawer in the Palette view to the canvas.

  3. Connect an input stream to the adapter's input port and configure the stream's schema with Command (string) and SubscriptionString (string) fields.

  4. Set the name of the BPOD Configuration File.

  5. Configure the schema of the admin message port.

  6. Specify the application messages to be emitted on each application messages output port and configure their schemas.

  7. Connect Output streams to the adapter's output ports.

Typechecking and Error Handling

The Bloomberg BPOD Subscribing Input adapter uses typecheck messages to help you configure the adapter in your StreamBase application. In particular, the adapter generates typecheck messages when the schema of the command input port does not match the schema expected by the adapter, a duplicate subscription string is present in the Initial Subscriptions property, a Field Mappings entry refers to a non-existent admin or application message port field, an specific application message type is present in more than one Application Message Types properties, or a duplicate value appears in one or more of the Application Message Types properties.

The adapter emits tuples on status port during runtime under various conditions, including:

  • A connection is established to the Bloomberg server.

  • An entitlement or provision admin message is received.

  • The Bloomberg data dictionary is processed.

  • An admin message containing the data model version is received.

  • A subscription request is submitted, resolved, ACKed, or NAKed, or the state of a subscription changes.

  • A command tuple is rejected because it contains an invalid command or subscription string.

  • The adapter is suspended or resumed.

Suspend and Resume Behavior

When suspended, the Bloomberg BPOD Subscribing Input Adapter stops emitting tuples on its output ports.

When resumed, the adapter begins emitting tuples on its output ports once again.