Intorduction

Row

Overview

Due to the inherent growth in the electronic production and storage of information, there is often a feeling of “information overload” or inundation when facing the process of quantitative decision making. As an analyst your job will often be to conduct analyses or create tools to support quantitative decision making.

A principle tool used in industry, goverment, non-profits, and academic fields to compensate for the information overload is the information dashboard. Functionally, a dashboard is meant to provide a user with a central resource to present in a clear and concise manner all the information neccessary to support day-to-day decision making and support operations.

Row

Objective

The objective of this laboratory is to plan, design, and create an information dashboard to support quantitative decision making. To accomplish this task you will have to complete a number of steps:

  1. Delineate the necessary decision (I will do that below).
  2. Identify what information will be relevant to decision making.
  3. Find and collect the data necessary to create your visualization plan.
  4. Organize and summarize the collected data.
  5. Design and create the best visualizations to present that information.
  6. Finally organize the layout of those visualizations in a way that conforms to the theory of dashboarding.
  7. Write a summary about what decisions you made based on the visualizations that you developed.

The Decision & Rules

You make investments for an organization, your objective is to purchase securities/commodities for the key objective of maximizing profits. You want to make an investment in securities/commodities to make some short term gains. You are considering investing in one of any four companies, for example: Twitter (TWTR), Microsoft (MSFT), or Apple (AAPL) (don’t use these). Choose 4 companies or commodities and determine which one of the four will produce the most short term gains. Use your imagination.

Method Helps

Getting data

