main content

bloomberg desktop connection v3 -凯发k8网页登录

bloomberg desktop connection v3

description

the blp function creates a blp object. the blp object represents a bloomberg® desktop connection.

other functions connect to different bloomberg services: bloomberg server (blpsrv), and bloomberg b-pipe® (bpipe). for details about these services, see .

for details about bloomberg connection requirements, see . to ensure a successful bloomberg connection, perform the required steps before executing blp. for details, see .

creation

description

example

c = blp creates a bloomberg connection object that contains the bloomberg desktop connection. you need a bloomberg desktop software license for the machine running the datafeed toolbox™ and matlab®.

example

c = blp(port,ip,timeout) sets the port and timeout properties, and uses the ip address of the local machine running bloomberg to create a bloomberg connection.

caution

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

input arguments

ip address that identifies the local machine running bloomberg, specified as a character vector or string scalar.

example: 'localhost'

data types: char | string

properties

this property is read-only.

bloomberg v3 session, specified as a bloomberg v3 api session object.

example: [1x1 com.bloomberglp.blpapi.session]

port number of the local machine running bloomberg, specified as a numeric scalar.

example: 8194

data types: double

ip address of the local machine running bloomberg, specified as a character vector.

the blp function sets this property using the ip input argument.

example: 'localhost'

data types: char

timeout specifying the time in milliseconds that matlab attempts to connect to bloomberg desktop before timing out, specified as a numeric scalar.

example: 10000

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 blp object, the blp 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:
  • 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 blp object, the blp 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
  • cell array (default)

  • structure

  • table

  • cell array (default)

  • structure

  • table

  • cell array (default)

  • structure

  • table

  • cell array (default)

  • structure

  • table

  • structure (default)

  • table

  • structure (default)

  • table

  • structure (default)

  • table

  • timetable

  • structure (default)

  • table

  • timetable

  • numeric array (default)

  • table

  • timetable

  • structure (default)

  • table

  • timetable

  • 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

close bloomberg connection v3
properties of bloomberg connection v3
determine bloomberg connection v3
equity screening data for bloomberg connection v3
bulk data with header information for bloomberg connection v3
current data for bloomberg connection v3
historical data for bloomberg connection v3
current portfolio data for bloomberg connection v3
real-time data for bloomberg connection v3
unsubscribe real-time requests for bloomberg connection v3
historical technical analysis for bloomberg connection v3
intraday tick data for bloomberg connection v3
field category search for bloomberg connection v3
field information for bloomberg connection v3
field search for bloomberg connection v3
find information about securities for bloomberg connection v3

examples

first, create a bloomberg® connection, and then retrieve current data for a security.

create a connection to the bloomberg desktop.

c = blp
c = 
  blp with properties:
             session: [1×1 com.bloomberglp.blpapi.session]
           ipaddress: 'localhost'
                port: 8194
             timeout: 0
        datetimetype: ''
    datareturnformat: ''

c is a bloomberg connection object with these properties:

  • bloomberg v3 api session object

  • ip address of the local machine

  • port number of the local machine

  • number in milliseconds specifying how long matlab attempts to connect to bloomberg desktop 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 = struct with fields:
    last_price: 72.28
          open: 71.61
sec = 1×1 cell array
    {'msft us equity'}

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

close the bloomberg desktop connection.

close(c)

first, create a bloomberg® connection with a timeout value, and then retrieve current data for a security.

create a connection to the bloomberg desktop using the default port and ip address. specify a timeout value of 10,000 milliseconds.

c = blp([],[],10000)
c = 
  blp with properties:
             session: [1×1 com.bloomberglp.blpapi.session]
           ipaddress: 'localhost'
                port: 8194
             timeout: 10000
        datetimetype: ''
    datareturnformat: ''

the blp function creates a bloomberg connection object c with these properties:

  • bloomberg v3 api session object

  • ip address of the local machine

  • port number of the local machine

  • number of milliseconds specifying how long matlab® attempts to connect to bloomberg desktop 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 = struct with fields:
    last_price: 71.83
          open: 71.61
sec = 1×1 cell array
    {'msft us equity'}

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

close the bloomberg desktop connection.

close(c)

version history

introduced in r2010a

see also

topics

    网站地图