Skip to main content

Bloomberg

Overview

The Bloomberg Market Data Feed (B-PIPE) offers retrieval of real-time/delayed streaming market data and static reference market data for securities through subscription and request/response mechanisms. Using the available Market Data protocols or APIs you can easily acquire market data provided by Bloomberg in order to show it, use it or redistribute it throughout your apps.

Creating Requests

Streaming Data Subscription Request

To create a Bloomberg Market Data subscription, use the "T42.MDFApi.CreateSubscriptionRequest" method. It will create a session (or reuse a named one via the sessionName setting), open the specified service, and create a subscription request with the specified settings.

The "T42.MDFApi.CreateSubscriptionRequest" method accepts as an argument an object with the following properties:

Property Type Description
callbackMethod string Required. The name of an Interop method to which the MDF Bridge will push subscription data events.
requestCorrelationId string Required. A unique identifier for tracking the subscription lifecycle.
service string Required. The Bloomberg service to subscribe to (e.g., "//blp/mktdata").
settings object Required. An object containing session settings.
subscriptions object[] Required. An array of subscription objects describing the securities and fields to subscribe to.

The "settings" object has the following properties:

Property Type Description
sessionIdentityOptions object Identity and authentication options for the session.
sessionLifetime string Required. The lifetime of the session (e.g., "caller" or "persistent").
sessionName string Required. The name of the Bloomberg session to use or create.
sessionOptions object Session configuration options.

Each object in the "subscriptions" array has the following properties:

Property Type Description
fields string Required. A comma-separated string of field mnemonics (e.g., "LAST_PRICE,BID,ASK").
options string Required. A string of additional subscription options (can be empty).
security string Required. The security identifier (e.g., "VOD LN Equity").
subscriptionId string Required. A unique identifier for the individual subscription.

The "T42.MDFApi.CreateSubscriptionRequest" method returns a TerminalResult object with the following properties:

Property Type Description
correlationId string The request correlation ID.
message string An error message (if the operation failed).
success boolean Whether the operation completed successfully.

Example:

const invocationArgs = {
    requestCorrelationId: "sub-001",
    service: "//blp/mktdata",
    subscriptions: [
        {
            subscriptionId: "sub-001-VOD",
            security: "VOD LN Equity",
            fields: "LAST_PRICE,BID,ASK",
            options: ""
        }
    ],
    callbackMethod: "MyApp.OnMarketData",
    settings: {
        sessionName: "my-session",
        sessionLifetime: "caller"
    }
};

const result = await io.interop.invoke("T42.MDFApi.CreateSubscriptionRequest", invocationArgs);
const terminalResult = result.returned.Result;

if (terminalResult.success) {
    // Subscription created successfully.
};

Static Reference Data Request

To create a Bloomberg static reference data request, use the "T42.MDFApi.CreateRequest" method. It will create a session (or reuse a named one via the sessionName setting), open the specified service, and send the Bloomberg request. All returned data (including service and session status transitions) will be translated to io.Connect elements and pushed to the method specified by the callbackMethod argument.

The "T42.MDFApi.CreateRequest" method accepts as an argument an object with the following properties:

Property Type Description
callbackMethod string Required. The name of an Interop method to which the MDF Bridge will push response data events.
operation string Required. The Bloomberg request operation (e.g., "ReferenceDataRequest", "HistoricalDataRequest").
operationArgs object[] Required. An array of key-value objects representing the operation arguments (e.g., [{ securities: ["VOD LN Equity"] }, { fields: ["PX_LAST", "BID"] }]).
requestCorrelationId string Required. A unique identifier for tracking the request lifecycle.
service string Required. The Bloomberg service to use (e.g., "//blp/refdata").
settings object Required. An object containing session settings.

The "settings" object has the following properties:

Property Type Description
sessionIdentityOptions object Identity and authentication options for the session.
sessionLifetime string Required. The lifetime of the session (e.g., "caller" or "persistent").
sessionName string Required. The name of the Bloomberg session to use or create.
sessionOptions object Session configuration options.

The "T42.MDFApi.CreateRequest" method returns a TerminalResult object with the following properties:

Property Type Description
correlationId string The request correlation ID.
elementSchema object The schema of the response data elements.
message string An error message (if the operation failed).
requestSchema object The schema of the request elements.
responseSchemas object The schemas of the response elements.
success boolean Whether the operation completed successfully.

Example:

