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.
We are making an investment plan for our company. Our objective is to purchase securities/commodities for the key objective of maximizing profits. We are focusing our investment on gaining short term gains. We are considering investing in Facebook, Oracle, IBM and SAP.
We collect relevant data from YahooFinance and we look at stock key performance metrics and the historical candlestick plots for each company when making our investment decision.
[1] "FB" "IBM" "ORCL" "SAP"
Looking at the stock closing metrics, we can conclude that Facebook is standing out from the other three companies for the Market Cap. Facebook and SAP have stronger performance in Revenue Multiple and earnings Multiple than the other two.
From the historical plots dated back to January 2019, there has been an increasing stock closing price trend for SAP since the beginning of the year. Oracle and IBM shared a similar trend. Facebook has had a few drops but come back with stronger performance since early June this year.
Compared against all other three, Facebook has the highest price point.
---
title: "ANLY 512 Lab 1: Dashboard Laboratory"
author: "Arju Begum,Wenxue Sun"
date: "`r Sys.Date()`"
output:
flexdashboard::flex_dashboard:
source_code: embed
orientation: rows
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(xts)
library(dygraphs)
library(quantmod)
library(tidyquant)
library(dplyr)
```
Introduction
================================
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
We are making an investment plan for our company. Our objective is to purchase securities/commodities for the key objective of maximizing profits. We are focusing our investment on gaining short term gains. We are considering investing in Facebook, Oracle, IBM and SAP.
We collect relevant data from YahooFinance and we look at stock key performance metrics and the historical candlestick plots for each company when making our investment decision.
Stock Prices
================================
Row {data-height=600}
-------------------------------------
### Stock Closing Prices
```{r}
ticker <- c("FB", "IBM", "ORCL", "SAP")
getSymbols(ticker, from="2018-01-01")
ClosingPrices <- do.call(merge, lapply(ticker, function(x) Cl(get(x))))
dateperiod<-c("2018-01-01")
dygraph(ClosingPrices, main="Closing Price in Dollars", group="Stock") %>%
dyAxis("y", label="Closing Price(USD)") %>%
dyOptions(axisLineWidth = 2.0, colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightSeriesBackgroundAlpha = 1.0,
highlightSeriesOpts = list(strokeWidth = 3)) %>%
dyRangeSelector(height = 130)
```
Row {data-height=400}
-------------------------------------
### Tabular View
```{r}
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"Dividend Yield",
"Market Capitalization"))
tickers <- c("FB", "ORCL", "IBM", "SAP")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
metrics <- data.frame(Symbol=tickers,metrics[,2:length(metrics)])
colnames(metrics) <- c("Symbol", "Revenue Multiple", "Earnings Multiple", "Div Yield", "Market Cap")
DT::datatable(metrics)
```
Individual Stock Analysis
==============================
Inputs {.sidebar}
-----------------------------------------------------------------------
### Analysis
The moving average (MA) is an analysis tool that smooths out price data by creating a constantly updated average price.
In the figures on the right, the 20-day moving average more closely tracks the actual price than the 50-day moving average does.
The 20-day may be of analytical benefit to a shorter-term trader since it follows the price more closely than the longer-term moving average.
Among the four companies, the 20-day moving average of Facebook (FB) is above the 50-day moving average in the past weeks. This indicates that it is in an uptrend.
```{r}
StockPrice <- c("FB", "IBM", "ORCL", "SAP") %>%
tq_get(get = "stock.prices", from = "2015-02-01", to = "2020-02-01")
FB <- subset(StockPrice, symbol == 'FB')
IBM <- subset(StockPrice, symbol == 'IBM')
ORCL <- subset(StockPrice, symbol == 'ORCL')
SAP <- subset(StockPrice, symbol == 'SAP')
# Setup dates for zoom window
end <- ymd("2020-02-01")
start <- end - weeks(20)
```
Row {.tabset .tabset-fade}
-----------------------------------------------------------------------
### FB
```{r}
# Create chart
FB %>%
ggplot(aes(x = date, y = close)) +
geom_candlestick(aes(open = open, close = close, high = high, low = low)) +
geom_ma(ma_fun = SMA, n = 20, color = 'green', size = 1) +
geom_ma(ma_fun = SMA, n = 50, color = 'blue', linetype = 4, size = 1) +
labs(title = "FB: Stock Price with Moving Averages",
subtitle = "Green: 20-Day Blue: 50-day",
x = "", y = "Closing Price") +
coord_x_date(xlim = c(start, end),
ylim = c(170, 230))
```
### IBM
```{r}
# Create chart
IBM %>%
ggplot(aes(x = date, y = close)) +
geom_candlestick(aes(open = open, close = close, high = high, low = low)) +
geom_ma(ma_fun = SMA, n = 20, color = "green", size = 1) +
geom_ma(ma_fun = SMA, n = 50, color = "blue", linetype = 4, size = 1) +
labs(title = "IBM: Stock Price with Moving Averages",
subtitle = "Green: 20-Day Blue: 50-day",
x = "", y = "Closing Price") +
coord_x_date(xlim = c(start, end),
ylim = c(110, 170))
```
### ORCL
```{r}
# Create chart
ORCL %>%
ggplot(aes(x = date, y = close)) +
geom_candlestick(aes(open = open, close = close, high = high, low = low)) +
geom_ma(ma_fun = SMA, n = 20, color = "green", size = 1) +
geom_ma(ma_fun = SMA, n = 50, color = "blue", linetype = 4, size = 1) +
labs(title = "ORCL: Stock Price with Moving Averages",
subtitle = "Green: 20-Day Blue: 50-day",
x = "", y = "Closing Price") +
coord_x_date(xlim = c(start, end),
ylim = c(50, 60))
```
### SAP
```{r}
# Create chart
SAP %>%
ggplot(aes(x = date, y = close)) +
geom_candlestick(aes(open = open, close = close, high = high, low = low)) +
geom_ma(ma_fun = SMA, n = 20, color = "green", size = 1) +
geom_ma(ma_fun = SMA, n = 50, color = "blue", linetype = 4, size = 1) +
labs(title = "SAP: Stock Price with Moving Averages",
subtitle = "Green: 20-Day Blue: 50-day",
x = "", y = "Closing Price") +
coord_x_date(xlim = c(start, end),
ylim = c(100,150))
```
Weekly Returns
==============================
```{r}
StockPrice %>%
filter(date >= as_date("2019-09-01")) %>%
group_by(symbol) %>%
tq_transmute(adjusted, periodReturn, period = "weekly", col_rename = "Weekly.Returns") %>%
ggplot(aes(x = date, y = Weekly.Returns, fill = symbol)) +
geom_bar(position = "dodge", stat = "identity") +
scale_y_continuous(labels = scales::percent) +
labs(title = "Weekly Returns",
x = "Date") +
theme(legend.position = "bottom")
```
Summary
==============================
Looking at the stock closing metrics, we can conclude that Facebook is standing out from the other three companies for the Market Cap. Facebook and SAP have stronger performance in Revenue Multiple and earnings Multiple than the other two.
From the historical plots dated back to January 2019, there has been an increasing stock closing price trend for SAP since the beginning of the year. Oracle and IBM shared a similar trend. Facebook has had a few drops but come back with stronger performance since early June this year.
Compared against all other three, Facebook has the highest price point.