portfolio
Description
Examples
Request Portfolio Data
Create a Bloomberg® B-PIPE® connection using the IP address of the machine running the Bloomberg B-PIPE process. This example uses the Bloomberg B-PIPE C++ interface and assumes the following:
The authentication is Windows® authentication when you set
authtype
to'OS_LOGON'
.The application name is blank because you are not connecting to Bloomberg B-PIPE using an application.
The IP address for the machine running the Bloomberg B-PIPE process is
'111.11.11.112'
.The port number of the machine running the Bloomberg B-PIPE process is
8194
.
c
is a bloombergBPIPE
object.
authtype = 'OS_LOGON'; appname = ''; ipaddress = {'111.11.11.112'}; port = 8194; c = bloombergBPIPE(authtype,appname,ipaddress,port);
Request portfolio data for a custom portfolio with portfolio identifier
U335877-1 Client
. Request data using all fields
f
.
p = 'U335877-1 Client'; f = {'PORTFOLIO_MEMBERS','PORTFOLIO_MPOSITION',... 'PORTFOLIO_MWEIGHT','PORTFOLIO_DATA'}; d = portfolio(c,p,f)
d = PORTFOLIO_MPOSITION: {{0x1 cell}} PORTFOLIO_MWEIGHT: {{0x1 cell}} PORTFOLIO_DATA: {{0x1 cell}} PORTFOLIO_MEMBERS: {{0x1 cell}}
d
is a structure that contains portfolio data. Each
structure field corresponds to data for each portfolio field.
Close the connection.
close(c)
Request Portfolio Data Using Specific Date
Create a Bloomberg B-PIPE connection using the IP address of the machine running the Bloomberg B-PIPE process. This example uses the Bloomberg B-PIPE C++ interface and assumes the following:
The authentication is Windows authentication when you set
authtype
to'OS_LOGON'
.The application name is blank because you are not connecting to Bloomberg B-PIPE using an application.
The IP address for the machine running the Bloomberg B-PIPE process is
'111.11.11.112'
.The port number of the machine running the Bloomberg B-PIPE process is
8194
.
c
is a bloombergBPIPE
object.
authtype = 'OS_LOGON'; appname = ''; ipaddress = {'111.11.11.112'}; port = 8194; c = bloombergBPIPE(authtype,appname,ipaddress,port);
Request portfolio data for a custom portfolio with portfolio identifier
U335877-1 Client
. Request data using all fields
f
. Filter the portfolio data by specifying the date
of November 3, 2014, using the override value
REFERENCE_DATE
equal to
20141103
.
p = 'U335877-1 Client'; f = {'PORTFOLIO_MEMBERS','PORTFOLIO_MPOSITION',... 'PORTFOLIO_MWEIGHT','PORTFOLIO_DATA'}; o = {'REFERENCE_DATE'}; ov = {'20141103'}; [d,plist] = portfolio(c,p,f,o,ov)
d = PORTFOLIO_MPOSITION: {{0x1 cell}} PORTFOLIO_MWEIGHT: {{0x1 cell}} PORTFOLIO_DATA: {{0x1 cell}} PORTFOLIO_MEMBERS: {{0x1 cell}} plist = 'U335877-1 Client'
d
is a structure that contains portfolio data. Each
structure field corresponds to data for each portfolio field.
plist
is a cell array that contains the portfolio
identifier.
Close the connection.
close(c)
Input Arguments
c
— Bloomberg B-PIPE connection
bloombergBPIPE
object
Bloomberg
B-PIPE connection, specified as a bloombergBPIPE
object.
p
— Portfolio
character vector | string scalar
Portfolio, specified as a character vector or string scalar. Specify the
portfolio by the ID that you can find in the upper-right corner of the
portfolio display page. Append the text ' Client'
(without quotes) to the ID. For example, if the ID is
U335877-1
, then specify 'U335877-1
Client'
.
Access the portfolio display page by using the PRTU<GO> option from the Bloomberg terminal. For details, see the Bloomberg API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.
Example: 'U335877-1 Client'
Data Types: char
| cell
| string
f
— Portfolio fields
'PORTFOLIO_DATA'
| 'PORTFOLIO_MEMBERS'
| 'PORTFOLIO_MPOSITION'
| 'PORTFOLIO_MWEIGHT'
Portfolio fields, specified as one of the preceding values for one field. To specify multiple fields, use a cell array of these values.
Bloomberg Field Name | Bloomberg Field Description |
---|---|
| Returns a list of the identifiers, positions, market values, cost, cost date, and cost foreign exchange rate of each security in a custom portfolio. |
| Returns a list of identifiers for the members of a custom portfolio. |
| Returns a list of identifiers and the position for each security in a custom portfolio. |
| Returns a list of identifiers and the percentage weight for each security in a custom portfolio. |
Data Types: char
| cell
o
— Bloomberg override field
character vector | string scalar | cell array of character vectors | string array
Bloomberg override field, specified as a character vector, string
scalar, cell array of character vectors, or string array. The Bloomberg value 'REFERENCE_DATE'
denotes returning
Bloomberg data for a specific date.
Data Types: char
| cell
| string
ov
— Bloomberg override field value
[]
(default) | character vector | string scalar | cell array of character vectors | string array
Bloomberg override field value, specified as a character vector, string scalar, cell array of character vectors, or string array. A character vector or string denotes one Bloomberg override field value. A cell array of character vectors or string array denotes multiple Bloomberg override field values. Use this field value to filter the Bloomberg data result set.
Example: '20100101'
Data Types: char
| cell
| string
Output Arguments
d
— Portfolio data
structure (default) | table
Portfolio data, returned as a structure or table. The data type of the portfolio data depends on the DataReturnFormat property of the connection object.
plist
— Portfolio list
cell array of character vectors
Portfolio list, returned as a cell array of character vectors for the
corresponding portfolio identifiers in p
. The contents
of plist
are identical in value and order to
p
.
Version History
Introduced in R2021a
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 (한국어)