Description Usage Arguments Value Author(s) Examples
View source: R/pub01_utilityFuncs.R
get the summary infomation of the rtn series,including Annualized Return,Annualized Std Dev,Annualized Sharpe,HitRatio,Worst Drawdown
1 2 | rtn.summary(rtn, hitFreq = "day", Rf = 0, freq = NULL, from = NULL,
to = NULL, formula = "period+asset~var")
|
rtn |
an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns |
hitFreq, indicating |
the interval when computing the hitRatio of rtn. An interval specification, one of "day", "week", "month", "quarter" and "year", optionally preceded by an integer and a space, or followed by "s".See |
Rf |
risk free rate, in same period as your returns |
freq |
NULL or an interval specification. |
formula |
a charactor string of formula. eg. "period+asset~var". only used when |
a matrix if freq is null or rtn is single asset, else a dataframe.
Ruifei.Yin
1 2 3 4 5 6 7 8 9 | rtn.long <- zoo(rnorm(1000,0.001,0.02),as.Date("2010-01-01")+1:1000)
rtn.short <- rtn.long + rnorm(1000,-0.001,0.003)
rtn <- merge(rtn.long,rtn.short)
rtn.summary(rtn)
rtn.summary(rtn.long)
rtn.summary(rtn.long,freq="year")
rtn.summary(rtn,freq="year")
rtn.summary(rtn,freq="year",formula="asset+period~var")
rtn.summary(rtn,from=c("2010-02-03","2010-03-04"),to=c("2011-03-09","2011-03-30"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.