Based on the visualizations of the stock trends over the past 5 years and the past few months, I have determined that in terms of short term gains, Honda (HMC) is the company that will produce the most. Ford (F) and Toyota (TM) both show a recent downturn in their stock price, which I see no reason to expect to change in the short term. Tesla (TSLA), while the stock price is the highest, is far too volatile to accurately measure the short term gains. It is simply not possible with the data on hand to determine if the Tesla stock price will go up or down on any given day, and seeing that short term goals are what we have in mind, this volatility should exclude Tesla from consideration. Finally, the best company in terms of short term gains, Honda (HMC) is currently experiencing a fairly consistent stock price climb, which I expect to continue over the coming months. This indicates that Honda is a good and viable choice to pursue in regards to investment.
If we would like to consider a longer-term investment than a few months, then I believe that Toyota is a good candidate for investment. While the company has seen a recent downturn, over the course of the past five years Toyota has shown moderate growth, increasing from about 125 per share to 136 per share. While it must be mentioned that Tesla would appear to be an attractive option based on the 5 year growth of the stock (from about $18 per share to $192 per share), caution should still be exercised in regard to investment in this stock. As previously stated, the stock is incredibly volatile, and it is difficult to predict any consistent growth based on the data available. In addition, the rise of EV competition from the other automotive companies stands to affect Tesla’s market share and dominance, which in turn could result in the stock price falling.
---
title: 'ANLY 512: Lab 1'
author: "Silmi Jariwalla"
date: "2023-03-24"
output:
flexdashboard::flex_dashboard:
source_code: embed
orientation: columns
vertical_layout: fill
---
```{r,echo, include=FALSE}
library(ggplot2)
library(knitr)
library(flexdashboard)
library(quantmod)
library(plyr)
library(dplyr)
library(DT)
library(xts)
library(dygraphs)
library(lubridate)
```
Column {data-width=650}
-------------------------------------------------------
### 5-Year Trends
```{r, echo=FALSE, message=FALSE}
ticker = c("F", "TSLA", "TM", "HMC")
invisible(getSymbols(ticker, from="2018-03-24", to="2023-03-24"))
closingPrices=do.call(merge,lapply(ticker,function(x)Cl(get(x))))
datePeriod=c("2018-03-24","2023-03-24")
dygraph(closingPrices, main="5-Year Stock Trends for Major Automotive Companies", group="Stock") %>%
dyAxis("y",label="Closing Price") %>%
dyOptions(colors=RColorBrewer::brewer.pal(4, "Set2")) %>%
dyHighlight(highlightCircleSize = 3.5, highlightSeriesBackgroundAlpha = 1, highlightSeriesOpts = list(strokeWidth=3)) %>%
dyRangeSelector(height=40)
```
Column {.tabset data-width=550}
-----------------------------------------------------
### Table View
```{r , echo=FALSE, message=FALSE}
what_metrics = yahooQF(c("Price/Sales","P/E Ratio", "Price/EPS Estimate Next Year", "PEG Ratio", "Dividend Yield", "Market Capitalization"))
tickers = c("F","TSLA","TM","HMC")
metrics = getQuote(paste(tickers,sep="",collapse=";"), what=what_metrics)
metrics = data.frame(Symbol=tickers,metrics[,2:length(metrics)])
colnames(metrics)=c("Symbol", "Earnings Multiple", "Earnings Multiple (Forward)", "Div Yield", "Market Cap")
#datatable(head(metrics, 20), options = list(initComplete = JS(function(settings, json) {(this.api().table().header()).css({'background-color': 'grey', 'color': '#fff'});})))
DT::datatable(metrics)
```
### Ford
```{r}
invisible(getSymbols("F", src = "yahoo", from='2018-03-24'))
F_x <- F
dygraph(F_x[, -5], main = "Ford") %>%
dyCandlestick() %>%
dyAxis("y", label="Closing Price") %>%
dyOptions(colors= RColorBrewer::brewer.pal(4, "Set2")) %>%
dyHighlight(highlightCircleSize = 3.5,
highlightSeriesOpts = list(strokeWidth = 3),
highlightSeriesBackgroundAlpha = 1) %>%
dyRangeSelector(height = 40)
```
### Tesla
```{r}
invisible(getSymbols("TSLA", src = "yahoo", from='2018-03-24'))
TSLA_x <- TSLA
dygraph(TSLA_x[, -5], main = "Tesla") %>%
dyCandlestick() %>%
dyAxis("y", label="Closing Price") %>%
dyOptions(colors= RColorBrewer::brewer.pal(4, "Set2")) %>%
dyHighlight(highlightCircleSize = 3.5,
highlightSeriesOpts = list(strokeWidth = 3),
highlightSeriesBackgroundAlpha = 1) %>%
dyRangeSelector(height = 40)
```
### Toyota
```{r}
invisible(getSymbols("TM", src = "yahoo", from='2018-03-24'))
TM_x <- TM
dygraph(TM_x[, -5], main = "Toyota") %>%
dyCandlestick() %>%
dyAxis("y", label="Closing Price") %>%
dyOptions(colors= RColorBrewer::brewer.pal(4, "Set2")) %>%
dyHighlight(highlightCircleSize = 3.5,
highlightSeriesOpts = list(strokeWidth = 3),
highlightSeriesBackgroundAlpha = 1) %>%
dyRangeSelector(height = 40)
```
### Honda
```{r}
invisible(getSymbols("HMC", src = "yahoo", from='2018-03-24'))
HMC_x <- HMC
dygraph(HMC_x[, -5], main = "Honda") %>%
dyCandlestick() %>%
dyAxis("y", label="Closing Price") %>%
dyOptions(colors= RColorBrewer::brewer.pal(4, "Set2")) %>%
dyHighlight(highlightCircleSize = 3.5,
highlightSeriesOpts = list(strokeWidth = 3),
highlightSeriesBackgroundAlpha = 1) %>%
dyRangeSelector(height = 40)
```
### Summary/Findings
Based on the visualizations of the stock trends over the past 5 years and the past few months, I have determined that in terms of short term gains, Honda (HMC) is the company that will produce the most. Ford (F) and Toyota (TM) both show a recent downturn in their stock price, which I see no reason to expect to change in the short term. Tesla (TSLA), while the stock price is the highest, is far too volatile to accurately measure the short term gains. It is simply not possible with the data on hand to determine if the Tesla stock price will go up or down on any given day, and seeing that short term goals are what we have in mind, this volatility should exclude Tesla from consideration. Finally, the best company in terms of short term gains, Honda (HMC) is currently experiencing a fairly consistent stock price climb, which I expect to continue over the coming months. This indicates that Honda is a good and viable choice to pursue in regards to investment.
If we would like to consider a longer-term investment than a few months, then I believe that Toyota is a good candidate for investment. While the company has seen a recent downturn, over the course of the past five years Toyota has shown moderate growth, increasing from about 125 per share to 136 per share. While it must be mentioned that Tesla would appear to be an attractive option based on the 5 year growth of the stock (from about $18 per share to $192 per share), caution should still be exercised in regard to investment in this stock. As previously stated, the stock is incredibly volatile, and it is difficult to predict any consistent growth based on the data available. In addition, the rise of EV competition from the other automotive companies stands to affect Tesla's market share and dominance, which in turn could result in the stock price falling.