Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

getdata

Current data for Bloomberg connection V3

Syntax

Description

example

d = getdata(c,s,f) returns the data for the fields f for the security list s. getdata accesses the Bloomberg® reference data service.

example

d = getdata(c,s,f,o,ov) returns the data using the override fields o with corresponding override values ov.

example

d = getdata(c,s,f,o,ov,Name,Value) returns the data using Name,Value pair arguments for additional Bloomberg request settings.

example

[d,sec] = getdata(___) additionally returns the security list sec using any of the input arguments in the previous syntaxes.

Examples

collapse all

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE® using bpipe.

Request last and open prices for Microsoft®.

[d,sec] = getdata(c,'MSFT US Equity',{'LAST_PRICE';'OPEN'})
d = 
    LAST_PRICE: 33.3401
          OPEN: 33.6000

sec = 
    'MSFT US Equity'

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

Close the connection.

close(c)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

Request data for Bloomberg fields 'YLD_YTM_ASK', 'ASK', and 'OAS_SPREAD_ASK' when the Bloomberg field 'OAS_VOL_ASK' is '14.000000'.

[d,sec] = getdata(c,'030096AF8 Corp',...
   {'YLD_YTM_ASK','ASK','OAS_SPREAD_ASK','OAS_VOL_ASK'},...
   {'OAS_VOL_ASK'},{'14.000000'})
d = 
       YLD_YTM_ASK: 5.6763
               ASK: 120.7500
    OAS_SPREAD_ASK: 307.9824
       OAS_VOL_ASK: 14

sec = 
    '030096AF8 Corp'

getdata returns a structure d with the resulting values for the requested fields.

Close the connection.

close(c)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

Request the last price for IBM® with the CUSIP number.

d = getdata(c,'/cusip/459200101','LAST_PRICE') 
d = 
    LAST_PRICE: 182.5100

getdata returns a structure d with the last price.

Close the connection.

close(c)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

Specify IBM with the CUSIP number and the pricing source BGN after the @ symbol.

d = getdata(c,'/cusip/459200101@BGN','LAST_PRICE')
d =
    LAST_PRICE: 186.81

getdata returns a structure d with the last price.

Close the connection.

close(c)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

Return the constituent weights for the Dow Jones Index as of January 1, 2010 using a date override with the required date format YYYYMMDD.

d = getdata(c,'DJX Index','INDX_MWEIGHT','END_DT','20100101')
d = 
    INDX_MWEIGHT: {{30x2 cell}}

getdata returns a structure d with a cell array where the first column is the index and the second column is the constituent weight.

Display the constituent weights for each index.

d.INDX_MWEIGHT{1,1}
ans = 
    'AA UN'      [1.1683]
    'AXP UN'     [2.9366]
    'BA UN'      [3.9229]
    'BAC UN'     [1.0914]
    ...

Close the connection.

close(c)

Related Examples

Input Arguments

collapse all

Bloomberg connection, specified as a connection object created using blp, blpsrv, or bpipe.

Security list, specified as a character vector for one security or a cell array of character vectors for multiple securities. You can specify the security by name or by CUSIP, and with or without the pricing source.

Data Types: char | cell

Bloomberg data fields, specified as a character vector or a cell array of character vectors. A character vector denotes one Bloomberg data field name. A cell array of character vectors denotes multiple Bloomberg data field names. For details about the character vectors you can specify, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Example: {'LAST_PRICE';'OPEN'}

Data Types: char | cell

Bloomberg override field, specified as a character vector or a cell array of character vectors. A character vector denotes one Bloomberg override field name. A cell array of character vectors denotes multiple Bloomberg override field names. For details about the character vectors you can specify, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Example: 'END_DT'

Data Types: char | cell

Bloomberg override field value, specified as a character vector or a cell array of character vectors. A character vector denotes one Bloomberg override field value. A cell array of character vectors denotes multiple Bloomberg override field values. Use this field value to filter the Bloomberg data result set.

Example: '20100101'

Data Types: char | cell

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'returnEids',true

collapse all

Entitlement identifiers, specified as a Boolean. true adds a name and value for the entitlement identifier (EID) date to the return data.

Data Types: logical

Return format, specified as a Boolean. true forces all data to be returned as the data type character vector.

Data Types: logical

Date time format, specified as a Boolean. true returns date and time values as Coordinated Universal Time (UTC) and false defaults to the Bloomberg TZDF <GO> settings of the requestor.

Data Types: logical

Latest reference data, specified as a Boolean. true returns the latest data up to the delay period specified by the exchange for the security.

Data Types: logical

Output Arguments

collapse all

Bloomberg return data, returned as a structure with the Bloomberg data. For details about the returned data, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Security list, returned as a cell array of character vectors for the corresponding securities in s. The contents of sec are identical in value and order to s. You can return securities with any of the following identifiers:

  • buid

  • cats

  • cins

  • common

  • cusip

  • isin

  • sedol1

  • sedol2

  • sicovam

  • svm

  • ticker (default)

  • wpk

More About

collapse all

Tips

  • Bloomberg V3 data supports additional name-value pair arguments. To access further information on these additional name-value pairs, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

  • You can check data and field availability by using the Bloomberg Excel® Add-In.

  • For a Bloomberg B-PIPE connection, d returns an additional field named EID. EID means entitlement identifier. For details, see the Bloomberg API Developer's Guide.

See Also

| | | |

Introduced in R2010a


Was this topic helpful?