Column

NETFLIX

AMAZON

META

NVIDIA

GOOGLE

column

Evaluation Metrics

---
title: "Stocks Dashboard"
author: "-  Bonosa Mahama"


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)

# Names of the stocks we are interested in
tickers <- c("NFLX", "AMZN", "META", "MSFT", "GOOGL ")
```


Sidebar {.sidebar}
-----------------------------------------------------------------------

### **Overview**

This dashboard is a collection of data visualization of various stock prices. The goal is to enable us make a decision on which stock is best to invest in. 
For the purpose of this exercise, we looked at the following stocks: Netflix, Amazon, Meta, Nvidia and Google. 

### **Summary**
Based on the data visualizations of the stocks evaluated, we believe NVIDIA is the best stock to invest in because it shows growth potential. It shows the highest earnings and dividend compared to the other stocks.


Column {data-height=650 .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 = 15, 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 = "")
```


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")
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)
```