# Documentation

### This is machine translation

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

# periodicreturns

Periodic total returns from total return prices

## Syntax

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

## Arguments

`TotalReturnPrices`

`TotalReturnPrices` can be the number of observations (`NUMOBS`) by number of assets (```NASSETS + 1```) matrix of total return prices for a given security. Column 1 contains MATLAB® serial date numbers. The remaining columns contain total return price data. In addition, `TotalReturnPrices` can also be a table where 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.

`Period`

(Optional) Periodicity flag used to compute total returns:

 `'d'` = daily values (default) `'w'` = weekly values `'m'` = monthly values n = rolling return periodic values, where n is an integer

## Description

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

`TotalReturn = periodicreturns(TotalReturnPrices,Period)` calculates the total returns for a periodicity that you specify from a daily total return price series.

If `TotalReturnPrices` input is a matrix, `TotalReturn` is a `NUMOBS`-by-`NASSETS + 1` matrix containing month-end dates and return values. Each row represents an observation. Column 1 contains month-end dates in MATLAB serial date number format. The remaining columns contain monthly return values.

### 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 `TotalReturn`, and the most recent date in the last row of `TotalReturn`.

If `TotalReturnPrices` input is a table where 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, `TotalReturn` is returned as a table.

## 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=9x2 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 ```