Introduction

Row

Overview

Due to the inherent growth in the electronic production and storage of information, there is often a feeling of “information overload” or inundation when facing the process of quantitative decision making.

As an analyst your job will often be to conduct analyses or create tools to support quantitative decision making.

A principle tool used in industry, government, non-profits, and academic fields to compensate for the information overload is the information dashboard.

Functionally, a dashboard is meant to provide a user with a central resource to present in a clear and concise manner all the information necessary to support day-to-day decision making and support operations.

Row

Objective

The objective of this laboratory is to plan, design, and create an information dashboard to support quantitative decision making. To accomplish this task, you will have to complete a number of steps:

1.Delineate the necessary decision (I will do that below).

2.Identify what information will be relevant to decision making.

3.Find and collect the data necessary to create your visualization plan.

4.Organize and summarize the collected data.

5.Design and create the best visualizations to present that information.

6.Finally organize the layout of those visualizations in a way that conforms to the theory of dashboarding.

7.Write a summary about what decisions you made based on the visualizations that you developed.

The Decision & Rules

You make investments for an organization; your objective is to purchase securities/commodities for the key objective of maximizing profits.

You want to make an investment in securities/commodities to make some short-term gains.

You are considering investing in one of any four companies, for example: Twitter (TWTR), Microsoft (MSFT), or Apple (AAPL) (don’t use these).

Choose 4 companies or commodities and determine which one of the four will produce the most short-term gains. Use your imagination.

Metrics & Key Indicators

Row

Key Indicator Analysis

Daily Trend & Facet Chart

Column

Overall Daily Trend

Column

Facet Chart

Candlestick Chart

Column

Apple

[1] "AAPL"

Microsoft

[1] "MSFT"

Google

[1] "GOOGL"

Tesla

[1] "TSLA"

Conclusion

Row

Key Indicators Analysis

By analyzing key indicators such as “P/E Ratio”, “Price/EPS Estimate Next Year”, “Dividend Yield” and “Market Capitalization” to compare four different companies’ (Apple, Microsoft, Google and Tesla) performance from Jan 1, 2020 to March 27th, 2022, we can see:

  • P-E Ratio - TSLA has the highest P-E Ratio (52.4), which means that investors are expecting higher earnings growth in the future, then followed by MSFT (30.5), APPL (26.7) and GOOGL (22.8).

  • EPS - According to EPS, TSLA is also the highest one with 34.5, which indicates how much money a company makes for each share of its stock, MSFT (25.6), APPL (23.9) and GOOGL (16.5).

  • Dividend Yield -Google and Tesla dont offer dividends. Based on dividend yield, MSFT has the highest (0.9%), followed by APPL (0.5%) which indicates though MSFT is advantageous in P-E Ratio and EPS as compared to APPL, its high Dividend yield is good for investors to gain dividends.

  • Market Cap - From the market capitalization perspective, APPL has the highest cap, followed by MSFT, GOOGL and TSLA. Overall, from the key indicators, MSFT and APPL are better companies to invest in among others, then TSLA, CVS and GOOGL.

---
title: "ANLY 512: Lab 1: Finance Dashboard Laboratory "
author: "Mithil Kashyap Vyas"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    social: menu
    source: embed
    html_document:
    df_print: paged
    pdf_document: default
---
```{r}
library(quantmod)
library(flexdashboard)
library(plyr)
library(DT)
library(ipred)
library(dplyr)
library(highcharter)
library(viridisLite)
library(ggplot2)
library(broom)
library(xts)
library(zoo)
library(dygraphs)
library(lubridate)
```

# **Introduction**

## Table of Contents {.sidebar}

**Table of Contents:**

* Introduction
  
* Metrics & Key Indicators                          
  
* Daily Trend & Facet Chart

* Candlestick Chart

* Conclusion

Row {data-height=230}
-----------------------------------------------------------------------
    
### **Overview** 
Due to the inherent growth in the electronic production and storage of information, there is often a feeling of “information overload” or inundation when facing the process of quantitative decision making. 

As an analyst your job will often be to conduct analyses or create tools to support quantitative decision making.

A principle tool used in industry, government, non-profits, and academic fields to compensate for the information overload is the information dashboard. 

