Column

Current Stock Price of Each Company

   Symbol  Last    Change X..Change  Open   High   Low    Volume
1:   TWTR 31.51 1.3299999  4.406892 30.37 31.805 29.68  67181217
2:   MSFT 88.18 3.1699982  3.728971 86.30 88.930 83.83  63499065
3:     GE 14.94 0.4899998  3.391002 14.69 15.030 14.23 129055811

Row

Twitter

Microsoft

General Electrics

---
title: "Dashboard Laboratory"
author: "Nutthaporn and Cristina"
date: "February 10, 2018"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_scroll: fill
    source_code: embed
---

```{r}

library(flexdashboard)
library(quantmod)
library(dygraphs)
library(lubridate)
library(PerformanceAnalytics)
library(ggplot2)
library(plyr)
library(dplyr)

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

### **Current Stock Price of Each Company**
    
```{r message=FALSE, warning=FALSE}
tickers <- c("TWTR", "MSFT", "GE")
metrics <- getQuote(paste(tickers, sep="", collapse=";"))
metrics <- data.frame(Symbol=tickers, metrics[,2:length(metrics)]) 
data.table::data.table(metrics) 
```
    
### 
    
```{r message=FALSE, warning=FALSE}
tickers <- c("TWTR", "MSFT", "GE")
invisible(getSymbols(tickers, from="2017-01-01", to="2018-01-01"))
ClosePrices <- do.call(merge, lapply(tickers, function(x) Cl(get(x))))
dygraph(ClosePrices, main="Closing Stock Prices in 2017", group="Stock") %>%
    dyAxis("y", label="Closing Price($)") %>%
    dyOptions(axisLineWidth = 3.0,  colors = RColorBrewer::brewer.pal(2, "Set2")) 
```



Row {data-height=400 .tabset}
-------------------------------------
 
### Twitter
  
```{r}

invisible(getSymbols("TWTR", src = "yahoo", from = '2017-01-01', to="2018-01-01"))
TWTR_xts <- TWTR
dygraph(TWTR_xts[, -5], main = "Twitter Price Movement in 2017") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Stock Price ($)") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(4, "Set2")) %>%
  dyRangeSelector(height = 100)

``` 


### Microsoft
    
```{r}

invisible(getSymbols("MSFT", src = "yahoo", from = '2017-01-01', to="2018-01-01"))
MSFT_xts <- MSFT
dygraph(MSFT_xts[, -5], main = "Microsoft Price Movement in 2017") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Stock Price ($)") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(4, "Set2")) %>%
  dyRangeSelector(height = 100)

```


### General Electrics
    
```{r}

invisible(getSymbols("GE", src = "yahoo", from = '2017-01-01', to="2018-01-01"))
GE_xts <- GE
dygraph(GE_xts[, -5], main = "GE Price Movement in 2017") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Stock Price ($)") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(4, "Set2")) %>%
  dyRangeSelector(height = 100)

```