Column

NETFLIX

AMAZON

FACEBOOK

MiCROSOFT

GOOGLE

column

FINANCIAL METRICS

---
title: "DASHBOARD LAB - ANLY 512 Data Visualization"
author: "Navya Mekera Halaswamy"

#Navya Mekera Halaswamy: ID - 219796

output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    social: menu
    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", "FB", "MSFT", "GOOGL ")
```


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

### STOCK INVESTMENT  

This is a collection of visualizations of OHLC Stock prices, in order to make a decision about which stock to invest in. 

For the purpose of this lab, the stocks in consideration are that of "NETFLIX", "AMAZON", "FACEBOOK", "MICROSOFT" and "GOOGLE", whose products we use on a daily basis. 




Column {data-height=650 .tabset .tabset-fade}
-------------------------------------

### NETFLIX
```{r}
timeWindow<-c("2017-07-01", "2018-07-01")
invisible(getSymbols("NFLX", src = "yahoo", from='2017-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("2017-07-01", "2018-07-01")
invisible(getSymbols("AMZN", src = "yahoo", from='2017-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 = "")
```

### FACEBOOK  
```{r}
timeWindow<-c("2017-07-01", "2018-07-01")
invisible(getSymbols("FB", src = "yahoo", from='2017-07-01'))
FB_x <- FB
dygraph(FB_x[, -5], main = "FACEBOOK") %>%
  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 = "")
```

### MiCROSOFT  
```{r}
timeWindow<-c("2017-07-01", "2018-07-01")
invisible(getSymbols("MSFT", src = "yahoo", from='2017-07-01'))
MSFT_x <- MSFT
dygraph(MSFT_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 = "")
```

### GOOGLE  
```{r}
timeWindow<-c("2017-07-01", "2018-07-01")
invisible(getSymbols("GOOG", src = "yahoo", from='2017-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}
-------------------------------------

### FINANCIAL 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", "FB",  "MSFT", "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("COMPANY", "EARNINGS MULTIPLE","EARNINGS MULTIPLE (Forward)", "DIVIDEND", "MARKET CAP")

DT::datatable(metrics)
```