returns {fSeries}R Documentation

Calculations of Financial Returns

Description

Functions to calculate financial returns.

Usage

returns(x, ...)

## Default S3 method:
returns(x, method = c("continuous", "discrete", "compound", "simple"), 
    percentage = FALSE, ...)
## S3 method for class 'timeSeries':
returns(x, method = c("continuous", "discrete", "compound", "simple"), 
    percentage = FALSE, na.rm = TRUE, trim = TRUE, ...)
## S3 method for class 'zoo':
returns(x, method = c("continuous", "discrete", "compound", "simple"), 
    percentage = FALSE, na.rm = TRUE, trim = TRUE, ...)
    
getReturns(...)
returnSeries(...)

Arguments

percentage a logical value. By default FALSE, if TRUE the series will be expressed in percentage changes.
method ...
na.rm ...
trim ...
x an object of class timeSeries.
... arguments to be passed.

Value

all functions return an object of class timeSeries.

Note

The functions returnSeries, getReturns, are synonymes for returns.timeSeries.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## data -  
   # Microsoft Data: 
   myFinCenter <<- "GMT"
   MSFT = as.timeSeries(data(msft.dat))[1:10, 1:4]
   head(MSFT)

## returnSeries -  
   # Continuous Returns:
   returns(MSFT)
   # Discrete Returns:
   returns(MSFT, type = "discrete")
   # Don't trim:
   returns(MSFT, trim = FALSE)
   # Use Percentage Values:
   returns(MSFT, percentage = TRUE, trim = FALSE)

[Package fSeries version 260.73 Index]