Getting Started - Bloomberg

Bloomberg configuration

The following steps are necessary to include the Bloomberg Service with your OpenFin Application.

Manifest declaration

To ensure the service is running, you must declare it in your application config.

"services": [
  {
     "name": "bloomberg",
     "manifestUrl": "https://openfin.github.io/bloomberg-service/provider/app.json"
  }
]

Bloomberg service usage

Unlike other services which are available as an NPM module, currently the Bloomberg Service is available as ES6 Modules.

BLP API access

Import the module as follows:

<script type="module">
  import blpApi from "https://openfin.github.io/client/bloomberg-blpapi-service.js";
  
  // blpApi code goes here...
</script>

Terminal Connect access

Import the module as follows:

<script type="module">
  import terminalApi from "https://openfin.github.io/client/bloomberg-terminalapi-service.js";
  
  // terminalApi code goes here...
</script>

Connect to a Bloomberg session

let blpClient = await blpApi.getClient();
let sessionStarted = await blpClient.startSession();

Request data

let blpClient = await blpApi.getClient();
let response = await blpClient.serviceRequest('//blp/refdata', 'ReferenceDataRequest', {
  securities: ['IBM US Equity', 'VOD LN Equity'],
  fields: ['PX_LAST', 'DS002', 'EQY_WEIGHTED_AVG_PX'],
  overrides: [
      { fieldId: 'VWAP_START_TIME', value: '9:30' },
      { fieldId: 'VWAP_END_TIME', value: '11:30' }
  ]
});

Subscribe to data

let blpClient = await blpApi.getClient();
let correlationIDs = await blpClient.subscribe([
  security: 'IBM US Equity',
  fields: ['LAST_PRICE', 'VOLUME']
]);

blpClient.addEventListener('market-data', e => {
  if(e.data.correlationID === correlationIDs[0]) {
    // do something...
  }
});

Run locally

Clone this repository and execute the following commands:

npm install
npm start

This launches the project in debug mode, which provides onscreen debugging and log file generation for additional debugging and troubleshooting support.

In order to use the Bloomberg Terminal emulator instead of connecting to an actual terminal, pass the addition argument:

npm start -- mock

Connecting to a Bloomberg session using API calls

let blpClient = await blpApi.getClient();
let sessionStarted = await blpClient.startSession();
Requesting Data

let blpClient = await blpApi.getClient();
let response = await blpClient.serviceRequest('//blp/refdata', 'ReferenceDataRequest', {
  securities: ['IBM US Equity', 'VOD LN Equity'],
  fields: ['PX_LAST', 'DS002', 'EQY_WEIGHTED_AVG_PX'],
  overrides: [
      { fieldId: 'VWAP_START_TIME', value: '9:30' },
      { fieldId: 'VWAP_END_TIME', value: '11:30' }
  ]
});
Subscribing to Market Data

let blpClient = await blpApi.getClient();
let correlationIDs = await blpClient.subscribe([
  security: 'IBM US Equity',
  fields: ['LAST_PRICE', 'VOLUME']
]);

blpClient.addEventListener('market-data', e => {
  if(e.data.correlationID === correlationIDs[0]) {
    // do something...
  }
});

❗️

Re-signing and Hosting Assets Locally

Required for TerminalConnect API


Did this page help you?