main content

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

bloomberg server connection v3

description

the blpsrv function creates a blpsrv object. the blpsrv object represents a bloomberg® server connection.

other functions connect to different bloomberg services: bloomberg desktop (blp), 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 blpsrv. for details, see .

creation

description

example

c = blpsrv(uuid,ipaddress) creates a bloomberg server connection object c to the bloomberg server running on another machine, and sets the uuid and ipaddress properties. you need a bloomberg server software license for the machine running the bloomberg server.

example

c = blpsrv(uuid,ipaddress,port) also sets the port property.

example

c = blpsrv(uuid,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 blpsrv function. otherwise, using blpsrv as an input argument opens multiple bloomberg connections, causing unexpected behavior and exhausting memory resources.

properties

bloomberg user identity uuid, specified as a numeric scalar. to find your uuid, enter iam in the bloomberg terminal and press go.

example: 12345678

data types: double

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.

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

example: '111.11.11.111'

data types: char

this property is read-only.

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

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

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

example: '111.11.11.111'

data types: char | string

port number, specified as a numeric scalar that identifies the port number of the machine running the bloomberg server.

example: 8194

data types: double

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

example: 10

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 blpsrv object, the blpsrv 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 blpsrv object, the blpsrv 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

connect to the bloomberg server using the ip address of the machine running the bloomberg server. this example assumes the following:

  • the bloomberg uuid is 12345678.

  • the ip address for the machine running the bloomberg server is '111.11.11.111'.

uuid = 12345678;
ipaddress = '111.11.11.111';
c = blpsrv(uuid,ipaddress)
c = 
  blpsrv with properties:
                uuid: 12345678
                user: [1x1 com.bloomberglp.blpapi.impl.at]
              userip: '111.11.11.112'
             session: [1x1 com.bloomberglp.blpapi.session]
           ipaddress: '111.11.11.111'
                port: 8194
             timeout: 0
        datetimetype: ''
    datareturnformat: ''

blpsrv connects to the machine running the bloomberg server using the default port number 8194. blpsrv creates the bloomberg server connection object c with these properties:

  • bloomberg user identity uuid

  • bloomberg user identity object

  • ip address of the machine running matlab

  • bloomberg v3 api session object

  • ip address of the machine running the bloomberg server

  • port number of the machine running the bloomberg server

  • number in milliseconds specifying how long matlab attempts to connect to the machine running the bloomberg server 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 server connection.

close(c)

connect to the bloomberg server using the ip address of the machine running the bloomberg server. this example assumes the following:

  • the bloomberg uuid is 12345678.

  • the ip address for the machine running the bloomberg server is '111.11.11.111'.

  • the port number of the machine running the bloomberg server is 8194.

uuid = 12345678;
ipaddress = '111.11.11.111';
port = 8194;
c = blpsrv(uuid,ipaddress,port)
c = 
  blpsrv with properties:
                uuid: 12345678
                user: [1x1 com.bloomberglp.blpapi.impl.at]
              userip: '111.11.11.112'
             session: [1x1 com.bloomberglp.blpapi.session]
           ipaddress: '111.11.11.111'
                port: 8194
             timeout: 0
        datetimetype: ''
    datareturnformat: ''

blpsrv connects to the machine running the bloomberg server using the port number 8194 and creates the bloomberg server connection object c with these properties:

  • bloomberg user identity uuid

  • bloomberg user identity object

  • ip address of the machine running matlab

  • bloomberg v3 api session object

  • ip address of the machine running the bloomberg server

  • port number of the machine running the bloomberg server

  • number in milliseconds specifying how long matlab attempts to connect to the machine running the bloomberg server 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 server connection.

close(c)

connect to the bloomberg server using the ip address of the machine running the bloomberg server. this example assumes the following:

  • the bloomberg uuid is 12345678.

  • the ip address for the machine running the bloomberg server is '111.11.11.111'.

  • the port number of the machine running the bloomberg server is your default port number.

  • the timeout value is 10 milliseconds.

uuid = 12345678;
ipaddress = '111.11.11.111';
port = [];
timeout = 10;
c = blpsrv(uuid,ipaddress,port,timeout)
c = 
  blpsrv with properties:
                uuid: 12345678
                user: [1x1 com.bloomberglp.blpapi.impl.at]
              userip: '111.11.11.112'
             session: [1x1 com.bloomberglp.blpapi.session]
           ipaddress: '111.11.11.111'
                port: 8194
             timeout: 10
        datetimetype: ''
    datareturnformat: ''

blpsrv connects to the machine running the bloomberg server using the default port number 8194 and a timeout value of 10 milliseconds. blpsrv creates the bloomberg server connection object c with these properties:

  • bloomberg user identity uuid

  • bloomberg user identity object

  • ip address of the machine running matlab

  • bloomberg v3 api session object

  • ip address of the machine running the bloomberg server

  • port number of the machine running the bloomberg server

  • number in milliseconds specifying how long matlab attempts to connect to the machine running the bloomberg server 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 server connection.

close(c)

version history

introduced in r2014b

see also

topics

    网站地图