[R-SIG-Finance] [R-sig-finance] n-period return
ehxpieterse
eduard.pieterse at macquarie.com
Mon Aug 3 17:55:39 CEST 2009
Thanks Jeff,
I'm not too clear on how to use the GetSeries data type, after using diff().
getSymbols("^GSPC", src="yahoo")
CloseData <- Cl(GSPC)
Delta <- diff(CloseData, lag=1)
for (i in 3:length(Delta)) {
if (Delta[i]>Delta[i-1]) sum <- sum + Delta
}
It seems if the variables have no length? Is this something specific to the
way getSymbols create objects?
--
View this message in context: http://www.nabble.com/n-period-return-tp24788735p24793238.html
Sent from the Rmetrics mailing list archive at Nabble.com.
More information about the R-SIG-Finance
mailing list