Learn R Programming

timeSeries (version 280.75)

cumulated: Cumulated Time Series from Returns

Description

Compute cumulated financial series, e.g. prices or indexes, from financial returns.

Usage

cumulated(x, ...)

## S3 method for class 'default': cumulated(x, method = c("continuous", "discrete", "compound", "simple"), percentage = FALSE, ...)

Arguments

method
a character string naming the method how the returns were computed.
percentage
a logical value. By default FALSE, if TRUE the series will be expressed in percentage changes.
x
an object of class timeSeries.
...
arguments to be passed.

Value

  • all functions return a time series object of the same class as the input argument x.

Examples

Run this code
## data -  
   # Microsoft Data:
   setRmetricsOptions(myFinCenter = "GMT")
   MSFT = as.timeSeries(data(msft.dat))[1:10, "Close"]
   MSFT

## cumulated -  
   # Index series to 100:
   MSFT = 100 * MSFT/as.numeric(MSFT[1,1])
   MSFT
   MSFT.RET = returns(MSFT, method = "discrete")
   cumulated(MSFT.RET, method = "discrete")

Run the code above in your browser using DataLab