const invocationArgs = {
    requestCorrelationId: "req-001",
    service: "//blp/refdata",
    operation: "ReferenceDataRequest",
    operationArgs: [
        { securities: ["VOD LN Equity", "BARC LN Equity"] },
        { fields: ["PX_LAST", "BID", "ASK"] }
    ],
    callbackMethod: "MyApp.OnReferenceData",
    settings: {
        sessionName: "my-session",
        sessionLifetime: "caller"
    }
};

const result = await io.interop.invoke("T42.MDFApi.CreateRequest", invocationArgs);
const terminalResult = result.returned.Result;

if (terminalResult.success) {
    // Request created successfully. Data will be pushed to the callback method.
};

Canceling Requests

To cancel previous requests and subscriptions, use the "T42.MDFApi.CancelRequests" method. It allows you to cancel one or more requests by specifying their correlation IDs.

The "T42.MDFApi.CancelRequests" method accepts as an argument an object with the following properties:

Property Type Description
requestCorrelationIds string[] Required. An array of correlation IDs for the requests or subscriptions to cancel.

The "T42.MDFApi.CancelRequests" method returns an array of TerminalResult objects (one per correlation ID) with the following properties:

Property Type Description
correlationId string The correlation ID of the canceled request.
message string An error message (if the cancellation failed, e.g., unknown correlation ID).
success boolean Whether the cancellation completed successfully.

Example:

const invocationArgs = {
    requestCorrelationIds: ["req-001", "sub-001"]
};

const result = await io.interop.invoke("T42.MDFApi.CancelRequests", invocationArgs);

// Example value:
// [
//     { success: true, correlationId: "req-001" },
//     { success: true, correlationId: "sub-001" }
// ]
const terminalResults = result.returned.Result;

Session & Service Schemas

Closing Sessions

To close an existing named session and clear its resources, use the "T42.MDFApi.CloseSession" method.

The "T42.MDFApi.CloseSession" method accepts as an argument an object with the following properties:

Property Type Description
sessionName string Required. The name of the session to close.

The "T42.MDFApi.CloseSession" method returns a TerminalResult object with the following properties:

Property Type Description
correlationId string The correlation ID.
message string An error message (if the operation failed, e.g., unknown session name).
success boolean Whether the operation completed successfully.

Example:

const invocationArgs = {
    sessionName: "my-session"
};

const result = await io.interop.invoke("T42.MDFApi.CloseSession", invocationArgs);
const terminalResult = result.returned.Result;

if (terminalResult.success) {
    // Session closed successfully.
};

Service Operations Schemas

To get descriptions (schemas) of service operations, use the "T42.MDFApi.DescribeServiceSchemas" method. This is particularly helpful when you need to inspect the arguments of a request or verify the types of values. If you don't specify the operation argument, the method will return all operations within the specified service.

The "T42.MDFApi.DescribeServiceSchemas" method accepts as an argument an object with the following properties:

Property Type Description
operation string The specific operation to describe (e.g., "ReferenceDataRequest"). If omitted, returns schemas for all operations in the service.
service string Required. The Bloomberg service to describe (e.g., "//blp/refdata").
settings object Required. An object containing session settings.

The "settings" object has the following properties:

Property Type Description
sessionIdentityOptions object Identity and authentication options for the session.
sessionLifetime string Required. The lifetime of the session (e.g., "caller" or "persistent").
sessionName string Required. The name of the Bloomberg session to use or create.
sessionOptions object Session configuration options.

The "T42.MDFApi.DescribeServiceSchemas" method returns a TerminalResult object with the following properties:

Property Type Description
correlationId string The correlation ID.
elementSchema object The schema of the data elements.
message string An error message (if the operation failed).
requestSchema object The schema of the request elements for the specified operation.
responseSchemas object The schemas of the response elements.
success boolean Whether the operation completed successfully.

Example:

const invocationArgs = {
    service: "//blp/refdata",
    operation: "ReferenceDataRequest",
    settings: {
        sessionName: "my-session",
        sessionLifetime: "caller"
    }
};

const result = await io.interop.invoke("T42.MDFApi.DescribeServiceSchemas", invocationArgs);
const terminalResult = result.returned.Result;

if (terminalResult.success) {
    const requestSchema = terminalResult.requestSchema;
    const responseSchemas = terminalResult.responseSchemas;
    // Use the schemas to inspect available arguments and response structure.
};