Returns: Returns

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/pub01_utilityFuncs.R

Description

Compute financial returns from prices or indexes.

Usage

1
Returns(prices, geometric = TRUE, na.rm = TRUE, trim = TRUE)

Arguments

prices

price or index series, an object of class timeSeries,zoo or xts

geometric

use geometric (TRUE) or simple (FALSE) returns, default TRUE

na.rm

a logical value. Should NAs be removed? By Default TRUE.

trim

a logical value. Should the time series be trimmed? By Default TRUE.

Details

This is a wrapped function of function returns in package timeSeries which is used for timeSeries objects

Value

the returns series of the same class of prices

Author(s)

Ruifei.Yin

See Also

WealthIndex,returns

Examples

1
2
3
4
5
rtn.long <- zoo(rnorm(100,0.001,0.02),as.Date("2010-01-01")+1:100)
rtn.short <- rtn.long + rnorm(100,-0.001,0.003)
rtn <- merge(rtn.long,rtn.short)
prices <- WealthIndex(rtn)
rtn2 <- Returns(prices,trim=FALSE) # Is rtn2 the same as rtn?

raphael210/QUtility documentation built on May 26, 2019, 11:05 p.m.