[This article was first published on Copula, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
If you would have invested in 1992 in the DAX ETF – provided it would have been around, of course – you would have earned a decent amount of money.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
That’s the story of the passive guys and in my previous post I’m borrowing a few arguments of this guys to support Buy & Hold.
I’m sure you know the problem, when you wish to backtest a new strategy over a long period and you don’t have enough observations available.
My Bond – Data Proxy is usually Pimco Total Return (PTTRX) and if you believe Bonds are boring read more.
Let’s first get Yahoo Data
library(quantmod)
library(PerformanceAnalytics)
library(TTR)
tickers=c(“^GDAXI”,”PTTRX”)
initDate=”1992-01-01″
to = “2014-11-30”
ticker=tickers
#————————————————-
suppressWarnings(try(getSymbols(ticker, index.class=”POSIXct”, from=initDate, to=to,src=”yahoo”),silent=TRUE))
Next let’s get the daily Returns
dax=ROC(GDAXI[,6],n=1,na.pad=T)
bonds=ROC(PTTRX[,6],n=1,na.pad=T)
Now, this might hold the first surpise
Return.annualized(dax) GDAXI.Adjusted Annualized Return 0.05474645 Return.annualized(renten) PTTRX.Adjusted Annualized Return 0.06626953 Are bonds still boring? Read on portf=cbind(dax,renten) table.CalendarReturns(portf, digits = 1, as.perc = TRUE, geometric = TRUE) Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec GDAXI.Adjusted PTTRX.Adjusted 1992 0.4 -0.3 0.4 -0.1 0.5 -0.3 -0.5 1.6 -0.7 -0.1 1.4 0.2 2.6 6.9 1993 0.3 1.5 -0.1 0.2 -0.2 -0.6 -1.7 1.2 0.4 1.5 0.7 2.3 5.7 5.0 1994 2.0 0.8 -0.7 -0.2 0.4 -1.0 1.1 0.1 -1.6 1.5 0.2 1.4 4.1 6.0 1995 -0.7 0.1 0.2 -0.5 0.2 -1.1 -0.5 -0.1 0.7 1.0 -0.1 -1.0 -1.7 9.3 1996 1.4 0.0 -0.9 0.0 0.6 0.4 0.6 -0.6 -0.3 -0.7 1.0 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0 3.9 4.0 2013 -0.5 0.9 0.1 0.5 -0.6 -0.4 0.1 -1.1 -0.8 0.3 0.2 -0.4 -1.8 1.7 2014 -0.7 1.1 -0.3 0.2 0.0 0.2 -2.0 0.1 0.5 2.3 0.1 NA 1.4 2.2 maxDrawdown(dax) [1] 0.7669261 maxDrawdown(renten) [1] 0.1053507 Revealing, isn't it.
To leave a comment for the author, please follow the link and comment on their blog: Copula.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.