Main Content

lookup

Find information about securities forBloombergconnection V3

Description

example

l= lookup(c,q,reqtype,Name,Value)retrieves data based on criteria in the queryqfor a specific request typereqtypeusing the Bloomberg®connectionc. For additional information about the query criteria and the possible name-value pair combinations, see theBloomberg API Developer’s Guideusing theWAPI option from the Bloomberg terminal.

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 theBloomberg API Developer's Guideusing theWAPIoption from the Bloomberg terminal.

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server usingblpsrvor Bloomberg B-PIPE® usingbpipe.

Return data as a table by setting theDataReturnFormatproperty of the connection object. If you do not set this property, thelookupfunction 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 ' 'International Business Machines Corp' '459200AG ' 'International Business Machines Corp' 'EC767659 ' '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 theBloomberg API Developer’s Guideusing theWAPI option from the Bloomberg terminal.

Connect to Bloomberg.

c = blp;

Alternatively, you can connect to the Bloomberg Server usingblpsrvor Bloomberg B-PIPE®usingbpipe.

Retrieve the curve data for the credit default swap subtype of corporate bonds for a'GOLD'related curve'CD1016'. Return a maximum of10rows 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 thebbgidis 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 theBloomberg API Developer’s Guideusing theWAPI option from the Bloomberg terminal.

Connect to Bloomberg.

c = blp;

Alternatively, you can connect to the Bloomberg Server usingblpsrvor Bloomberg B-PIPE usingbpipe.

Filter government security data with ticker filter of'T'for a maximum of10rows 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 returnsparsekydata, the name, and ticker of the United States Treasury bonds.

Display theparsekydata.

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 usingblp,blpsrv, orbpipe.

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 asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis 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 encloseNamein quotes.

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

结果数据的行数,指定为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'和一个特征向量或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'和一个特征向量或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'和一个特征向量或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'和一个特征向量或string scalar.

Data Types:char|string

Bloomberg market sector subtype, specified as the comma-separated pair consisting of'subtype'和一个特征向量或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'andtrueorfalse. When set totrue, you can filter securities by settingqto a query such as'T*'. When set tofalse, the securities are unfiltered.

Data Types:logical

输出参数

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 theDataReturnFormatproperty of the connection object.

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

'instrumentListRequest' Properties

Property Description

security

Security name

描述

Security long name

'curveListRequest' Properties

Property Description

curve

Bloomberg curve name

描述

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

Property Description

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