Functionally, a dashboard is meant to provide a user with a central resource to present in a clear and concise manner all the information necessary to support day-to-day decision making and support operations.

Row
-----------------------------------------------------------------------
    
### **Objective** 

The objective of this laboratory is to plan, design, and create an information dashboard to support quantitative decision making. To accomplish this task, you will have to complete a number of steps:

1.Delineate the necessary decision (I will do that below).

2.Identify what information will be relevant to decision making.

3.Find and collect the data necessary to create your visualization plan.

4.Organize and summarize the collected data.

5.Design and create the best visualizations to present that information.

6.Finally organize the layout of those visualizations in a way that conforms to the theory of dashboarding.

7.Write a summary about what decisions you made based on the visualizations that you developed.

### **The Decision & Rules**

You make investments for an organization; your objective is to purchase securities/commodities for the key objective of maximizing profits. 

You want to make an investment in securities/commodities to make some short-term gains. 

You are considering investing in one of any four companies, for example: Twitter (TWTR), Microsoft (MSFT), or Apple (AAPL) (don’t use these). 

Choose 4 companies or commodities and determine which one of the four will produce the most short-term gains. Use your imagination.

# **Metrics & Key Indicators**

## Metrics {.sidebar}

**Financial Indicators/Metrics:**

+ `r kableExtra::text_spec("**P-E Ratio**", color = "#5c5c5c")` - It is the ratio of a company's share price to the company's earnings per share. This ratio is used for valuing companies and to find out whether they are overvalued or undervalued.

+ `r kableExtra::text_spec("**EPS**", color = "#5c5c5c")` - It is the portion of a company's profit that is allocated to every individual share of the stock and helps in understanding the financial strength of a company

+ `r kableExtra::text_spec("**Dividend Yield Ratio**", color = "#5c5c5c")` - is a financial ratio that shows how much a company pays out in dividends each year relative to its stock price.

+ `r kableExtra::text_spec("**Market Cap**", color = "#5c5c5c")` - the total value of a company's shares.

Row
-------------------------

### **Key Indicator Analysis**


```{r}
stk_metrics <- yahooQF(c("Price/Sales", 
                          "P/E Ratio",
                          "Price/EPS Estimate Next Year",
                          "PEG Ratio",
                          "Dividend Yield", 
                          "Market Capitalization"))

tickers <- c("AAPL", "MSFT", "GOOGL", "TSLA", "NVDA", "AMD", "AMZN", "META", "V", "MA")

metrics <- getQuote(paste(tickers, sep = ",", collapse = ";"), what = stk_metrics)
metrics <- data.frame(Symbol = tickers, metrics[,2:length(metrics)])
colnames(metrics) <- c("Symbol", "P-E Ratio", "EPS", "Dividend Yield Ratio", "Market Cap")
DT::datatable(metrics)

```



```{r}
start <- as.Date("2020-01-01") 
end <- as.Date("2023-03-27")

symbl = getSymbols(tickers, src = "yahoo", from = start, to = end)
stocks = as.xts(data.frame(A = AAPL[, "AAPL.Adjusted"], 
B = MSFT[, "MSFT.Adjusted"], C = GOOGL[, "GOOGL.Adjusted"], 
E = TSLA[,"TSLA.Adjusted"]))
```

# **Daily Trend & Facet Chart**

Column {data-width=500}
-----------------------------------------------------------------------

### Overall Daily Trend {data-width=500}

``` {r}
names(stocks) <- c("AAPL", "MSFT", "GOOGL", "TSLA")
index(stocks) <- as.Date(index(stocks))

dly_stk_adj <- tidy(stocks) %>% 
  
  ggplot(aes(x=index,y=value, color=series)) +
  labs(title = "Daily Stock Adjusted Prices Comparison",
       
       subtitle = "Among Apple, Microsoft, Google, Tesla",
       caption = " Source: Yahoo Finance",
       color = "Stock",
       x = "Date",
       y = "End of day Adjusted Price ($)") +
  scale_color_manual(values = c("Red", "Green", "DarkBlue","Orange"))+
  geom_line()

dly_stk_adj
```

Column {data-width=500}
-----------------------------------------------------------------------

