Main Content

lookup

Find information about securities for Bloomberg connection V3

Description

l = lookup(c,q,reqtype,Name,Value) retrieves data based on criteria in the query q for a specific request type reqtype using the Bloomberg® connection c. For additional information about the query criteria and the possible name-value pair combinations, see the Bloomberg API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.

example

Examples

collapse all

Create a Bloomberg® connection, and then use the Security Lookup to retrieve information about the IBM® corporate bond. For details about Bloomberg and the parameter values you can set, see the Bloomberg API Developer's Guide using the WAPI<GO> option from the Bloomberg terminal.

Create the Bloomberg connection.

c = blp;

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

Return data as a table by setting the DataReturnFormat property of the connection object. If you do not set this property, the lookup function returns data as a structure.

c.DataReturnFormat = 'table';

Retrieve the instrument data for an IBM corporate bond with a maximum of 20 rows of data. The Security Lookup returns the security names and descriptions.

insts = lookup(c,'IBM','instrumentListRequest','maxResults',20, ...
    'yellowKeyFilter','YK_FILTER_CORP', ...
    'languageOverride','LANG_OVERRIDE_NONE');

Display the first three rows in the table. The first column contains the IBM corporate bond names, and the second column contains the bond descriptions.

insts(1:3,:)
ans =

  3×2 table

        security                      description              
    _________________    ______________________________________

    'DD103619 <corp>'    'International Business Machines Corp'
    '459200AG <corp>'    'International Business Machines Corp'
    'EC767659 <corp>'    'International Business Machines Corp'

Close the Bloomberg connection.

close(c)

Use the Curve Lookup to retrieve information about the 'GOLD' related curve 'CD1016'. For details about Bloomberg and the parameter values you can set, see the Bloomberg API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.

Connect to Bloomberg.

c = blp;

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

Retrieve the curve data for the credit default swap subtype of corporate bonds for a 'GOLD' related curve 'CD1016'. Return a maximum of 10 rows of data for the U.S. with 'USD' currency.

curves = lookup(c,'GOLD','curveListRequest','maxResults',10,...
                'countryCode','US','currencyCode','USD',...
                'curveid','CD1016','type','CORP','subtype','CDS')
curves = 
  
            curve: {'YCCD1016 Index'}
      description: {'Goldman Sachs Group Inc/The'}
          country: {'US'}
         currency: {'USD'}
          curveid: {'CD1016'}
             type: {'CORP'}
          subtype: {'CDS'}
        publisher: {'Bloomberg'}
            bbgid: {''}

One row of data displays as Bloomberg curve name 'YCCD1016 Index' with Bloomberg description 'Goldman Sachs Group Inc/The' in the U.S. with 'USD' currency. The Bloomberg short-form identifier for the curve is 'CD1016'. Bloomberg is the publisher and the bbgid is blank.

Close the Bloomberg connection.

close(c)

Use the Government Security Lookup to retrieve information for United States Treasury bonds. For details about Bloomberg and the parameter values you can set, see the Bloomberg API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.

Connect to Bloomberg.

c = blp;

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

Filter government security data with ticker filter of 'T' for a maximum of 10 rows of data.

govts = lookup(c,'T','govtListRequest','maxResults',10,...
               'partialMatch',false)
govts = 
  
      parseky: {10x1 cell}
         name: {10x1 cell}
       ticker: {10x1 cell}

The Government Security Lookup returns parseky data, the name, and ticker of the United States Treasury bonds.

Display the parseky data.

govts.parseky
ans = 
    '912828VS Govt'
    '912828RE Govt'
    '912810RC Govt'
    '912810RB Govt'
    '912828VU Govt'
    '912828VV Govt'
    '912828VB Govt'
    '912828VR Govt'
    '912828VW Govt'
    '912828VQ Govt'

Display the names of the United States Treasury bonds.

govts.name
ans = 
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'
    'United States Treasury Note/Bond'

Display the tickers of the United States Treasury bonds.

govts.ticker
ans = 
    'T'
    'T'
    'T'
    'T'
    'T'
    'T'
    'T'
    'T'
    'T'
    'T'

Close the Bloomberg connection.

close(c)

Input Arguments

collapse all

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

Keyword query, specified as a character vector, string scalar, cell array of character vectors, or string array. Each character vector or string denotes an item for which information is requested. For example, the keyword query can be a security, a curve type, or a filter ticker.

Data Types: char | cell | string

Request type, specified as the preceding values to denote the type of information request. 'instrumentListRequest' denotes a security or instrument lookup request. 'curveListRequest' denotes a curve lookup request. 'govtListRequest' denotes a government lookup request for government securities.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'maxResults', 20, 'yellowKeyFilter', 'YK_FILTER_CORP', 'languageOverride', 'LANG_OVERRIDE_NONE', 'countryCode', 'US', 'currencyCode', 'USD', 'curveid', 'CD1016', 'type', 'CORP', 'subtype', 'CDS', 'partialMatch', false

Number of rows in the result data, specified as the comma-separated pair consisting of 'maxResults' and a numeric scalar to denote the total maximum number of rows of information to return. Result data can be one or more rows of data no greater than the number specified.

Data Types: double

Bloomberg yellow key filter, specified as the comma-separated pair consisting of 'yellowKeyFilter' and a unique character vector or string scalar to denote the particular yellow key for government securities, corporate bonds, equities, and commodities, for example.

Data Types: char | string

Language override, specified as the comma-separated pair consisting of 'languageOverride' and a unique character vector or string scalar to denote a translation language for the result data.

Data Types: char | string

Country code, specified as the comma-separated pair consisting of 'countryCode' and a character vector or string scalar to denote the country for the result data.

Data Types: char | string

Currency code, specified as the comma-separated pair consisting of 'currencyCode' and a character vector or string scalar to denote the currency for the result data.

Data Types: char | string

Bloomberg short-form identifier for a curve, specified as the comma-separated pair consisting of 'curveID' and a character vector or string scalar.

Data Types: char | string

Bloomberg market sector type corresponding to the Bloomberg yellow keys, specified as the comma-separated pair consisting of 'type' and a character vector or string scalar.

Data Types: char | string

Bloomberg market sector subtype, specified as the comma-separated pair consisting of 'subtype' and a character vector or string scalar to further delineate the market sector type.

Data Types: char | string

Partial match on ticker, specified as the comma-separated pair consisting of 'partialMatch' and true or false. When set to true, you can filter securities by setting q to a query such as 'T*'. When set to false, the securities are unfiltered.

Data Types: logical

Output Arguments

collapse all

Lookup information, returned as a structure or table containing set properties depending on the request type. The data type of the lookup information depends on the DataReturnFormat property of the connection object.

For a list of the set properties and their descriptions, see the following tables.

'instrumentListRequest' Properties

PropertyDescription

security

Security name

description

Security long name

'curveListRequest' Properties

PropertyDescription

curve

Bloomberg curve name

description

Bloomberg description

country

Country code

currency

Currency code

curveid

Bloomberg short-form identifier for the curve

type

Bloomberg market sector type

subtype

Bloomberg market sector subtype

publisher

Bloomberg specified as publisher

bbgid

Bloomberg identifier

'govtListRequest' Properties

PropertyDescription

parseky

Bloomberg security identifier (ticker or CUSIP, for example), price source, and source key (Bloomberg yellow key)

name

Government security name

ticker

Government security ticker

Version History

Introduced in R2014a