Main Content

periodicreturns

Periodic total returns from total return prices

Description

example

TotalReturn = periodicreturns(TotalReturnPrices) calculates the daily total returns from a daily total return price series.

example

TotalReturn = periodicreturns(___,Period) specifies options using one or more optional arguments in addition to the input arguments in the previous syntax.

Examples

collapse all

Compute TotalReturn returned as a table using datetime input in a table for TotalReturnPrices.

Dates = datetime(2015,1,1:10)';
Prices = [100:10:190]';
TotalReturnPrices = table(Dates,Prices);
TotalReturn = periodicreturns(TotalReturnPrices)
TotalReturn=9×2 table
       Dates        Prices 
    ___________    ________

    02-Jan-2015         0.1
    03-Jan-2015    0.090909
    04-Jan-2015    0.083333
    05-Jan-2015    0.076923
    06-Jan-2015    0.071429
    07-Jan-2015    0.066667
    08-Jan-2015      0.0625
    09-Jan-2015    0.058824
    10-Jan-2015    0.055556

Input Arguments

collapse all

Total return prices for a given security, specified as an NUMOBS-by-NASSETS + 1 matrix where Column 1 contains MATLAB® serial date numbers. The remaining columns contain total return price data.

If you specify TotalReturnPrices as a table, the first column of the table represents the dates (as either a datetime array, string array, date character vectors, or serial date numbers) while the other columns represent the returns data. If a table is used, TotalReturn is returned as a table.

Note

Although input returns can have dates in either ascending or descending order, output total returns in TotalReturn have dates in ascending order, with the earliest date in the first row of TotalReturn, and the most recent date in the last row of TotalReturn.

Data Types: double | datetime | string | char | table

(Optional) Periodicity flag used to compute total returns, specified as one of the following values:

  • 'd' = daily values (default)

  • 'w' = weekly values

  • 'm' = monthly values

  • n = rolling return periodic values, where n is an integer

Data Types: char | double

Output Arguments

collapse all

Total return values, returned as a P-by-N matrix or table consisting of either Dates in column 1 and daily return values in the remaining columns or period-end dates in column 1 and monthly return values in the remaining columns. The format of TotalReturn matches the format of the input TotalReturnPrices.

Version History

Introduced before R2006a