periodicreturns
Periodic total returns from total return prices
Description
calculates the daily total returns from a daily total return price series. TotalReturn
= periodicreturns(TotalReturnPrices
)
specifies options using one or more optional arguments in addition to the input
arguments in the previous syntax. TotalReturn
= periodicreturns(___,Period
)
Examples
Compute TotalReturn Using datetime Input for TotalReturnPrices
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
TotalReturnPrices
— Total return prices for a given security
matrix | table
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
Period
— Periodicity flag used to compute total returns
'd'
(default) | character vector | numeric
(Optional) Periodicity flag used to compute total returns, specified as one of the following values:
'd'
= daily values (default)'w'
= weekly values'm'
= monthly valuesn = rolling return periodic values, where n is an integer
Data Types: char
| double
Output Arguments
TotalReturn
— Total return values
matrix | table
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
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)