Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

portfolio

Current portfolio data for Bloomberg connection V3

Syntax

d = portfolio(c,p,f)
d = portfolio(c,p,f,o,ov)
[d,plist] = portfolio(___)

Description

example

d = portfolio(c,p,f) returns current portfolio data for the fields f in the portfolio p using the Bloomberg® connection c.

example

d = portfolio(c,p,f,o,ov) returns current portfolio data using override field o and override value ov.

example

[d,plist] = portfolio(___) additionally returns the portfolio list plist using any of the input arguments in the previous syntaxes.

Examples

collapse all

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server using blpsrv or Bloomberg B-PIPE® using bpipe.

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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server using blpsrv or Bloomberg B-PIPE using bpipe.

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

collapse all

Bloomberg connection, specified as a connection object created using blp, blpsrv, or bpipe.

Portfolio list, specified as a character vector or string scalar for one portfolio or a cell array of character vectors or string array for multiple portfolios. Specify the portfolio by the portfolio identifier that you can find in the upper-right corner of the settings tab on the portfolio page. Access the portfolio 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.

Data Types: char | cell | string

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

'PORTFOLIO_DATA'

Returns a list of the identifiers, positions, market values, cost, cost date, and cost foreign exchange rate of each security in a custom portfolio.

'PORTFOLIO_MEMBERS'

Returns a list of identifiers for the members of a custom portfolio.

'PORTFOLIO_MPOSITION'

Returns a list of identifiers and the position for each security in a custom portfolio.

'PORTFOLIO_MWEIGHT'

Returns a list of identifiers and the percentage weight for each security in a custom portfolio.

Data Types: char | cell

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

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

collapse all

Bloomberg return data, returned as a structure with the Bloomberg data. For details about the returned data, see the Bloomberg API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.

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.

Introduced in R2015b

Was this topic helpful?