12  Group 11

Managers: Benedita Coura, Isabella Adler, and Maria Luiza

12.1 The setup

p11_list  <- c("AMER3.SA", "RADLY" , "BEEF3.SA", "JBSS3.SA" , "VBBR3.SA" ,"MELI34.SA" , "AAPL" ,"CRFB3.SA", "DIS", "ITSA4.SA" , "QETH11.SA")
p11_w     <- c( "0.050",  "0.080" , "0.070" , "0.100" , "0.220" , "0.100" , "0.170" , "0.050" , "0.090" , "0.050" , "0.020" )
p11_exc   <- c("BRL", "USD","BRL","BRL","BRL","BRL","USD","BRL","USD")
p11_wlist <- cbind(p11_list, p11_w, p11_exc)
colnames(p11_wlist) <- c('ticker','weights','Currency')
#Download data Financial
p11 <- yf_get(tickers = p11_list, first_date = start, last_date = end,freq_data = "daily", thresh_bad_data = 0.5)
p11 <- p11[, c("ticker", "ref_date", "price_adjusted" ) ]
p11 <- merge(p11, p11_wlist , by = "ticker")
# Download data Exchange rate
getFX("BRL/USD",from=start , to = end) 
exchanges <- as.data.frame(BRLUSD)
exchanges$ref_date <- as.Date(rownames(exchanges))
# Merge
p11 <- merge(p11, exchanges, by = "ref_date")
p11$BRL.USD[p11$Currency == "USD"] <- 1
# Adjusting currency
p11$price_adj <- p11$price_adjusted * p11$BRL.USD
# Calculating return
ret <- p11 %>%
       group_by(ticker) %>%
       tq_transmute(select = price_adj,
                    mutate_fun = periodReturn,
                    period = "daily",
                    col_rename = "ret")
p11 <- merge(p11, ret, by = c("ref_date", "ticker"))
# Data tabulation
p11$ret_product <- p11$ret * as.numeric(p11$weights)

# Creating a df of portfolios return
p11_ret  <- p11 %>%                      
            group_by(ref_date) %>%
            summarise_at(vars(ret_product),
                         list(p11_return = sum)) %>% as.data.frame()
#Calculating cumulative return per day
for(i in (1:nrow(p11_ret) ) ) {
p11_ret$p11_cum[i] <- Return.cumulative(p11_ret$p11_return[1:i])
}
#Calculating cumulative return total
p11_sharpe <- data.frame(matrix(NA, nrow = 1,ncol = 4))
colnames(p11_sharpe) <- c('p11_return', 'p11_sd', 'p11_rf' , 'p11_sharpe')
p11_sharpe$p11_return <- Return.cumulative(p11_ret$p11_return)
p11_sharpe$p11_sd <- sd(p11_ret$p11_return[2:nrow(p11_ret)])
p11_sharpe$p11_rf <- (1+0.03)^(nrow(p11_ret)/252) -1
p11_sharpe$p11_sharpe <- (p11_sharpe$p11_return - p11_sharpe$p11_rf)  / p11_sharpe$p11_sd

12.2 The portfolio

This is the portfolio of this group:

      ticker      weights Currency
 [1,] "AMER3.SA"  "0.050" "BRL"   
 [2,] "RADLY"     "0.080" "USD"   
 [3,] "BEEF3.SA"  "0.070" "BRL"   
 [4,] "JBSS3.SA"  "0.100" "BRL"   
 [5,] "VBBR3.SA"  "0.220" "BRL"   
 [6,] "MELI34.SA" "0.100" "BRL"   
 [7,] "AAPL"      "0.170" "USD"   
 [8,] "CRFB3.SA"  "0.050" "BRL"   
 [9,] "DIS"       "0.090" "USD"   
[10,] "ITSA4.SA"  "0.050" "BRL"   
[11,] "QETH11.SA" "0.020" "USD"   

Checking the sum of weights. The sum of weights is:

12.2.1 The performance

The current cumulative return of this Portfolio is -2.17 percent.

The current standard deviation of daily returns of this Portfolio is 2.29 percent.

The current Sharpe of this portfolio is -1.0584.

ggplot(p11_ret, aes(x= ref_date, y= p11_cum) ) +  geom_line(color = "aquamarine", size = 1.25) +
  labs(y = "Portfolio return", 
       x = "Time",
       title = "Group 11: Benedita Coura, Isabella Adler, and Maria Luiza") + theme_solarized()