lookup
Find information about securities forBloombergconnection V3
Description
retrieves data based on criteria in the queryl
= lookup(c
,q
,reqtype
,Name,Value)q
for a specific request typereqtype
using the Bloomberg®connectionc
. For additional information about the query criteria and the possible name-value pair combinations, see theBloomberg API Developer’s Guideusing theWAPI
Examples
Look Up Security
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 theWAPI
Create the Bloomberg connection.
c = blp;
Alternatively, you can connect to the Bloomberg Server usingblpsrv
or Bloomberg B-PIPE® usingbpipe
.
Return data as a table by setting theDataReturnFormat
property of the connection object. If you do not set this property, thelookup
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' 'International Business Machines Corp' '459200AG ' 'International Business Machines Corp' 'EC767659 ' 'International Business Machines Corp'
Close the Bloomberg connection.
close(c)
Look Up Curve
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
Connect to Bloomberg.
c = blp;
Alternatively, you can connect to the Bloomberg Server usingblpsrv
or 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 of10
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 thebbgid
is blank.
Close the Bloomberg connection.
close(c)
Look Up Government Security
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
Connect to Bloomberg.
c = blp;
Alternatively, you can connect to the Bloomberg Server usingblpsrv
or Bloomberg B-PIPE usingbpipe
.
Filter government security data with ticker filter of'T'
for a maximum of10
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 returnsparseky
data, the name, and ticker of the United States Treasury bonds.
Display theparseky
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
q
—Keyword query
character vector|string scalar|cell array of character vectors|string array
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
reqtype
—Request type
'instrumentListRequest'
|'curveListRequest'
|'govtListRequest'
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
, whereName
is the argument name andValue
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 encloseName
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
maxResults
—Number of rows in result data
numeric scalar
结果数据的行数,指定为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
yellowKeyFilter
—Bloomberg yellow key filter
character vector|string scalar
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
languageOverride
—Language override
character vector|string scalar
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
countryCode
—Country code
character vector|string scalar
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
currencyCode
—Currency code
character vector|string scalar
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
curveID
—Bloomberg short-form identifier for curve
character vector|string scalar
Bloomberg short-form identifier for a curve, specified as the comma-separated pair consisting of'curveID'
和一个特征向量或string scalar.
Data Types:char
|string
type
—Bloomberg market sector type
character vector|string scalar
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
subtype
—Bloomberg market sector subtype
character vector|string scalar
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
partialMatch
—Partial match on ticker
true
|false
Partial match on ticker, specified as the comma-separated pair consisting of'partialMatch'
andtrue
orfalse
. When set totrue
, you can filter securities by settingq
to a query such as'T*'
. When set tofalse
, the securities are unfiltered.
Data Types:logical
输出参数
l
— Lookup information
structure (default) | table
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 name |
|
Security long name |
'curveListRequest' Properties
Property | Description |
---|---|
|
Bloomberg curve name |
|
Bloomberg description |
|
Country code |
|
Currency code |
|
Bloomberg short-form identifier for the curve |
|
Bloomberg market sector type |
|
Bloomberg market sector subtype |
|
Bloomberg specified as publisher |
|
Bloomberg identifier |
'govtListRequest' Properties
Property | Description |
---|---|
|
Bloomberg security identifier (ticker or CUSIP, for example), price source, and source key (Bloomberg yellow key) |
|
Government security name |
|
Government security ticker |
Version History
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)