Volatility & Net Return Analysis

Column 1

Disney

Comcast

Fox News

Viacom

Column 2

Net Return

Adjusted Price

Dollar Volume & Summary

Column 1

Dollar Volume Distribution

Column 2

Analysis

In this analysis, we are looking at three metrics: security price volatility, average dollar volume, and daily return to determine which company we should invest in for short-term maximum profits.

First, volatility is a reflection of the degree to which price moves. A stock with a price that fluctuates wildly, hitting new highs and lows, or moves erratically is considered highly volatile. A stock that maintains a relatively stable price has low volatility.

That said, a highly volatile stock is inherently riskier, but that risk cuts both ways. When investing in a volatile security, the risk of success is increased just as much as the risk of failure. However, for short-term profits, we should choose one with relatively smaller price volatility, which, in this case, is Disney, Viacom, and Comcast.

Second, we will be looking at variable - volume. As a general rule of thumb, an average dollar volume of 20 million or greater provides pretty good liquidity for most traders. If you trade a very large account (and accordingly large position size), consider an average dollar-volume above 80 million to be extremely liquid. Therefore, based on the chart on the left, we can conclude that the stocks from both Disney and Comcast are the best options of all.

Lastly, what makes a security worthwhile investing in is whether it will profit its investors. As we can see from the charts in both “Net Return” and “Adjusted Price” tabs in the second column, Disney’s stock earnings are the highest, but it fluctuates a lot compared with the other three options. Viacom’s security doesn’t seem to be profitable as the loss happens more frequently than earning. On the other hand, Comcast and Fox News are relatively stable in terms of profitability.

Also, by looking at the adjusted price trend chart, we can see that Disney’s stock price was declining at the end of 2019, and that trend continues in 2020. Meanwhile, Comcast follows a very stable trend with a small uptick in early 2020.

Therefore, to maximize the profit, it is best, after considering these three metrics mentioned above, to invest in Comcast.

---
title: "Investment Option Analysis"
output:
  flexdashboard::flex_dashboard:
      social: menu
      source: embed
---

# Scenario {.sidebar}

Scenario: You are an investment specialist, who invests in and sells short-term securities, including commercial paper and commodities to meet short-term investment and financing needs for companies. Currently, your client, who is a comic fan, is considering buying stocks from one of these entertainment giants, including Disney, Viacom, Comcast, and FoxNews. The goal is to determine which one to invest in to make the most out of your money.

Description of The Data: the data was collected using the tq_get function, which will retrieve data from various web sources. The data collected are date, security prices (open, high, low, and close), volumes, and adjusted security prices for all four companies in 2019. Also, there is no missing value or outliners in the dataset.

To determine which stock to invest in, we will be looking at price volatility, daily net earnings, and average dollar volume of each company. 

```{r setup, include=FALSE}

install.packages("tidyquant")
library(tidyquant)
library(dplyr)
library(ggplot2)
options(scipen = 999)

```

# Volatility & Net Return Analysis {data-icon="fa-list"} 

## Column 1 {.tabset .tabset-fade}

### Disney

```{r}

DIS <- tq_get("DIS", get = "stock.prices", from = "2019-01-01", to = "2019-12-31")

DIS %>% ggplot(aes(x = date, y = close)) +
        geom_candlestick(aes(open = open, close = close, high = high, low = low)) + 
        geom_bbands(aes(high = high, low = low, close = close),
        ma_fun = SMA, n = 20, sd = 2, size = 1) + 
        labs(title = "Disney 2019 Stock Price Trend & Volatility",
        x = "Months (2019)", y = "Stock Closing Price")

```


### Comcast

```{r}

CMCSA <- tq_get("CMCSA", get = "stock.prices", from = "2019-01-01", to = "2019-12-31")

CMCSA %>% ggplot(aes(x = date, y = close)) +
        geom_candlestick(aes(open = open, close = close, high = high, low = low)) + 
        geom_bbands(aes(high = high, low = low, close = close),
        ma_fun = SMA, n = 20, sd = 2, size = 1) + 
        labs(title = "Comcast 2019 Stock Price Trend & Volatility",
        x = "Months (2019)", y = "Stock Closing Price")

```

### Fox News

```{r}

FOX <- tq_get("FOX", get = "stock.prices", from = "2019-01-01", to = "2019-12-31")

FOX %>% ggplot(aes(x = date, y = close)) +
        geom_candlestick(aes(open = open, close = close, high = high, low = low)) + 
        geom_bbands(aes(high = high, low = low, close = close),
        ma_fun = SMA, n = 20, sd = 2, size = 1) + 
        labs(title = "Fox News 2019 Stock Price Trend & Volatility",
        x = "Months (2019)", y = "Stock Closing Price")

```


### Viacom

```{r}

VIA <- tq_get("VIA", get = "stock.prices", from = "2019-01-01", to = "2019-12-31")

VIA %>% ggplot(aes(x = date, y = close)) +
        geom_candlestick(aes(open = open, close = close, high = high, low = low)) + 
        geom_bbands(aes(high = high, low = low, close = close),
        ma_fun = SMA, n = 20, sd = 2, size = 1) + 
        labs(title = "Viacom 2019 Stock Price Trend & Volatility",
        x = "Months (2019)", y = "Stock Closing Price")

```

## Column 2 {.tabset .tabset-fade}

