Bloomberg integration

The OpenFin Bloomberg integration provides a client API to let you connect OpenFin Container apps to a local instance of the Bloomberg Terminal.

How it works

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.

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 the Terminal reacts to different contexts:

  • 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

  • Node with npm or yarn

  • OpenFin: Version 20.91.62.4 or later of the OpenFin runtime.

  • Bloomberg Terminal configuration:

    • Register app origin. Must include a Fully Qualified Domain Name (FQDN), and cannot include localhost.

    • Enable function mnemonics. These are required for Interop functionality. The default OpenFin integration specifies the mnemonics BIO, DES, GP, Q, SEAR for the Bloomberg Terminal Connect API. Contact the Bloomberg App Portal team for help

Install

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

With npm:

npm i @openfin/bloomberg

With yarn:

yarn add @openfin/bloomberg

Default integration configuration

The default configuration always targets Terminal panel 1. It specifies the following mapped Terminal functions:

Intent name

Content type

Terminal function (mnemonic)

(none)

fdc3.instrument

DES

(none)

fdc3.contact

BIO

(none)

fdc3.organization

SEAR

ViewChart

fdc3.instrument

GP

ViewContact

fdc3.contact

BIO

ViewInstrument

fdc3.instrument

DES

ViewQuote

fdc3.instrument

Q

Usage

  1. Check that Terminal is ready. This should be your first call, to make sure 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;
    }
    
  2. Connect to Terminal, in this case with the default configuration:

    import { connect } from '@openfin/bloomberg';
    
    const bbgConnection = await connect();
    
  3. Customize Terminal actions for intents/contexts:

    import * as fdc3 from '@finos/fdc3';
    import {
    BloombergConnection,
    BloombergConnectionConfig,
    BloombergGroup,
    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.ContextTypes.Instrument, 'Group-A');
    
    // When ViewChart intent is raised containing instrument context,
    // show intraday chart for security in Terminal panel 2
    const viewChartActions: ContextActionMap = new Map();
    viewChartActions.set('fdc3.instrument', { mnemonic: 'GIP', target: 2 } as BloombergTerminalCommand);
    intents.set(fdc3.Intents.ViewChart, viewChartActions);
    
    // Create connection
    const bbgConnection = await connect(config);
    

    Any custom configuration is merged with the default. In case of conflicts, the custom configuration takes precedence.

  4. 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.ContextTypes.Organization, undefined);
    
    // Disable default behavior for when ViewContact intent is raised
    intents.set(fdc3.Intents.ViewContact, undefined);
    
  5. Call the disconnect() function to disable the connection:

    await bbgConnection.disconnect();
    

More configuration settings

If you are using 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 = '*';

You can provide callbacks to hook into certain connection events:

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

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

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.

Function examples

The functions demonstrated in the following code example are useful when working with the Bloomberg Integration:

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');

Did this page help you?