### Facet Chart {data-width=500}

```{r}
dly_stk_adj2 = tidy(stocks) %>% 
  
  ggplot(aes(x=index,y=value, color=series)) + 
  geom_line() +
  facet_grid(series~.,scales = "free") + 
  labs(title = "Daily Stock Adjusted Prices Comparison",
       
       subtitle = "Among Apple, Microsoft, Google, Tesla",
       caption = " Source: Yahoo Finance",
       color = "Stock",
       x = "Date",
       y = "End of day Adjusted Price ($)") +
  scale_color_manual(values = c("Red", "Green", "DarkBlue","Orange"))
dly_stk_adj2
```

# **Candlestick Chart**

Column {.tabset data-width=600 .tabset-fade}
-----------------------------------------------------------------------



### Apple

```{r}
getSymbols("AAPL", src = "yahoo", from='2020-01-01')
AAPL_x <- AAPL
dygraph(AAPL_x[, -5], main = "Apple - Candlestick") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Daily Stock Closing Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(4, "Set1")) %>%
  dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 75)
```



### Microsoft

```{r}
getSymbols("MSFT", src = "yahoo", from='2020-01-01')
MSFT_x <- MSFT
dygraph(MSFT_x[, -5], main = "Microsoft - Candlestick") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Daily Stock Closing Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(4, "Set1")) %>%
  dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 75)
```



### Google

```{r}
getSymbols("GOOGL", src = "yahoo", from='2020-01-01')
GOOGL_x <- GOOGL
dygraph(GOOGL_x[, -5], main = "Google - Candlestick") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Daily Stock Closing Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(4, "Set1")) %>%
  dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 75)
```

### Tesla

```{r}
getSymbols("TSLA", src = "yahoo", from='2020-01-01')
TSLA_x <- TSLA
dygraph(TSLA_x[, -5], main = "Tesla - Candlestick") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Daily Stock Closing Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(4, "Set1")) %>%
  dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 75)
```

# **Conclusion**

Row
-------------------------

### **Key Indicators Analysis**
By analyzing key indicators such as “P/E Ratio”, “Price/EPS Estimate Next Year”, "Dividend Yield" and “Market Capitalization” to compare four different companies’ (Apple, Microsoft, Google and Tesla) performance from Jan 1, 2020 to March 27th, 2022, we can see:

+ `r kableExtra::text_spec("**P-E Ratio**", color = "#5c5c5c")` - TSLA has the highest P-E Ratio (52.4), which means that investors are expecting higher earnings growth in the future, then followed by MSFT (30.5), APPL (26.7) and GOOGL (22.8). 

+ `r kableExtra::text_spec("**EPS**", color = "#5c5c5c")` - According to EPS, TSLA is also the highest one with 34.5, which indicates how much money a company makes for each share of its stock, MSFT (25.6), APPL (23.9) and GOOGL (16.5). 

+ `r kableExtra::text_spec("**Dividend Yield**", color = "#5c5c5c")` -Google and Tesla dont offer dividends. Based on dividend yield, MSFT has the highest (0.9%), followed by APPL (0.5%) which indicates though MSFT is advantageous in P-E Ratio and EPS as compared to APPL, its high Dividend yield is good for investors to gain dividends. 

+ `r kableExtra::text_spec("**Market Cap**", color = "#5c5c5c")` - From the market capitalization perspective, APPL has the highest cap, followed by MSFT, GOOGL and TSLA. Overall, from the key indicators, MSFT and APPL are better companies to invest in among others, then TSLA, CVS and GOOGL.


### **Individual Trends Analysis**
Based on the daily Stock adjusted Prices chart and their individual candlestick chart, we can see clearly, TSLA is steadily trending up but it fluctuates a lot hence it is very volatile.

MSFT is up now as compared to its price at the beginning of 2020,  and it continues to grow.

APPL, MSFT and GOOGL stocks are relatively steady not much up and down, while TSLA is trending down since this year. 
As a conservative investor, MSFT and APPL are good companies to invest in they both are steadily trending up and they both offer dividends. This makes them really good growth stocks. GOOGL is also good too as it's stable but it doesn't offer a dividend. TSLA is a very good stock, but investing in TSLA involves high risk because of its volatility.