### Net Return

```{r}

cols <- c("Disney" = "blue", "Viacom" = "red", "Fox News" = "orange", "Comcast" = "green")

DIS_diff<- rbind(c("0"), data.frame(diff(DIS$adjusted)))
DIS_net<- data.frame(cbind(DIS, DIS_diff))
names(DIS_net)[names(DIS_net)=="diff.DIS.adjusted."] <- "netearning"

FOX_diff<- rbind(c("0"), data.frame(diff(FOX$adjusted)))
FOX_net<- data.frame(cbind(FOX, FOX_diff))
names(FOX_net)[names(FOX_net)=="diff.FOX.adjusted."] <- "netearning"

VIA_diff<- rbind(c("0"), data.frame(diff(VIA$adjusted)))
VIA_net<- data.frame(cbind(VIA, VIA_diff))
names(VIA_net)[names(VIA_net)=="diff.VIA.adjusted."] <- "netearning"

CMCSA_diff<- rbind(c("0"), data.frame(diff(CMCSA$adjusted)))
CMCSA_net<- data.frame(cbind(CMCSA, CMCSA_diff))
names(CMCSA_net)[names(CMCSA_net)=="diff.CMCSA.adjusted."] <- "netearning"


DIS_net$netearning<- round(as.numeric(DIS_net$netearning), digits = 0)
FOX_net$netearning<- round(as.numeric(FOX_net$netearning), digits = 0)
VIA_net$netearning<- round(as.numeric(VIA_net$netearning), digits = 0)
CMCSA_net$netearning<- round(as.numeric(CMCSA_net$netearning), digits = 0)

ggplot() + geom_line(data = DIS_net, aes(x = date, y = netearning), color = "blue") + geom_line(data = FOX_net, aes(x = date, y = netearning), color = "orange") + geom_line(data = VIA_net, aes(x = date, y = netearning), color = "red") + geom_line(data = CMCSA_net, aes(x = date, y = netearning), color = "green") + ylim(-4, 4) + labs(title = "Net Earning & Loss by Day in 2019", subtitle = "Blue: Disney, Green: Comcast, Red: Viacom, Orange: Fox News", x = "Months (2019)", y = "Net Earning (Positive & Negative)")


```

### Adjusted Price

```{r}

ggplot() + geom_line(data = DIS, aes(x = date, y = adjusted), color = "blue") + geom_line(data = VIA, aes(x = date, y = adjusted), color = "red") + geom_line(data = FOX, aes(x = date, y = adjusted), color = "orange") + geom_line(data = CMCSA, aes(x = date, y = adjusted), color = "green") + labs(color = "Legend") + labs(title = "Adjusted Stock Price by Day in 2019", subtitle = "Blue: Disney, Green: Comcast, Red: Viacom, Orange: Fox News", x = "Months (2019)", y = "Adjusted Stock Price")

```

# Dollar Volume & Summary {data-icon="fa-map"}

## Column 1

### Dollar Volume Distribution

```{r}

cols <- c("Disney" = "blue", "Viacom" = "red", "Fox News" = "orange", "Comcast" = "green")

ggplot() + geom_line(data = DIS, aes(x = date, y = volume), color = "blue") + geom_line(data = VIA, aes(x = date, y = volume), color = "red") + geom_line(data = FOX, aes(x = date, y = volume), color = "orange") + geom_line(data = CMCSA, aes(x = date, y = volume), color = "green") + labs(color = "Legend") + labs(title = "Dollar Volume by Day in 2019", subtitle = "Blue: Disney, Green: Comcast, Red: Viacom, Orange: Fox News", x = "Months (2019)", y = "Stock Volume")

```

## Column 2

### Analysis

In this analysis, we are looking at three metrics: security price volatility, average dollar volume, and daily return to determine which company we should invest in for short-term maximum profits.

First, volatility is a reflection of the degree to which price moves. A stock with a price that fluctuates wildly, hitting new highs and lows, or moves erratically is considered highly volatile. A stock that maintains a relatively stable price has low volatility.

That said, a highly volatile stock is inherently riskier, but that risk cuts both ways. When investing in a volatile security, the risk of success is increased just as much as the risk of failure. However, for short-term profits, we should choose one with relatively smaller price volatility, which, in this case, is Disney, Viacom, and Comcast.

Second, we will be looking at variable - volume. As a general rule of thumb, an average dollar volume of 20 million or greater provides pretty good liquidity for most traders. If you trade a very large account (and accordingly large position size), consider an average dollar-volume above 80 million to be extremely liquid. Therefore, based on the chart on the left, we can conclude that the stocks from both Disney and Comcast are the best options of all. 

Lastly, what makes a security worthwhile investing in is whether it will profit its investors. As we can see from the charts in both "Net Return" and "Adjusted Price" tabs in the second column, Disney's stock earnings are the highest, but it fluctuates a lot compared with the other three options. Viacom's security doesn't seem to be profitable as the loss happens more frequently than earning. On the other hand, Comcast and Fox News are relatively stable in terms of profitability. 

Also, by looking at the adjusted price trend chart, we can see that Disney's stock price was declining at the end of 2019, and that trend continues in 2020. Meanwhile, Comcast follows a very stable trend with a small uptick in early 2020.

Therefore, to maximize the profit, it is best, after considering these three metrics mentioned above, to invest in Comcast.