rtn.periods: rtn.periods

Description Usage Arguments Value Author(s) See Also Examples

View source: R/pub01_utilityFuncs.R

Description

get a return of different periods of the rtn series(including overall cumulative and annualized return).

Usage

1
rtn.periods(rtn, freq = "year", from, to)

Arguments

rtn

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

freq

An interval specification, one of "day", "week", "month", "quarter" and "year", optionally preceded by an integer and a space, or followed by "s".See cut.Date for detail.

from

starting dates, a vector of class Date,timeDate or character.See fapply for detail.

to

ending dates a vector of class Date,timeDate or character.See fapply for detail.

Value

a matrix

Author(s)

Ruifei.Yin

See Also

fapply

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)
rtn.periods(rtn,"month")
rtn.periods(rtn,from=c("2010-02-03","2010-03-04"),to=c("2010-03-09","2010-03-30"))

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