There are lots of places we can get financial data to support these decision. The simplest would be to go to for instance to the Yahoo Finance (https://finance.yahoo.com/) for data on the Hershey Company (HSY) the URL would be: (https://finance.yahoo.com/quote/HSY/history?p=HSY) and collect historical price data, and other financial and company information.

Alternatively, and more professionally, there are tons of packages that allow you to access data from R. See here quick examples. This is not a complete list but will get you started.

Row

Analysis at glance

Row

Key Variables

  • P/E Ratio - the ratio for valuing a company that measures its current share price relative to its per-share earnings
  • Earnings/Share - Earnings per share is the portion of a company’s profit that is allocated to each outstanding share of its common stock.
  • Price/EPS Estimate Next Year - The forward P/E estimates the relative value of the earnings..
  • Market Capitalization - the total value of all a company’s shares of stock. It is calculated by multiplying the price of a stock by its total number of outstanding shares.

Inital Analysis

The below table summarized the key financial variables to evalute the compnies profile for short term gain.

Here, I have gathered financial data for four companies from different industries: Paypal (PYPL), UBS, Netflix (NFLX), Service Now (NOW). It would be more fascinating to see which companies are more preferable for short term gain. Based on gathered data, Netflix has a higher Earning/Share while Service Now has a higher P-E ratio. Higher P-E ratio and Earning / share are the ones which attract the investors. On contrary, it could also mean that it have a high potential for loss since its stock price may be overvalued. In terms of short term gain we Netflix and Service Now seems like right choice. We will analyze further which one has a more potential for short term gain

Row

Stock Analysis

Summary

Based on the EPS and P/E ratio graphs, PayPal has a best valuation here, EPS is 2nd highest and P-E ratio is 2nd Lowest but It has 2nd market capital. PayPal seems like to be more secure and stable option. However, we can see that Netflix has the highest EPS and 3rd lowest P/E ratio but it has highest market capital. UBS has a lowest P-E ratio but not a good EPS also Service Now has a low EPS and highest P/E ratio which makes Service Now a bad choice for short term gain. Based on this analysis PayPal and Netflix seems like a to be best option. Next, we will analyze Closing price and Monthly return.

Column

EPS comparison

P/E Ration comparison

Market Capitalization comparison

Other Analysis

Now we are looking at the stock closing price and Mothly returns for all four shares between 2016-12-01 and 2019-12-01.

[1] "PYPL"
[1] "UBS"
[1] "NFLX"
[1] "NOW"

Row

Stock Closing Price

A closing price for a stock is the price at the end of a trading day. Based on the graph, UBS have almost same closing price since last 2 years. If we look an overall trend the UBS closing price is declining. However, PayPal closing price is gradually increasing over the last 2 years. Netflix has a highest closing price among the all 4 companies with more fluctuation. Service Now and PayPal have a similar increasing trend till 2019 after that Service Now closing price boomed which almost matched the Netflix closing price in Dec 2019. Netflix closing price have a down spike in Jan 2019 which makes Netflix less stable in terms of short term gain.

Monthly Return

Monthly Return is the period returns re-scaled to a period of 1 month. This allows investors to compare returns of different assets that they have owned for different lengths of time. Based on the graph we can see that Netflix have the highest fluctuation on monthly returns. It was the lowest; also overall lowest in Oct 2018. If we look at the Paypal, it has low fluctuation then Netflix. PayPal monthly return is almost steady over the last 2 years. UBS have a similar trend while Service Now has the 2nd highest fluctuation.

Conclusion

Conclusion

Based on the graph and analysis done on this dashboard for 4 compnies Paypal, Netflix, UBS, Service Now. We conclude that.

  1. Based on closing rates and monthly return Paypal and Netflix seems to be good candidate for short term gain.
  2. Paypal would be more safest option for short term gain since its monthly return is less volatile and closing price trend is upward. However, Netflix is also a good and risky option for the short-term gain because its monthly return is more volatile but Closing price increasing rapidly then other shares.
  3. For long term gain PayPal is the best and stable option.
---
title: "ANLY 512-92 Lab 01 DashBord"
author: "Rajan Natvarlal Patel"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    social: [ "menu" ]
    source: embed
    vertical_layout: fill
---

Intorduction
===================================== 
Row {data-height=320}
-------------------------------------

### **Overview**  
Due to the inherent growth in the electronic production and storage of information, there is often a feeling of “information overload” or inundation when facing the process of quantitative decision making. As an analyst your job will often be to conduct analyses or create tools to support quantitative decision making.

A principle tool used in industry, goverment, non-profits, and academic fields to compensate for the information overload is the information dashboard. Functionally, a dashboard is meant to provide a user with a central resource to present in a clear and concise manner all the information neccessary to support day-to-day decision making and support operations.

Row {data-height=600}
-------------------------------------
### **Objective**
The objective of this laboratory is to plan, design, and create an information dashboard to support quantitative decision making. To accomplish this task you will have to complete a number of steps:

1. Delineate the necessary decision (I will do that below).
2. Identify what information will be relevant to decision making.
3. Find and collect the data necessary to create your visualization plan.
4. Organize and summarize the collected data.
5. Design and create the best visualizations to present that information.
6. Finally organize the layout of those visualizations in a way that conforms to the theory of dashboarding.
7. Write a summary about what decisions you made based on the visualizations that you developed.

### **The Decision & Rules**
You make investments for an organization, your objective is to purchase securities/commodities for the key objective of maximizing profits. You want to make an investment in securities/commodities to make some short term gains. You are considering investing in one of any four companies, for example: Twitter (TWTR), Microsoft (MSFT), or Apple (AAPL) (don’t use these). Choose 4 companies or commodities and determine which one of the four will produce the most short term gains. Use your imagination.

### **Method Helps**
Getting data

There are lots of places we can get financial data to support these decision. The simplest would be to go to for instance to the Yahoo Finance (https://finance.yahoo.com/) for data on the Hershey Company (HSY) the URL would be: (https://finance.yahoo.com/quote/HSY/history?p=HSY) and collect historical price data, and other financial and company information.

Alternatively, and more professionally, there are tons of packages that allow you to access data from R. See here quick examples. This is not a complete list but will get you started.

Row {data-height=360}
-------------------------------------

```{r setup, include=FALSE, echo =TRUE}
library(quantmod)
library(plyr)
library(ggplot2)
library(dplyr)
library(dygraphs)
library(flexdashboard)
library(kableExtra)
library(DT)
```


Analysis at glance
===================================== 
Row {data-height=320}
-----------------------------------------------------------------------
### **Key Variables**
+ `r kableExtra::text_spec("**P/E Ratio**", color = "#Black")` - the ratio for valuing a company that measures its current share price relative to its per-share earnings
+ `r kableExtra::text_spec("**Earnings/Share**", color = "#Black")` - Earnings per share is the portion of a company's profit that is allocated to each outstanding share of its common stock. 
+ `r kableExtra::text_spec("**Price/EPS Estimate Next Year**", color = "#Black")` - The forward P/E estimates the relative value of the earnings..
+ `r kableExtra::text_spec("**Market Capitalization**", color = "#Black")` - the total value of all a company's shares of stock. It is calculated by multiplying the price of a stock by its total number of outstanding shares.


### **Inital Analysis**
The below table summarized the key financial variables to evalute the compnies profile for short term gain.

Here, I have gathered financial data for four companies from different industries: Paypal (PYPL), UBS, Netflix (NFLX), Service Now (NOW). It would be more fascinating to see which companies are more preferable for short term gain. Based on gathered data, Netflix has a higher Earning/Share while Service Now has a higher P-E ratio. Higher P-E ratio and Earning / share are the ones which attract the investors. On contrary, it could also mean that it have a high potential for loss since its stock price may be overvalued. In terms of short term gain we Netflix and Service Now seems like right choice. We will analyze further which one has a more potential for short term gain


Row {data-height=320}
-----------------------------------------------------------------------
```{r}
what_metrics <- yahooQF(c("Price/Sales", 
                          "P/E Ratio",
                          "Earnings/Share",
                          "Price/EPS Estimate Next Year",
                          "PEG Ratio",
                          "Market Capitalization"))

tickers <- c("PYPL", "UBS" , "NFLX", "NOW")
# 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", "EarningsperShare","Price EPS Estimate Next Year", "Market Cap")

#Persist this to the csv file
write.csv(metrics, "FinancialMetrics.csv", row.names=FALSE)
DT::datatable(metrics)
```  





Stock Analysis
===================================== 

### **Summary**
Based on the EPS and P/E ratio graphs, PayPal has a best valuation here, EPS is 2nd highest and P-E ratio is 2nd Lowest but It has 2nd market capital. PayPal seems like to be more secure and stable option. However, we can see that Netflix has the highest EPS and 3rd lowest P/E ratio but it has highest market capital. UBS has a lowest P-E ratio but not a good EPS also Service Now has a low EPS and highest P/E ratio which makes Service Now a bad choice for short term gain. Based on this analysis PayPal and Netflix seems like a to be  best option. Next, we will analyze Closing price and Monthly return.


Column {.tabset}
-----------------------------------------------------------------------
### EPS comparison
```{r}

metrics<-data.frame(na.fill(metrics,0))
ggplot(metrics,aes(x=Symbol,y=EarningsperShare,fill=Symbol))+
  geom_col()+
  labs(x="Companies",y="Earning/Share")
```

### P/E Ration comparison
```{r}
ggplot(metrics,aes(x=Symbol,y=P.E.Ratio,fill=Symbol,color=Symbol,shape =Symbol))+
  geom_point()+
  labs(x="Company",y="P/E Ratio")+
  theme_classic()
```

### Market Capitalization comparison 
```{r}
ggplot(metrics,aes(x=Symbol,y=Market.Cap,fill=Symbol))+
  geom_col()+
  coord_polar("y",start=0)+
  labs(x="Company",y="Market Capitalization")
```

Other Analysis
===================================== 

Now we are looking at the stock closing price and Mothly returns for all four shares between 2016-12-01 and 2019-12-01.

```{r}
getSymbols("PYPL", from = "2016-12-01", to = "2019-12-01")
getSymbols("UBS", from = "2016-12-01", to = "2019-12-01")
getSymbols("NFLX", from = "2016-12-01", to = "2019-12-01")
getSymbols("NOW", from = "2016-12-01", to = "2019-12-01")
tickers <- c("PYPL", "UBS", "NFLX", "NOW")
```

Row {.tabset .tabset-fade}
-----------------------------------------------------------------------
### Stock Closing Price
A closing price for a stock is the price at the end of a trading day. 
Based on the graph, UBS have almost same closing price since last 2 years. If we look an overall trend the UBS closing price is declining. However, PayPal closing price is gradually increasing over the last 2 years. Netflix has a highest closing price among the all 4 companies with more fluctuation. Service Now and PayPal have a similar increasing trend till 2019 after that Service Now closing price boomed which almost matched the Netflix closing price in Dec 2019. Netflix closing price have a down spike in Jan 2019 which makes Netflix less stable in terms of short term gain.
```{r}
stockClsoingP <- do.call(merge, lapply(tickers, function(x) Cl(get(x))))

dataWindow<-c("2016-12-01", "2019-12-01")

dygraph(stockClsoingP, main="Stock Closing Price", group="Stock") %>%
  dyAxis("y", label="Closing Price($) ") %>%
  dyOptions( colors = RColorBrewer::brewer.pal(4, "Set1")) %>%
            dyHighlight(highlightSeriesBackgroundAlpha = 0.5,
  highlightSeriesOpts = list(strokeWidth = 3)) %>%
  dyRangeSelector(height = 35, dateWindow=dataWindow)
```


### Monthly Return
Monthly Return is the period returns re-scaled to a period of 1 month. This allows investors to compare returns of different assets that they have owned for different lengths of time. Based on the graph we can see that Netflix have the highest fluctuation on monthly returns. It was the lowest; also overall lowest in Oct 2018. If we look at the Paypal, it has low fluctuation then Netflix. PayPal monthly return is almost steady over the last 2 years. UBS have a similar trend while Service Now has the 2nd highest fluctuation. 

```{r}
PYP_monthly_return <- monthlyReturn(PYPL)
UBS_monthly_return <- monthlyReturn(UBS)
NFLX_monthly_return <- monthlyReturn(NFLX)
NOW_monthly_return <- monthlyReturn(NOW)

Monthy_return <- merge.xts(PYP_monthly_return,UBS_monthly_return, NFLX_monthly_return, NOW_monthly_return)
colnames(Monthy_return) <- c('Paypal','UBS','NETFLIX','Service NOW')

dataWforMonth<-c("2016-12-01", "2019-12-01")

dygraph(Monthy_return, main = "Monthly Return") %>%
  dyAxis("y", label = "Monthly Return") %>%
  dyOptions(colors = RColorBrewer::brewer.pal(4, "Set1")) %>%
  dyHighlight(highlightSeriesBackgroundAlpha = 0.5,
               highlightSeriesOpts = list(strokeWidth = 4)) %>%
  dyRangeSelector(height = 35, dateWindow=dataWforMonth)

```

Conclusion
===================================== 
### **Conclusion**
Based on the graph and analysis done on this dashboard for 4 compnies Paypal, Netflix, UBS, Service Now. We conclude that.

1. Based on closing rates and monthly return Paypal and Netflix seems to be good candidate for short term gain.
2. Paypal would be more safest option for short term gain since its monthly return is less volatile and closing price trend is upward. However, Netflix is also a good and risky option for the short-term gain because its monthly return is more volatile but Closing price increasing rapidly then other shares.
3. For long term gain PayPal is the best and stable option.