11 Group 10
Managers: Barbara Giarrante, Julia Dzura and Luiza Meneghin
11.1 The setup
<- c("ABEV3.SA", "ARZZ3.SA" , "BPAC11.SA" , "IGTI11.SA" , "RDOR3.SA" , "VALE3.SA" , "VBBR3.SA" , "WEGE3.SA" )
p10_list <- c("0.0625000000","0.1250000000","0.1666666667","0.1666666667","0.1666666667","0.0625000000","0.1250000000","0.1250000000")
p10_w <- c("BRL","BRL","BRL","BRL","BRL","BRL","BRL","BRL" )
p10_exc <- cbind(p10_list, p10_w, p10_exc)
p10_wlist colnames(p10_wlist) <- c('ticker','weights','Currency')
#Download data Financial
<- yf_get(tickers = p10_list, first_date = start, last_date = end,freq_data = "daily",thresh_bad_data=0.5)
p10 <- p10[, c("ticker", "ref_date", "price_adjusted" ) ]
p10 <- merge(p10, p10_wlist , by = "ticker")
p10 # Download data Exchange rate
getFX("BRL/USD",from=start , to = end)
<- as.data.frame(BRLUSD)
exchanges $ref_date <- as.Date(rownames(exchanges))
exchanges# Merge
<- merge(p10, exchanges, by = "ref_date")
p10 $BRL.USD[p10$Currency == "USD"] <- 1
p10# Adjusting currency
$price_adj <- p10$price_adjusted * p10$BRL.USD
p10# Calculating return
<- p10 %>%
ret group_by(ticker) %>%
tq_transmute(select = price_adj,
mutate_fun = periodReturn,
period = "daily",
col_rename = "ret")
<- merge(p10, ret, by = c("ref_date", "ticker"))
p10 # Data tabulation
$ret_product <- p10$ret * as.numeric(p10$weights)
p10# Creating a df of portfolios return
<- p10 %>%
p10_ret group_by(ref_date) %>%
summarise_at(vars(ret_product),
list(p10_return = sum)) %>% as.data.frame()
#Calculating cumulative return per day
for(i in (1:nrow(p10_ret) ) ) {
$p10_cum[i] <- Return.cumulative(p10_ret$p10_return[1:i])
p10_ret
}#Calculating cumulative return total
<- data.frame(matrix(NA, nrow = 1,ncol = 4))
p10_sharpe colnames(p10_sharpe) <- c('p10_return', 'p10_sd', 'p10_rf' , 'p10_sharpe')
$p10_return <- Return.cumulative(p10_ret$p10_return)
p10_sharpe$p10_sd <- sd(p10_ret$p10_return[2:nrow(p10_ret)])
p10_sharpe$p10_rf <- (1+0.03)^(nrow(p10_ret)/252) -1
p10_sharpe$p10_sharpe <- (p10_sharpe$p10_return - p10_sharpe$p10_rf) / p10_sharpe$p10_sd p10_sharpe
11.2 The portfolio
This is the portfolio of this group:
p10_wlist
ticker weights Currency
[1,] "ABEV3.SA" "0.0625000000" "BRL"
[2,] "ARZZ3.SA" "0.1250000000" "BRL"
[3,] "BPAC11.SA" "0.1666666667" "BRL"
[4,] "IGTI11.SA" "0.1666666667" "BRL"
[5,] "RDOR3.SA" "0.1666666667" "BRL"
[6,] "VALE3.SA" "0.0625000000" "BRL"
[7,] "VBBR3.SA" "0.1250000000" "BRL"
[8,] "WEGE3.SA" "0.1250000000" "BRL"
Checking the sum of weights. The sum of weights is:
11.3 The performance
The current cumulative return of this Portfolio is 4.63 percent.
The current standard deviation of daily returns of this Portfolio is 2.77 percent.
The current Sharpe of this portfolio is 1.5795.
ggplot(p10_ret, aes(x= ref_date, y= p10_cum) ) + geom_line(color = "cornflowerblue", size = 1.25) +
labs(y = "Portfolio return",
x = "Time",
title = "Group 10: Barbara Giarrante, Julia Dzura and Luiza Meneghin") + theme_solarized()