Documentation Center

  • Trial Software
  • Product Updates


Portfolio matrix with total return price data from Yahoo!


X = builduniverse(y,s,d1,d2,p)


X = builduniverse(y,s,d1,d2,p) builds a portfolio matrix using Yahoo!® data to compute a total return price series. X is an m-by-(n + 1) matrix, where m refers to the number of records of data and n refers to the number of securities. Column 1 of the matrix contains MATLAB® date numbers and the remaining columns are the total return prices for each security. y is the Yahoo! connection handle, s is a cell array of security identifiers, d1 and d2 are the start and end dates for the data request, and p is the periodicity flag. p can be entered as:

  • 'd' for daily values

  • 'w' for weekly values

  • 'm' for monthly values


Compute a total return price series and convert to daily total returns:

y = yahoo;
% Load security list.  
s = {'A', 'B', 'C'};

% Get a daily total return price series for securities.
% (Calculated from prices, splits and dividends.)
Universe = builduniverse(y,s,'1/15/2007',floor(now));

% Convert to daily total returns.
Universe = periodicreturns(Universe,'d');

More About

expand all


  • Data providers report price, action, and dividend data differently. Verify that the data returned by the builduniverse function contains the expected results.

See Also


Was this topic helpful?