Documentation

totalreturnprice

Total return price time series

Syntax

Return = totalreturnprice(Price, Action, Dividend)

Arguments

Price

Price can be a table or a NUMOBS)-by-2 matrix. If Price is a table, the dates can either be serial date numbers, date character vectors. If Price is a number of observations (NUMOBS)-by-2 matrix of price data, column 1 contains MATLAB® serial date numbers and column 2 contains price values.

Action

Action can be a table or a NUMOBS)-by-2 matrix. If Action is a table, the dates can either be serial date numbers, date character vectors. If Action is a NUMOBS-by-2 matrix of price data, column 1 contains MATLAB serial date numbers and column 2 contains split ratios.

Dividend

Dividend can be a table or a NUMOBS)-by-2 matrix. If Dvidend is a table, the dates can either be serial date numbers, date character vectors. If Dividend is a NUMOBS-by-2 matrix of price data, column 1 contains MATLAB serial date numbers and column 2 contains dividend payouts.

The number of observations (NUMOBS) for the three input arguments differ from each other.

Description

Return = totalreturnprice(Price, Action, Dividend) generates a total return price time series given price data, action or split data, and dividend data.

If all three inputs are matrices, then Return is a NUMOBS-by-2 array of price data, where NUMOBS reflects the number of observations of price data. Column 1 contains MATLAB serial date numbers. Column 2 contains total return price values.

However, if any inputs are tables, then Return will also be a table. The class of the first column depends on the classes used in the input tables. If any tables used datetimes for dates, then Returns will have datetimes in the first column. If there were no datetimes in the inputs, but if any inputs used date character vectors, then Returns will use date character vectors in the first column. For any other case, serial date numbers are used.

Examples

collapse all

Compute Return Using datetime Input for Price and Action

Compute Return returned as a table using datetime input in tables for Price and Action.

act = [732313, 2; 732314 ,2];
div = [732313, 0.0800; 732314, 0.0800];
prc = [732313, 12; 732314, 13];

prcTableDateTime=table(datetime(prc(:,1),'ConvertFrom','datenum'),prc(:,2));
acttableString=table(datestr(act(:,1)),act(:,2));
divTableNum = array2table(div);
Return = totalreturnprice(prcTableDateTime,acttableString,divTableNum)
Return = 

       Date        Return
    ___________    ______

    01-Jan-2005         1
    02-Jan-2005    1.0833

Related Examples

Introduced before R2006a

Was this topic helpful?