Describe your topic.

Hint: What is the assignment? What class is this assignment from? Who is the instructor? If it’s not a class assignment, describe your research topic.

The topic we chose is from Professor Bradbury’s Financial Management course. The assignment is exploring a company’s stock performance and comparing stock performance considering both returns and risk.

Perform analysis

#1 Calculate the stock prices

# Load packages  
library(tidyquant)
library(tidyverse)

from <- today() - years(5)
stock_prices <- c("^GSPC", "TGT") %>%
    tq_get(get  = "stock.prices",
           from = from)
stock_prices
## # A tibble: 2,516 x 8
##    symbol date        open  high   low close     volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>      <dbl>    <dbl>
##  1 ^GSPC  2014-12-05 2073. 2079. 2071. 2075. 3419620000    2075.
##  2 ^GSPC  2014-12-08 2075. 2076. 2054. 2060. 3800990000    2060.
##  3 ^GSPC  2014-12-09 2057. 2061. 2034. 2060. 3970150000    2060.
##  4 ^GSPC  2014-12-10 2059. 2059. 2024. 2026. 4114440000    2026.
##  5 ^GSPC  2014-12-11 2028. 2056. 2028. 2035. 3917950000    2035.
##  6 ^GSPC  2014-12-12 2030. 2032. 2002. 2002. 4157650000    2002.
##  7 ^GSPC  2014-12-15 2005. 2019. 1982. 1990. 4361990000    1990.
##  8 ^GSPC  2014-12-16 1987. 2017. 1973. 1973. 4958680000    1973.
##  9 ^GSPC  2014-12-17 1974. 2017. 1974. 2013. 4942370000    2013.
## 10 ^GSPC  2014-12-18 2019. 2061. 2019. 2061. 4703380000    2061.
## # … with 2,506 more rows

#2 Calculate yearly returns

stock_returns_yearly <- stock_prices %>%
    group_by(symbol) %>%
    tq_transmute(select     = adjusted,
                 mutate_fun = periodReturn,
                 period     = "yearly",
                 col_rename = "Ra")
stock_returns_yearly
## # A tibble: 12 x 3
## # Groups:   symbol [2]
##    symbol date             Ra
##    <chr>  <date>        <dbl>
##  1 ^GSPC  2014-12-31 -0.00794
##  2 ^GSPC  2015-12-31 -0.00727
##  3 ^GSPC  2016-12-30  0.0954 
##  4 ^GSPC  2017-12-29  0.194  
##  5 ^GSPC  2018-12-31 -0.0624 
##  6 ^GSPC  2019-12-04  0.242  
##  7 TGT    2014-12-31  0.0305 
##  8 TGT    2015-12-31 -0.0160 
##  9 TGT    2016-12-30  0.0274 
## 10 TGT    2017-12-29 -0.0584 
## 11 TGT    2018-12-31  0.0467 
## 12 TGT    2019-12-04  0.944

# Baseline Period Returns
baseline_returns_yearly <- "^GSPC" %>%
    tq_get(get  = "stock.prices",
           from = today() - years(5)) %>%
    tq_transmute(select     = adjusted,
                 mutate_fun = periodReturn,
                 period     = "yearly",
                 col_rename = "Rb")
baseline_returns_yearly
## # A tibble: 6 x 2
##   date             Rb
##   <date>        <dbl>
## 1 2014-12-31 -0.00794
## 2 2015-12-31 -0.00727
## 3 2016-12-30  0.0954 
## 4 2017-12-29  0.194  
## 5 2018-12-31 -0.0624 
## 6 2019-12-04  0.242
stock_prices %>%
  group_by(symbol)%>%
  mutate(close_index = close / close[1])%>%
  ungroup() %>% 
  ggplot(aes(date, close_index, col = symbol)) +
  geom_line()

# Compute standard deviation
stock_returns_yearly %>%
    tq_performance(Ra = Ra,
                   Rb = NULL, # Calculataing downside risk measures doesn't require Rb
                   performance_fun = sd)
## # A tibble: 2 x 2
## # Groups:   symbol [2]
##   symbol  sd.1
##   <chr>  <dbl>
## 1 ^GSPC  0.122
## 2 TGT    0.385

# See options for the `performance_fun` argument
#tq_performance_fun_options()
# Retrieve performance metrics
stock_returns_yearly %>%
    tq_performance(Ra = Ra,
                   Rb = NULL, # Calculataing downside risk measures doesn't require Rb
                   performance_fun = SharpeRatio, p=.99, Rf=.02)
## # A tibble: 2 x 4
## # Groups:   symbol [2]
##   symbol `ESSharpe(Rf=2%,p=99… `StdDevSharpe(Rf=2%,p=… `VaRSharpe(Rf=2%,p=…
##   <chr>                  <dbl>                   <dbl>                <dbl>
## 1 ^GSPC                  0.107                   0.454                0.473
## 2 TGT                    0.142                   0.370               NA

Share interesting stories you found from the data

Hint: Make it an interesting story possibly by making connections with current news articles.

Target suffered their biggest price drop in active trade in March 2017 due to “rapidly changing” consumer behavior. The stock went down $8.14, or 12.2% in one day which is the lowest price seen since 2014. It was the 5th biggest one-day percentage drop in target history. CEO Brian Cornell spoke on the issue saying, “Our fourth-quarter results reflect the impact of rapidly-changing consumer behavior, which drove very strong digital growth but unexpected softness in our stores,” said Chief Executive Brian Cornell. “While the transition to this new model will present headwinds to our sales and profit performance in the short term, we are confident that these changes will best-position Target for continued success over the long term.” Target then invested $1 billion in operating margins in 2017 to make prices competitive and revamp more than 100 stores. They planned on investing $7 billion over the next three years, update more than 600 stores and introduce over 12 new brands in the next two years.

According to the data, Target dropped tremendosouly in 2017 and 2019. However, this finished on top during 2020 with ^GSPC during 2019-12-04 they have a close index of 1.4998578 where as Target ended in 2020 with 1.6904696 on 2019-12-04. Target had a better standard deviation as well with a 38.5% yearly while S&P 500 have a standard deviation of 12.2% yearly. Targets sharpe ratio is also on top with 14.2% yearly while S&P 500 have a sharpe ratio of 10.7% yearly. ## Hide the messages, but display the code and its results on the webpage.

List names of all group members (both first and last name) at the top of the webpage.

Use the correct slug.