Main Content

bloombergBPIPE

Bloomberg B-PIPE connection V3

Since R2021a

Description

The bloombergBPIPE function creates a bloombergBPIPE object. The bloombergBPIPE object represents a Bloomberg® B-PIPE® connection using the Bloomberg V3 C++ API.

Other Datafeed Toolbox™ functions connect to different Bloomberg services: Bloomberg Desktop (bloomberg) and Bloomberg Server (bloombergServer). For details about these services, see Comparing Bloomberg Connections.

For details about Bloomberg connection requirements, see Data Server Connection Requirements. To ensure a successful Bloomberg connection, perform the required steps before executing bloombergBPIPE. For details, see Installing Bloomberg and Configuring Connections.

Creation

Description

example

c = bloombergBPIPE(authtype,appname,ipaddress,port) creates a Bloomberg B-PIPE connection object c, and sets these properties:

example

c = bloombergBPIPE(authtype,appname,ipaddress,port,timeout) also sets the TimeOut property.

Caution

To refer to a Bloomberg connection in other functions, use the connection object created by the bloombergBPIPE function. Otherwise, using bloombergBPIPE as an input argument opens multiple Bloomberg connections, causing unexpected behavior and exhausting memory resources.

Properties

expand all

This property is read-only.

Application authentication type, specified as one of these values:

  • "" — Bloomberg B-PIPE connection with Windows® authentication

  • "APPNAME_AND_KEY" — Bloomberg B-PIPE connection with application authentication

Bloomberg user authentication type, specified as one of these values:

  • "OS_LOGON" — Bloomberg B-PIPE connection with Windows authentication

  • "APPLICATION_ONLY" — Bloomberg B-PIPE connection with application authentication

For details, see the Bloomberg B-PIPE API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.

Application name, specified as a character vector or string that identifies the application you are using to connect to Bloomberg B-PIPE.

Example: 'appname'

Data Types: char | string

This property is read-only.

Bloomberg user, specified as a Bloomberg user identity object.

Example: [1x1 com.bloomberglp.blpapi.impl.aT]

This property is read-only.

Bloomberg V3 session, specified as a Bloomberg V3 API Session object.

Example: [1x1 BLPSession]

IP address of the machine running the Bloomberg B-PIPE process, specified as a character vector, cell array of character vectors, string, or string array. A character vector or string identifies the machine running the Bloomberg B-PIPE process, whereas a cell array of character vectors or string array specifies multiple machines.

Example: {'111.11.11.112'}

Data Types: char | cell | string

Port number of the machine running the Bloomberg B-PIPE process, specified as a numeric scalar.

Example: 8194

Data Types: double

Timeout specifying the time in milliseconds that MATLAB® attempts to connect to the machine running the Bloomberg B-PIPE process before timing out, specified as a numeric scalar.

Example: 1000

Data Types: double

Date and time data type, specified as one of these values.

ValueDescription
'' (default)Return date and time values as MATLAB date numbers.
'datetime'Return date and time values as a datetime array.

You can specify these values using a character vector or string (for example, "datetime").

When you create a bloombergBPIPE object, the bloombergBPIPE function leaves this property unset. To retrieve data, you must set this property value manually at the command line or in a script using dot notation, for example:

c.DatetimeType = 'datetime';
Then, you can use these supported functions:

  • getbulkdata

  • getdata

  • history

  • tahistory

  • timeseries

    Note

    If the DataReturnFormat property value is 'table' and the DatetimeType property value is 'datetime', then the returned data is a table that contains date and time values as a datetime array. If the DataReturnFormat property value is an empty character vector, then setting the DatetimeType property to 'datetime' returns date and time values for aggregated ticks and historical requests as MATLAB date numbers.

Data return format, specified as one of these values, which determine the data type of the returned data.

ValueData Type of Returned Data
'cell'cell array
'table'table
'timetable'timetable
'structure'structure

Note

The default data type of the returned data depends on the executed function. To specify the default data type, set the DataReturnFormat property to ''. For default data types, see the supported function list.

You can specify these values using a character vector or string (for example, "table").

When you create a bloombergBPIPE object, the bloombergBPIPE function leaves this property unset. To retrieve data, you must set this property value manually at the command line or in a script using dot notation, for example:

c.DataReturnFormat = 'structure';
Then, you can use these supported functions.

Supported FunctionValid Data Types for Returned Data
category
  • cell array (default)

  • structure

  • table

eqs
  • cell array (default)

  • structure

  • table

fieldinfo
  • cell array (default)

  • structure

  • table

fieldsearch
  • cell array (default)

  • structure

  • table

lookup
  • structure (default)

  • table

portfolio
  • structure (default)

  • table

getbulkdata
  • structure (default)

  • table

  • timetable

getdata
  • structure (default)

  • table

  • timetable

history
  • numeric array (default)

  • table

  • timetable

tahistory
  • structure (default)

  • table

  • timetable

timeseries
  • cell array (default for raw tick data)

  • numeric array (default for interval tick data)

  • table

  • timetable

Note

Regardless of the DatetimeType property value, if the DataReturnFormat property value is 'timetable', then the getdata and getbulkdata functions return a table that contains date and time values as datetime arrays.

Object Functions

expand all

