Row

Stock Price - AAPL

See stock price trend to get a genral sense of the performance of the three stocks. Apple is steadily increasing in recent month, Microsoft is also steady in a long run, while Twitter see downward trend in recent.

Stock Price - MSFT

Stock Price - TWTR

Row

Monthly Return

Monthly return analysis, to see if it’s possible to get the highest monthly return for short term investment.

Row

Current Basic Metrics

Basic metrics for three stocks, in order to frame a general picture and details of the three stocks. Apple is having the biggest market cap, which Microsoft second, while Twitter is the smallest according to this.

Row

Quarterly Net Income

Net income from the cash flow report is a great indicator to see the current company situation. Apple is always having the biggest cash flow, Microsoft is OK, while Twitter is having some problems.

---
title: "Financial Dashboarding - Which Stock to invest?"
output: 
  flexdashboard::flex_dashboard:
    orientation: row
    vertical_layout: scroll
    source_code: embed

  
---

```{r setup, include=FALSE}
library(flexdashboard)
library(quantmod)
library(dygraphs)
library(xts)
library(plyr)
library(tidyverse)

```

Row {.tabset .tabset-fade}
-----------------------------------------------------------------------

### Stock Price - AAPL
See stock price trend to get a genral sense of the performance of the three stocks.
Apple is steadily increasing in recent month, Microsoft is also steady in a long run, while Twitter see downward trend in recent.

```{r}
tickers <- c("AAPL", "MSFT", "TWTR")
symbol <- getSymbols(tickers, src = 'yahoo', auto.assign = TRUE, warnings = FALSE, from = '2016-07-03')
AAPL <- AAPL[,1:4]
MSFT <- MSFT[,1:4]
TWTR <- TWTR[,1:4]

dygraph(AAPL, main = "Apple") %>% 
  dyCandlestick() %>% 
  dyAxis("y", label="Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(5, "Set2")) %>%
  dyHighlight(highlightCircleSize = 4,
              highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 55)%>% 
  dyLegend(show = "onmouseover")


```




###  Stock Price -  MSFT

```{r}

dygraph(MSFT, main = "Microsoft") %>% 
  dyCandlestick() %>% 
  dyAxis("y", label="Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(5, "Set2")) %>%
  dyHighlight(highlightCircleSize = 4,
              highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 55)%>% 
  dyLegend(show = "onmouseover")


```


###  Stock Price -  TWTR

```{r}

dygraph(TWTR, main = "Twitter") %>% 
  dyCandlestick() %>% 
  dyAxis("y", label="Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(5, "Set2")) %>%
  dyHighlight(highlightCircleSize = 4,
              highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 55) %>% 
  dyLegend(show = "onmouseover")

```

Row {}
-----------------------------------------------------------------------

### Monthly Return

Monthly return analysis, to see if it's possible to get the highest monthly return for short term investment.

```{r}

m.rt.APPL <- monthlyReturn(AAPL)
m.rt.MSFT <- monthlyReturn(MSFT)
m.rt.TWTR <- monthlyReturn(TWTR)

mg.return <- merge.xts(m.rt.APPL,m.rt.MSFT,m.rt.TWTR)
colnames(mg.return) <- c('APPL','MSFT','TWTR')


dygraph(mg.return, main = "Monthly Return") %>%
  dyAxis("y", label = "Return") %>%
  dyOptions(colors = RColorBrewer::brewer.pal(5, "Set2")) %>%
  dyHighlight(highlightSeriesBackgroundAlpha = 0.5,
               highlightSeriesOpts = list(strokeWidth = 3)) %>%
  dyRangeSelector(height = 55)
  
```


Row {}
-----------------------------------------------------------------------

### Current Basic Metrics

Basic metrics for three stocks, in order to frame a general picture and details of the three stocks.
Apple is having the biggest market cap, which Microsoft second, while Twitter is the smallest according to this.

```{r}
what_m <- yahooQF(c("Price/Sales", 
                          "P/E Ratio",
                          "Price/EPS Estimate Next Year",
                          "PEG Ratio",
                          "Dividend Yield", 
                          "Market Capitalization"))

ms <- getQuote(paste(tickers, sep="", collapse=";"), what=what_m)
ms <- data.frame(Symbol=tickers, ms[,2:length(ms)]) 
colnames(ms) <- c("Symbol", "Revenue Multiple", "Earnings Multiple", 
                       "Earnings Multiple (Forward)", "Price-to-Earnings-Growth", "Div Yield", "Market Cap")
DT::datatable(ms)

```



Row {}
-----------------------------------------------------------------------
### Quarterly Net Income

Net income from the cash flow report is a great indicator to see the current company situation.
Apple is always having the biggest cash flow, Microsoft is OK, while Twitter is having some problems.

```{r}

invisible(getFin('AAPL'))
invisible(getFin('MSFT'))
invisible(getFin('TWTR'))
APPL.CF<- viewFin(AAPL.f, "CF", "Q")
MSFT.CF<- viewFin(MSFT.f, "CF", "Q")
TWTR.CF<- viewFin(TWTR.f, "CF", "Q")

CF <- rbind(APPL.CF[1,], MSFT.CF[1,], TWTR.CF[1,])
rownames(CF) <- c('APPL','MSFT','TWTR')
DT::datatable(CF)


```