column

key Financial Indicators


These key financial indicators can help us give a summarized account of financial helath of the companies in consideration.

column

High Price

Low Price

Close Price

Adjusted Price

--- 
title: "ANLY 512 Dashboard Visualization Labortory"
author: "anil jhanwar"
date: "January 29, 2019"
output: 
  flexdashboard::flex_dashboard:
    #vertical_layout: fill
    #orientation: rows
    #storyboard: TRUE
    source_code: embed
  
---

```{r setup, message=FALSE, warning=FALSE}

library(plyr)
library(DT)
library(flexdashboard)
library(dygraphs)
library(quantmod)

```



```{r setup-data, cache=F,include=F}

# selecting tickers for the companies we would like to analyze
tickers <- c("AXP", "WFC", "BAC", "GS")
number_of_companies <- length(tickers)

# We will find the information aout the stock prices using quantmod
invisible(getSymbols(tickers))

# Following ocde defines the time period for which we need the data
time_duration<-c("2017-01-01", "2018-12-31") #2 years of data
# get prices of the stocks at various points of time:
openPrice <- do.call(merge, lapply(tickers, function(x) Op(get(x))))
highPrice <- do.call(merge, lapply(tickers, function(x) Hi(get(x))))
lowPrice <- do.call(merge, lapply(tickers, function(x) Lo(get(x))))
closePrice <- do.call(merge, lapply(tickers, function(x) Cl(get(x))))
adjustedPrice <- do.call(merge, lapply(tickers, function(x) Ad(get(x))))

# get key metrics
what_metrics <- yahooQF(c("P/E Ratio",
                          "Price/EPS Estimate Next Year",
                          "Market Capitalization", "Last Trade (Price Only)","Earnings/Share" ))
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
metrics <- data.frame(Symbol=tickers, metrics[,2:length(metrics)])
colnames(metrics) <- c("Symbol", "P/E Ratio", "Price/EPS Estimate Next Year", "Market Capitalization", 
                       "Last Trade (Price Only)", "Earnings/Share")
```

column{}
------------------------------------

### key Financial Indicators

```{r }
DT::datatable(metrics[, ], options = list( bPaginate = FALSE,
  autoWidth = FALSE))
```

*** 
These key financial indicators can help us give a summarized account of financial helath of the companies in consideration.



column{.tabset}
-------------------------------------

### High Price

```{r message=FALSE, warning=FALSE} 
dygraph(highPrice, group="Stock") %>%
  dyRebase(value=100) %>%
  dyAxis("y", label="Adjusted(USD)") %>%
  dyOptions(colors = RColorBrewer::brewer.pal(number_of_companies, "Set1")) %>%
  dyHighlight(highlightSeriesOpts = list(strokeWidth = 3),
  highlightSeriesBackgroundAlpha = 2) %>%
  dyRangeSelector(dateWindow = time_duration, height = 50, strokeColor = "")
```

### Low Price

```{r message=FALSE, warning=FALSE}
dygraph(lowPrice, group="Stock") %>%
  dyRebase(value=100) %>%
  dyAxis("y", label="Adjusted(USD)") %>%
  dyOptions(colors = RColorBrewer::brewer.pal(number_of_companies, "Set1")) %>%
  dyHighlight(highlightSeriesOpts = list(strokeWidth = 3),
  highlightSeriesBackgroundAlpha = 2) %>%
  dyRangeSelector(dateWindow = time_duration, height = 50, strokeColor = "")
```

### Close Price

```{r message=FALSE, warning=FALSE}
dygraph(closePrice, group="Stock") %>%
   dyRebase(value=100) %>%
  dyAxis("y", label="Adjusted(USD)") %>%
  dyOptions(colors = RColorBrewer::brewer.pal(number_of_companies, "Set1")) %>%
  dyHighlight(highlightSeriesOpts = list(strokeWidth = 3),
  highlightSeriesBackgroundAlpha = 2) %>%
  dyRangeSelector(dateWindow = time_duration, height = 50, strokeColor = "")
```

### Adjusted Price

```{r message=FALSE, warning=FALSE}

dygraph(adjustedPrice, group="Stock") %>%
  dyRebase(value=100) %>%
  dyAxis("y", label="Adjusted(USD)") %>%
  dyOptions(colors = RColorBrewer::brewer.pal(number_of_companies, "Set1")) %>%
  dyHighlight(highlightSeriesOpts = list(strokeWidth = 3),
  highlightSeriesBackgroundAlpha = 2) %>%
  dyRangeSelector(dateWindow = time_duration, height = 50, strokeColor = "")

```