Bloomberg integration

Integrate your OpenFin solution with the Bloomberg Terminal.

The OpenFin integration API enables interoperability between your OpenFin apps and the Bloomberg Terminal.
It takes full advantage of the Interop API’s use of context groups and intents.
Communication is enabled over the Bloomberg Terminal Connect API.

📘

Note

The Bloomberg Terminal Connect API is subject to Bloomberg’s licensing terms.
Check with your Bloomberg account manager for more information.

When a connection is established between your OpenFin app and the Bloomberg Terminal, the Terminal reacts to Interop events and shares the appropriate context.
The reaction depends on the type of context.
You can configure contexts and intents, but we provide a default configuration for the most common contexts and intents.

Some ways that the Terminal reacts to different contexts include the following:

  • If an instrument context for the ticker "MSFT" is shared, Launchpad group A sets the current security to MSFT US Equity.

  • If a View Chart intent is raised containing an instrument context for the ticker AAPL, Terminal panel 1 sets the current security to AAPL US Equity and switches the current function to GP.

  • If a View Contact intent is raised containing a contact context for the name "Elon Musk", Terminal panel 2 switches the current function to BIO and provides "Elon Musk" as a search parameter.

See also the Interop documentation.

Prerequisites

  • OpenFin

    • Minimum recommended runtime version 20.91.62.4
  • Bloomberg Terminal running locally and user logged in

Installation

Add the @openfin/bloomberg NPM package as a dependency for your app:

npm install @openfin/bloomberg

Configuration

Register app origin

Your app's origin must be registered with Bloomberg before Bloomberg's Terminal Connect API can accept a connection from your OpenFin app to the Terminal.
Contact the Bloomberg App Portal team to register your app's origin, which must be a fully qualified domain name (FQDN), and cannot be localhost.

Enable required Terminal functions

By default, OpenFin's Bloomberg integration requires that the Terminal functions BIO, Q and SEAR be enabled for use by the Terminal Connect API.
Contact the Bloomberg App Portal team to have these functions enabled.

Usage

Check that Terminal is ready

Before using the other API functions, first make sure the Terminal is running and the user is logged in:

import { isBloombergTerminalReady } from '@openfin/bloomberg';

// Continue only if the Terminal is running and the user is logged in
const terminalReady = await isBloombergTerminalReady();
if (!terminalReady) {
  return;
}

Connect to the Terminal

To connect to the Terminal using the default configuration:

import { connect } from '@openfin/bloomberg';

const bbgConnection = await connect();

The default configuration always directs interop actions to Terminal panel 1 and maps context types and intents to Terminal functions as follows:

Intent nameContent typeTerminal function (mnemonic)
(none)fdc3.instrumentDES
(none)fdc3.contactBIO
(none)fdc3.organizationSEAR
ViewChartfdc3.instrumentGP
ViewContactfdc3.contactBIO
ViewInstrumentfdc3.instrumentDES
ViewQuotefdc3.instrumentQ

Customize the connection

You can override this default configuration by providing your own mapping specifying which context types and intents are mapped to other Terminal functions or even Launchpad groups:

import {
  BloombergConnectionConfig,
  BloombergTerminalCommand,
  connect,
  ContextActionMap,
  IntentActionMap,
} from '@openfin/bloomberg';

// Create custom config
const contexts: ContextActionMap = new Map();
const intents: IntentActionMap = new Map();
const config: BloombergConnectionConfig = {
  actions: {
    contexts,
    intents,
  },
};

// When instrument context is broadcast, update security for Launchpad Group A
contexts.set('fdc3.instrument', 'Group-A');

// When ViewChart intent is raised containing instrument context, show intra-day chart for security in Terminal panel 2
const viewChartActions: ContextActionMap = new Map();
viewChartActions.set('fdc3.instrument', { mnemonic: 'GIP', target: 2 } as BloombergTerminalCommand);
intents.set('ViewChart', viewChartActions);

// Create connection
const bbgConnection = await connect(config);

📘

Note

Enable functions for execution with Terminal Connect.

By default , Bloomberg's Terminal Connect API supports the execution of a restricted set of Terminal functions:

IB, MSG, MSGE, ALLQ, BVAL, BXT, CN, DES, GIP, GP, RCHG, SXT, TOP.

To execute any other functions, you must first contact the Bloomberg App Portal team and request that those functions be enabled for execution by Terminal Connect for your app. Once enabled, you can specify those Terminal functions in your custom configuration.

Custom configurations are merged with the default configuration.
In case of conflicts, the custom configuration takes precedence.
You can also disable any default behavior as needed by setting the mapped action to undefined:

// Disable default behavior for when instrument context is shared
contexts.set('fdc3.organization', undefined);

// Disable default behavior for when ViewContact intent is raised
intents.set('ViewContact', undefined);

Handle connection events

You can provide callbacks to hook into certain connection events:

// Output message to console when context is changed
config.onContextChanged = (context) => console.log('Context changed', context);

// Output message to console if error occurs
config.onError = (error) => console.error(error);

Broadcast context directly from Launchpad groups

When using Bloomberg Launchpad groups, you can configure the connection to broadcast context whenever the security of a group is changed:

// Broadcast context when the security for Launchpad Group-A is changed
config.group = 'Group-A';

// Alternatively, broadcast context whenever any group security is changed
config.group = '*';

Disconnect from the Terminal

When finished, be sure to terminate the connection:

await bbgConnection.disconnect();

Context type requirements

The only context types currently supported are:

  • fdc3.contact

  • fdc3.instrument

  • fdc3.organization

Instrument contexts must contain either a BBG or ticker id property.

  • BBG takes precedence and should specify the full Bloomberg security string, for example "TSLA US Equity", "BBG0013HFH84 Curncy", "25468PBW5 Corp".

  • If no BBG id is present, ticker is used and is assumed to be a US equity, for example "TSLA" is interpreted as "TSLA US Equity".

Contact and Organization contexts must specify the name property value.

Useful functions

The API provides a number of additional functions that come in useful when working with Bloomberg:

import {
  getInstrumentCodeFromSecurity,
  getSecurityStringFromParts,
  isCusip,
  isEquity,
  isFigi,
  isIsin,
} from '@openfin/bloomberg';

// Returns '25468PBW5'
getInstrumentCodeFromSecurity('25468PBW5 Corp');

// Returns 'TSLA US Equity'
getSecurityStringFromParts('TSLA', 'US');

// Returns 'GBPUSD Curncy'
getSecurityStringFromParts('GBPUSD', null, 'Curncy');

// Returns true
isCusip('25468PBW5');

// Returns false
isCusip('BBG00005J747');

// Returns true
isEquity('TSLA US Equity');

// Returns false
isEquity('GBPUSD Curncy');

// Returns true
isFigi('BBG00005J747');

// Returns false
isFigi('US25468PBW59');

// Returns true
isIsin('US25468PBW59');

// Returns false
isIsin('BBG00005J747');