Find information about securities for Bloomberg connection V3
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.
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)
q
— Keyword queryKeyword 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.
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
'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 dataNumber 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 filterBloomberg 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 overrideLanguage 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 codeCountry 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 codeCurrency 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 curveBloomberg 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 typeBloomberg 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 subtypeBloomberg 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 tickertrue
| 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
l
— Lookup informationLookup 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 |
A modified version of this example exists on your system. Do you want to open this version instead?
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.
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: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.