totalreturnprice

Total return price time series

Description

example

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

Examples

collapse all

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=2×2 table
            Date            Return
    ____________________    ______

    01-Jan-2005 00:00:00         1
    02-Jan-2005 00:00:00    1.0833

Input Arguments

collapse all

Price of security, specified as a table or an NUMOBS-by-2 matrix. If Price is a table, the dates can either be serial date numbers, date character vectors, or datetime arrays. If Price is an NUMOBS-by-2 matrix of price data, column 1 contains MATLAB® serial date numbers and column 2 contains price values.

Data Types: double | table

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

Data Types: double | table

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

Data Types: double | table

Output Arguments

collapse all

Total return price time series, returned as a NUMOBS-by-2 matrix (if all inputs are matrices) or table (if any inputs are tables) of price data, where column 1 is dates and column 2 is total return price values. Dates in column 1 are in datetime format if any inputs specify dates in datetime format. Dates in column 1 are in date character vector format if no inputs specify dates in datetime format, but any of them use date character vector format. Otherwise, dates in column 1 are specified as serial date numbers.

Introduced before R2006a