lookup
Find information about securities for Bloomberg connection V3
Description
retrieves data based on criteria in the query l
= lookup(c
,q
,reqtype
,Name,Value)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.
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 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)
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 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)
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 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
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 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
maxResults
— Number of rows in result data
numeric scalar
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
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'
and a character vector or 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'
and a character vector or 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'
and a
character vector or 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'
and a character vector or 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'
and a character vector
or 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'
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
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 the DataReturnFormat property 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
Introduced in R2014a
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)