closeClose Bloomberg B-PIPE connection V3
isconnectionDetermine Bloomberg B-PIPE connection V3
eqsEquity screening data for Bloomberg B-PIPE connection V3
getProperties of Bloomberg B-PIPE connection V3
getbulkdataBulk data with header information for Bloomberg B-PIPE connection V3
getdataCurrent data for Bloomberg B-PIPE connection V3
historyHistorical data for Bloomberg B-PIPE connection V3
portfolioCurrent portfolio data for Bloomberg B-PIPE connection V3
realtimeReal-time data for Bloomberg B-PIPE connection V3
tahistoryHistorical technical analysis for Bloomberg B-PIPE connection V3
timeseriesIntraday tick data for Bloomberg B-PIPE connection V3
categoryField category search for Bloomberg B-PIPE connection V3
fieldinfoField information for Bloomberg B-PIPE connection V3
fieldsearchField search for Bloomberg B-PIPE connection V3
lookupFind information about securities for Bloomberg B-PIPE connection V3

Examples

collapse all

Create a Bloomberg B-PIPE connection using the IP address of the machine running the Bloomberg B-PIPE process. This example assumes the following:

  • The authentication is Windows authentication when you set authtype to 'OS_LOGON'.

  • The application name is blank because you are not connecting to Bloomberg B-PIPE using an application.

  • The IP address for the machine running the Bloomberg B-PIPE process is '111.11.11.112'.

  • The port number of the machine running the Bloomberg B-PIPE process is 8194.

authtype = 'OS_LOGON';
appname = '';
ipaddress = {'111.11.11.112'};
port = 8194;

c = bloombergBPIPE(authtype,appname,ipaddress,port)
c = 

  bloombergBPIPE with properties:

         AppAuthType: ''
            AuthType: 'OS_LOGON'
             AppName: []
                User: []
             Session: [1×1 BLPSession]
           IPAddress: {'111.11.11.112'}
                Port: 8194.00
             TimeOut: 0
        DatetimeType: ''
    DataReturnFormat: ''

The bloombergBPIPE function connects to the machine running Bloomberg B-PIPE at port number 8194. The bloombergBPIPE function creates the bloombergBPIPE object c with these properties:

  • Application authentication type

  • Bloomberg user authentication type

  • Application name

  • Bloomberg user identity object

  • Bloomberg V3 API Session object

  • IP address of the machine running the Bloomberg B-PIPE process

  • Port number of the machine running the Bloomberg B-PIPE process

  • Number (in milliseconds) specifying how long MATLAB attempts to connect to the machine before timing out

  • Date and time data type

  • Data return format

Request the last and open prices for Microsoft®.

format bank  % Display data format for currency
s = 'MSFT US Equity';
f = {'LAST_PRICE';'OPEN'};
[d,sec] = getdata(c,s,f)
d = 
    LAST_PRICE: 33.34
          OPEN: 33.60

sec = 
    'MSFT US Equity'

getdata returns a structure d with the last and open prices. Also, getdata returns the name of the security in sec.

Close the Bloomberg B-PIPE connection.

close(c)

Create a Bloomberg B-PIPE connection using the IP address of the machine running the Bloomberg B-PIPE process. This example assumes the following:

  • The authentication is Windows authentication when you set authtype to 'OS_LOGON'.

  • The application name is blank because you are not connecting to Bloomberg B-PIPE using an application.

  • The IP address for the machine running the Bloomberg B-PIPE process is '111.11.11.112'.

  • The port number of the machine running the Bloomberg B-PIPE process is 8194.

  • The timeout value is 1000 milliseconds.

authtype = 'OS_LOGON';
appname = '';
ipaddress = {'111.11.11.112'};
port = 8194;
timeout = 1000;

c = bloombergBPIPE(authtype,appname,ipaddress,port,timeout)
c = 

  bloombergBPIPE with properties:

         AppAuthType: ''
            AuthType: 'OS_LOGON'
             AppName: []
                User: []
             Session: [1×1 BLPSession]
           IPAddress: {'172.28.17.118'}
                Port: 8194.00
             TimeOut: 1000.00
        DatetimeType: ''
    DataReturnFormat: ''

The bloombergBPIPE function connects to the machine running Bloomberg B-PIPE at port number 8194. The bloombergBPIPE function creates the bloombergBPIPE object c with these properties:

  • Application authentication type

  • Bloomberg user authentication type

  • Application name

  • Bloomberg user identity object

  • Bloomberg V3 API Session object

  • IP address of the machine running the Bloomberg B-PIPE process

  • Port number of the machine running the Bloomberg B-PIPE process

  • Number (in milliseconds) specifying how long MATLAB attempts to connect to the machine before timing out

  • Date and time data type

  • Data return format

Request the last and open prices for Microsoft.

format bank  % Display data format for currency
s = 'MSFT US Equity';
f = {'LAST_PRICE';'OPEN'};
[d,sec] = getdata(c,s,f)
d = 
    LAST_PRICE: 33.34
          OPEN: 33.60

sec = 
    'MSFT US Equity'

getdata returns a structure d with the last and open prices. Also, getdata returns the name of the security in sec.

Close the Bloomberg B-PIPE connection.

close(c)

Version History

Introduced in R2021a