---
title: "Securities Analysis"
author: "Sumanth Jinagouda"
date: "April 12, 2018"
output:
flexdashboard::flex_dashboard:
source_code: embed
---
Column {data-width = 600}
-------------------------------------
### Adjusted Closing Stock Price over last five weeks
```{r chart1, include=TRUE}
library(ggplot2)
library(ggthemes)
AAPL <- read.csv("C:\\Users\\shrin\\OneDrive\\Harrisburg\\Data Visualization\\AAPL.csv", header=T, na.strings=c(""," ","NA"))
MSFT <- read.csv("C:\\Users\\shrin\\OneDrive\\Harrisburg\\Data Visualization\\MSFT.csv", header=T, na.strings=c(""," ","NA"))
TWTR <- read.csv("C:\\Users\\shrin\\OneDrive\\Harrisburg\\Data Visualization\\TWTR.csv", header=T, na.strings=c(""," ","NA"))
AAPL$what <- "AAPL"
MSFT$what <- "MSFT"
TWTR$what <- "TWTR"
stock_price <- do.call(rbind, list(AAPL, MSFT, TWTR))
ggplot(stock_price, aes(x = Date, y = Closing_Price)) + geom_point(aes(colour=what, group = what)) + geom_line(aes(group = what, colour=what), alpha=0.3) + geom_text(aes(y = Closing_Price, label = Closing_Price),hjust=0, vjust=0, parse = TRUE) + ylab("Adjusted Closing Stock Price") + theme(axis.text.x=element_blank()) + xlab("Last 5 Weeks") + theme_economist_white() + theme(legend.title = element_blank()) + theme(axis.text.x=element_blank(),axis.ticks.x=element_blank())
```
Column {data-width=400}
-------------------------------------
### Market Capitalization for 2017
```{r chart2, include=TRUE}
library(quantmod)
library(plyr)
library(ggthemes)
what_metrics <- yahooQF(c("P/E Ratio",
"Price/EPS Estimate Next Year",
"Dividend Yield",
"Market Capitalization",
"50-day Moving Average"))
tickers <- c("AAPL", "MSFT", "TWTR")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
metrics <- data.frame(Symbol=tickers, metrics[,2:length(metrics)])
ggplot(metrics, aes(x = Symbol)) + geom_bar(aes(y = Market.Capitalization, fill = Symbol ), stat = "identity") + theme(axis.text.x=element_blank()) + xlab("Company") + theme_economist_white() + theme(legend.title = element_blank())
```
### P/E Ratio for years 2017 and 2018(projected)
```{r chart3, include=TRUE}
ggplot(metrics, aes(x = Symbol)) + geom_point(aes(y = P.E.Ratio, colour = Symbol)) + geom_text(aes(y = P.E.Ratio, label = paste(P.E.Ratio," - 2017",sep = "")),hjust=0, vjust=0, parse = TRUE) + geom_point(aes(y = Price.EPS.Estimate.Next.Year, colour = Symbol)) + geom_text(aes(y = Price.EPS.Estimate.Next.Year, label = paste(Price.EPS.Estimate.Next.Year," - 2018",sep = "")),hjust=0, vjust=0) + theme(axis.text.x=element_blank()) + xlab("Company") + theme_economist_white() + theme(legend.title = element_blank())
```