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%:


cmp <- "AAPL"
getSymbols(Symbols = cmp)

cmp <- "FB"
getSymbols(Symbols = cmp)

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()

enter image description here

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?


Have you checked the performance of the particular stocks?


cmp <- "AAPL"
aapl <- getSymbols(Symbols = cmp, auto.assign = FALSE)$AAPL.Adjusted

cmp <- "FB"
fb <- getSymbols(Symbols = cmp, auto.assign = FALSE)$FB.Adjusted

returns(window(merge(aapl, fb), start = as.Date("2015-1-1")),
        period = "itd")
## AAPL.Adjusted:  73.2%  [02 Jan 2015 -- 04 Mar 2019]
##   FB.Adjusted: 113.3%  [02 Jan 2015 -- 04 Mar 2019] 

So this seems quite realistic (and you may verify this performance via other sources as well). However, you should properly merge the time-series on their timestamps. Also, the portfolio performance you compute assumes that you rebalance to equal weights every period (i.e. day).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.