---
title: "ANLY 512 Final Project"
###author: "- Bonosa Mahama"
author: <font size="1"> by Bonosa Mahama</font>
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
social: menu
theme: cerulean
source_code: embed
---
```{r setup, include=FALSE, message=FALSE}
library(lubridate)
library(quantmod)
library(flexdashboard)
library(dygraphs)
library(plyr)
library(reshape)
library(ggcorrplot)
library(melt)
# Names of the stocks we are interested in
tickers <- c("NFLX", "AMZN", "META", "MSFT", "GOOGL ")
```
# Home
Sidebar {.sidebar}
-----------------------------------------------------------------------
### **Overview**
This Dashboard looks at the stocks of the most common technology companies in the US. The Technology sector is the largest stock sector in the US, accounting for 27% of the total market cap. Tech giants like Apple, Google, Microsoft and Meta are the largest contributors to the sectors market cap.
For the purpose of this exercise, we looked at the following stocks: Netflix, Amazon, Meta, NVIDIA, Google, Oracle, Docusign,AMD,Adobe, Cisco, Shopify and Uber.
### **Summary**
We created a correlation graph to see how each of the tech stock correlates to the other. So far, almost all the stocks evaluated showed a positive correlation with at least 2 other stocks.
The only outliers were Cisco and Docusign which showed almost 0 correlation with the other stocks. This implies an increase or decrease in the price of the other stocks do not impact the price of these two stocks.
Column {data-width=450}
---------------------------------------------------------------------
### **Correlation Plot**
```{r}
tickers<-c("NFLX", "AMZN", "META", "NVDA", "GOOG","ORCL","DOCU","CRM","AMD","ADBE","ACN","CSCO","INTC","UBER","MU","PANW","SHOP")
tickerPrices <- NULL
for (ticker in tickers)
tickerPrices <- cbind(tickerPrices, getSymbols(ticker, src = "yahoo", from = "2023-01-01", auto.assign=FALSE)[,4])
drop_na <- apply(tickerPrices,1,function(x) all(!is.na(x)))
tickerPrices <- tickerPrices[drop_na]
colnames(tickerPrices) <- tickers
corr <- cor(tickerPrices)
melted_cormat <- melt(corr)
ggcorrplot(corr,
type = 'upper',
lab = TRUE,
lab_size = 3,
method = 'circle',
colors = c("red", "white", "green"),
title="Correlogram of Stocks",
legend.title = "Correlation")
```
### UBER
```{r}
timeWindow<-c("2022-07-01", "2023-07-01")
invisible(getSymbols("UBER", src = "yahoo", from='2022-07-01'))
UBER_x <- UBER
dygraph(UBER_x[, -5], main = "UBER") %>%
dyCandlestick() %>%
dyAxis("y", label="SHARE PRICE in USD") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) %>%
dyRangeSelector(dateWindow = timeWindow, height = 15, strokeColor = "")
```
Column {data-height=200}
-------------------------------------
### **Evaluation Metrics**
```{r}
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Market Capitalization"))
tickers <- c("NFLX", "AMZN", "META", "NVDA", "GOOG","ORCL","DOCU","CRM","AMD","ADBE","ACN","CSCO","INTC","UBER","MU","PANW","SHOP")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
metrics <- data.frame(Symbol=tickers, metrics[,2:length(metrics)])
#Rename the metrics columns
colnames(metrics) <- c("SYMBOL", "P/E RATIO","EARNINGS MULTIPLE (Forward)", "DIVIDEND", "MARKET CAP")
DT::datatable(metrics)
```
# Top 5 Tech Companies
Sidebar {.sidebar}
-----------------------------------------------------------------------
This Tab shows candle sticks chart of the Top Performing Tech Stocks
Column {data-height=600 .tabset .tabset-fade}
-------------------------------------
### NETFLIX
```{r}
timeWindow<-c("2022-07-01", "2023-07-01")
invisible(getSymbols("NFLX", src = "yahoo", from='2022-07-01'))
NFLX_x <- NFLX
dygraph(NFLX_x[, -5], main = "NETFLIX") %>%
dyCandlestick() %>%
dyAxis("y", label="SHARE PRICE in USD") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) %>%
dyRangeSelector(dateWindow = timeWindow, height = 10, strokeColor = "")
```
### AMAZON
```{r}
timeWindow<-c("2022-07-01", "2023-07-01")
invisible(getSymbols("AMZN", src = "yahoo", from='2022-07-01'))
AMZN_x <- AMZN
dygraph(AMZN_x[, -5], main = "AMAZON") %>%
dyCandlestick() %>%
dyAxis("y", label="SHARE PRICE in USD") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) %>%
dyRangeSelector(dateWindow = timeWindow, height = 15, strokeColor = "")
```
### META
```{r}
timeWindow<-c("2022-07-01", "2023-07-01")
invisible(getSymbols("META", src = "yahoo", from='2022-07-01'))
FB_x <- META
dygraph(FB_x[, -5], main = "META") %>%
dyCandlestick() %>%
dyAxis("y", label="SHARE PRICE in USD") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) %>%
dyRangeSelector(dateWindow = timeWindow, height = 15, strokeColor ="")
```
### NVIDIA
```{r}
timeWindow<-c("2022-07-01", "2023-07-01")
invisible(getSymbols("NVDA", src = "yahoo", from='2022-07-01'))
NVDA_x <- NVDA
dygraph(NVDA_x[, -5], main = "NVIDIA") %>%
dyCandlestick() %>%
dyAxis("y", label="SHARE PRICE in USD") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) %>%
dyRangeSelector(dateWindow = timeWindow, height = 15, strokeColor = "")
```
### GOOGLE
```{r}
timeWindow<-c("2022-07-01", "2023-07-01")
invisible(getSymbols("GOOG", src = "yahoo", from='2022-07-01'))
GOOG_x <- GOOG
dygraph(GOOG_x[, -5], main = "MICROSOFT") %>%
dyCandlestick() %>%
dyAxis("y", label="SHARE PRICE in USD") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) %>%
dyRangeSelector(dateWindow = timeWindow, height = 15, strokeColor = "")
```