I've downloaded adjusted closing prices from Yahoo using the quantmod
-package, and used that to create a portfolio consisting of 50% AAPL
- and 50% FB
-stocks.
When I plot the cumulative performance of my portfolio, I get a performance that is (suspiciously) high as it is above 100%:
library(ggplot2)
library(quantmod)
cmp <- "AAPL"
getSymbols(Symbols = cmp)
tail(AAPL$AAPL.Adjusted)
cmp <- "FB"
getSymbols(Symbols = cmp)
tail(FB$FB.Adjusted)
df <- data.frame("AAPL" = tail(AAPL$AAPL.Adjusted, 1000),
"FB" = tail(FB$FB.Adjusted, 1000))
for(i in 2:nrow(df)){
df$AAPL.Adjusted_prc[i] <- df$AAPL.Adjusted[i]/df$AAPL.Adjusted[i-1]-1
df$FB.Adjusted_prc[i] <- df$FB.Adjusted[i]/df$FB.Adjusted[i-1]-1
}
df <- df[-1,]
df$portfolio <- (df$AAPL.Adjusted_prc + df$FB.Adjusted_prc)*0.5
df$performance <- cumprod(df$portfolio+1)-1
df$idu <- as.Date(row.names(df))
ggplot(data = df, aes(x = idu, y = performance)) + geom_line()
A cumulative performance above 100% seems very unrealistic to me. This lead me to think that maybe it is necessary to adjust/scale the downloaded data from quantmod
before using it?