In this part, I have created a table view of the four companies and performed the fundamental analysis based on P/E Ratio, Earnings per share estimate, Divident Yields and Market Capitalisation. Based on the market capitalisation data, all the companies are large cap stocks with FB ranked the highest and TSLA the lowest.
NFLX has the highest price to earning ratio which means higher risk and lower growth. NFLX also has the highest EPS whcih means the company has the potential to bring in more money to the share of stocks. NFLX definitely is a great pick for short term gains.
3 out of 4 stocks doesnt have a divident yield, so we can omit divident yield in our method of comparison. Only NVDA has a divident Yeild, meaning we can think about NVDA as a long term investment but not short term.
NVDA and FB have almost the same PE ratio and NVDA has a slightly more EPS.
TSLA doesnt have a PE ratio but definitely more EPS as compared to FB and NVDA
Therefore NFLX would be my buy for the short term gains.
---
title: "ANLY 512: Data Visualization"
subtitle: "Dashboard Laboratory"
author: "Noble Verma"
date: "March 11, 2019"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
source_code: embed
---
```{r setup, include=FALSE, message=FALSE}
# list of libraries we are using in this dashboard
library(flexdashboard)
library(quantmod)
library(plyr)
library(dygraphs)
library(lubridate)
library(RColorBrewer)
library(DT)
```
# Intro text {.sidebar}
## **Trend Analysis**
* This dashboard shows the analysis of four major companies namely Nvidia, Facebook, Netflix and Tesla. The goal is to decide which one of the four stocks will produce the most short term gains. I have taken the data for the past one year to see the stocks trend.
* From the past one year trend, we can see that Netflix,Tesla and Nvidia are very volatile in nature whereas Facebook trend shows less price action as compared to other three.
* Netflix closed at the highest price followed by Tesla, Nvdia and Facebook.
* There is an upward trend in all the stocks till august whereas Nvida and facebook showed the downtrend in later half of the year.
* Out of all the four companies, Facebook seem to be a long term investment as there is less fluctuation in the stock and its quite stable.
* For the best short term gains, I would definitely go with Netflix as the price action is more here and the return on investment for Netflix will be definitely more.
# Stock Dashboard
Column {data-width=550}
-----------------------------------------------------------------------
### Stock Closing Prices - 1 year trend
```{r,echo=FALSE, message = FALSE}
ticker <- c("NVDA", "FB", "NFLX", "TSLA")
invisible(getSymbols(ticker, from="2018-01-01", to="2019-02-28"))
closing_price <- do.call(merge, lapply(ticker, function(x) Cl(get(x))))
dateperiod<-c("2018-01-01", "2019-02-28")
dygraph(closing_price, main="Stock Closing Price (USD)", group="Stock") %>%
dyAxis("y", label="Closing Price (USD)") %>%
dyOptions(axisLineWidth = 2.0, colors = RColorBrewer::brewer.pal(6, "Set1")) %>%
dyHighlight(highlightSeriesBackgroundAlpha = 1.0,
highlightSeriesOpts = list(strokeWidth = 2)) %>%
dyRangeSelector(height = 60)
```
#Fundamental Analysis
* In this part, I have created a table view of the four companies and performed the fundamental analysis based on P/E Ratio, Earnings per share estimate, Divident Yields and Market Capitalisation. Based on the market capitalisation data, all the companies are large cap stocks with FB ranked the highest and TSLA the lowest.
* NFLX has the highest price to earning ratio which means higher risk and lower growth. NFLX also has the highest EPS whcih means the company has the potential to bring in more money to the share of stocks. NFLX definitely is a great pick for short term gains.
* 3 out of 4 stocks doesnt have a divident yield, so we can omit divident yield in our method of comparison. Only NVDA has a divident Yeild, meaning we can think about NVDA as a long term investment but not short term.
* NVDA and FB have almost the same PE ratio and NVDA has a slightly more EPS.
* TSLA doesnt have a PE ratio but definitely more EPS as compared to FB and NVDA
Therefore NFLX would be my buy for the short term gains.
```{r}
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Market Capitalization"))
tickers <- c("NVDA", "FB", "NFLX", "TSLA")
# Not all the metrics are returned by Yahoo.
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
#Add tickers as the first column and remove the first column which had date stamps
metrics <- data.frame(Symbol=tickers, metrics[,2:length(metrics)])
#Change colnames
colnames(metrics) <- c("Symbol", "P-E Ratio", "Price EPS Estimate Next Year", "Div Yield", "Market Cap")
#Persist this to the csv file
#write.csv(metrics, "FinancialMetrics.csv", row.names=FALSE)
DT::datatable(metrics)
```
# Candlestick Charts
Column {.tabset}
-----------------------------------------------------------------------
### Nvidia
```{r message=FALSE, warning=FALSE}
startdate <- ymd("2018-11-01")
invisible(getSymbols("NVDA", src = "yahoo", from=startdate))
Nvidia <- NVDA[,-5]
colnames(Nvidia) <- c("Open","High","Low","Close","Adjusted")
```
```{r message=FALSE, warning=FALSE}
dygraph(Nvidia, main = "Nvidia - Past 4 Months Trend") %>%
dyAxis("y", label="Price (USD)") %>%
dyOptions(axisLineWidth = 2, colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
dyCandlestick()
```
### Facebook
```{r message=FALSE, warning=FALSE}
startdate <- ymd("2018-11-01")
invisible(getSymbols("FB", src = "yahoo", from=startdate))
Facebook <- FB[,-5]
colnames(Facebook) <- c("Open","High","Low","Close","Adjusted")
```
```{r message=FALSE, warning=FALSE}
dygraph(Facebook, main = "Facebook - Past 4 Months Trend") %>%
dyAxis("y", label="Price (USD)")%>%
dyOptions(axisLineWidth = 2, colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
dyCandlestick()
```
### Netflix
```{r message=FALSE, warning=FALSE}
startdate <- ymd("2018-11-01")
invisible(getSymbols("NFLX", src = "yahoo", from=startdate))
Netflix <- NFLX[,-5]
colnames(Netflix) <- c("Open","High","Low","Close","Adjusted")
```
```{r message=FALSE, warning=FALSE}
dygraph(Netflix, main = "Netflix - Past 4 Months Trend") %>%
dyAxis("y", label="Price (USD)") %>%
dyOptions(axisLineWidth = 2, colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
dyCandlestick()
```
### Tesla
```{r message=FALSE, warning=FALSE}
startdate <- ymd("2018-11-01")
invisible(getSymbols("TSLA", src = "yahoo", from=startdate))
Tesla <- TSLA[,-5]
colnames(Tesla) <- c("Open","High","Low","Close","Adjusted")
```
```{r message=FALSE, warning=FALSE}
dygraph(Tesla, main = "Tesla - Past 4 Months Trend") %>%
dyAxis("y", label="Price (USD)") %>%
dyOptions(axisLineWidth = 2, colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
dyCandlestick()
```