This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

periodicreturns

Periodic total returns from total return prices

Syntax

TotalReturn = periodicreturns(TotalReturnPrices)
TotalReturn = periodicreturns(___,Period)

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,'Locale','en_US')';
Prices = [0.01 0.03 0.1  -0.05  0.02 0.07 0.03 -0.01 -0.02 0.01]';
TotalReturnPrices = table(Dates,Prices);
TotalReturn = periodicreturns(TotalReturnPrices)
TotalReturn=9×2 table
       Dates        Prices 
    ___________    ________

    02-Jan-2015           2
    03-Jan-2015      2.3333
    04-Jan-2015        -1.5
    05-Jan-2015        -1.4
    06-Jan-2015         2.5
    07-Jan-2015    -0.57143
    08-Jan-2015     -1.3333
    09-Jan-2015           1
    10-Jan-2015        -1.5

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 serial date numbers, date character vectors, or datetime arrays) 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 | 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.

Introduced before R2006a