Column

Close Prices

Column

Facebook

Microsoft

Google

IBM

Oracle

Apple

---
title: "ANLY 512: Dashboarding Lab"
author: "Arka Bhattacharya"
date: "`r Sys.Date()`"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    social: menu
    source_code: embed
---

```{r setup, include=FALSE}

library(lubridate)
library(quantmod)
library(flexdashboard)
library(dygraphs)

```

Column {data-width=550}
-----------------------------------------------------------------------

###Close Prices

```{r message = FALSE}

tickers <- c('FB', 'MSFT', 'GOOG', 'IBM', 'ORCL', 'AAPL')
invisible(getSymbols(tickers, from = "2017-01-01", to = "2017-12-13"))
ClosePrices <- do.call(merge, lapply(tickers, function(x) Cl(get(x))))

dygraph(ClosePrices, main = "Close Price (USD) ", group = "Stock") %>%
        dyAxis("y", label = "Close Price (USD)") %>%
        dyOptions(axisLineWidth = 2.0,  colors = RColorBrewer::brewer.pal(8, "Set1")) %>%
        dyHighlight(highlightSeriesBackgroundAlpha = 1.0,
                    highlightSeriesOpts = list(strokeWidth = 3)) %>%
        dyRangeSelector(height = 100)

```


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

### Facebook

```{r}
invisible(getSymbols("FB", src = "yahoo", from = '2017-01-01'))
FB_temp <- FB
dygraph(FB_temp[, -5], main = "Facebook") %>%
        dyCandlestick() %>%
        dyAxis("y", label = "Price") %>%
        dyOptions(colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
        dyHighlight(highlightCircleSize = 4,
                    highlightSeriesOpts = list(strokeWidth = 3),
                    highlightSeriesBackgroundAlpha = 1) %>%
        dyRangeSelector(height = 110)
```


### Microsoft

```{r message = FALSE}

invisible(getSymbols("MSFT", src = "yahoo", from = '2017-01-01'))
MSFT_temp <- MSFT
dygraph(MSFT_temp[, -5], main = "Microsoft") %>%
        dyCandlestick() %>%
        dyAxis("y", label = "Price") %>%
        dyOptions(colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
        dyRangeSelector(height = 110)
```


### Google

```{r}
invisible(getSymbols("GOOG", src = "yahoo", from = '2017-01-01'))
GOOG_temp <- GOOG
dygraph(GOOG_temp[, -5], main = "Google") %>%
        dyCandlestick() %>%
        dyAxis("y", label="Price") %>%
        dyOptions(colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
        dyRangeSelector(height = 110)
```

### IBM

```{r}
invisible(getSymbols("IBM", src = "yahoo", from = '2017-01-01'))
IBM_temp <- IBM
dygraph(IBM_temp[, -5], main = "IBM") %>%
        dyCandlestick() %>%
        dyAxis("y", label="Price") %>%
        dyOptions(colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
        dyRangeSelector(height = 110)
```


### Oracle

```{r}
invisible(getSymbols("ORCL", src = "yahoo", from = '2017-01-01'))
ORCL_temp <- ORCL
dygraph(ORCL_temp[, -5], main = "Oracle") %>%
        dyCandlestick() %>%
        dyAxis("y", label = "Price") %>%
        dyOptions(colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
        dyRangeSelector(height = 110)
```

###  Apple
```{r}
invisible(getSymbols("AAPL", src = "yahoo", from = '2017-01-01'))
AAPL_temp <- AAPL
dygraph(AAPL_temp[, -5], main = "Apple") %>%
        dyCandlestick() %>%
        dyAxis("y", label = "Price") %>%
        dyOptions(colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
        dyRangeSelector(height = 110)
```