Objective

Requirement:

Delineate the necessary decision (I will do that below).

Identify what information will be relevant to decision making.

Find and collect the data necessary to create your visualization plan.

Organize and summarize the collected data.

Design and create the best visualizations to present that information.

Finally organize the layout of those visualizations in a way that conforms to the theory of dashboarding.

Write a summary about what decisions you made based on the visualizations that you developed.

My plan:

I intend to analyze my recent investments. Target companies include: Tesla (TSLA), Alphabet (GOOG), Amazon (AMZN), and Dell (DELL). I collect data from Yahoo Finance and focus on Stock Key Performance Metrics, historical stock closing price, and the historical Candlestick information for sound quantitative decision-making for the future.

Summary

Column

Stock Key Performance Metrics


Stock Closing Prices

[1] "TSLA" "GOOG" "AMZN" "DELL"

Analysis of the 4 stocks

Candlestick

TSLA

[1] "TSLA"

GOOG

[1] "GOOG"

AMZN

[1] "AMZN"

DELL

[1] "DELL"

Conclusion

Based on the P/E Ratio and Market Cap, AMZN and TSLA serve as the more appealing candidates compared to the other two stocks. However, AMZN is better than TSLA based on the EPS and stocks historical closing price plot.

---
title: "ANLY 512 Lab 1 - Dashboards and Dashboard Theory"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    source_code: embed
---

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

-----------------------------------------------------------------------

# Objective

Requirement:

Delineate the necessary decision (I will do that below).

Identify what information will be relevant to decision making.

Find and collect the data necessary to create your visualization plan.

Organize and summarize the collected data.

Design and create the best visualizations to present that information.

Finally organize the layout of those visualizations in a way that conforms to the theory of dashboarding.

Write a summary about what decisions you made based on the visualizations that you developed.


My plan:

I intend to analyze my recent investments. Target companies include: Tesla (TSLA),  Alphabet (GOOG), Amazon (AMZN), and Dell (DELL). I collect data from Yahoo Finance and focus on Stock Key Performance Metrics, historical stock closing price, and the historical Candlestick information for sound quantitative decision-making for the future.


# Summary

## Column

### Stock Key Performance Metrics 

```{r}
what_metrics <- yahooQF(c("Price/Sales", 
                          "P/E Ratio",
                          "Price/EPS Estimate Next Year",
                          "PEG Ratio",
                          "Dividend Yield", 
                          "Market Capitalization"))

tickers <- c("TSLA", "GOOG", "AMZN", "DELL")
# 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")

#Export financial stock key performance metrics to a csv file
write.csv(metrics, "FinancialMetrics.csv", row.names=FALSE)
DT::datatable(metrics)
```

-----------------------------------------------------------------------

### Stock Closing Prices

```{r}
getSymbols(tickers, from="2017-01-01", to="2022-10-01")
ClosingPrices <- do.call(merge, lapply(tickers, function(x) Cl(get(x))))
dateperiod<-c("2017-01-01", "2022-10-01")
dygraph(ClosingPrices, main="Closing Price in Dollars", group="Stock") %>%
  dyAxis("y", label="Closing Price(USD)") %>%
  dyOptions(axisLineWidth = 1.5,  colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
  dyHighlight(highlightSeriesBackgroundAlpha = 1.0, highlightSeriesOpts = list(strokeWidth = 3)) %>%
  dyRangeSelector(height = 50)
```

## Column {.sidebar}

Generally, a high P/E ratio means that investors are anticipating higher growth in the future. The current average market P/E ratio is roughly 20 to 25 times earnings. Companies that are losing money do not have a P/E ratio. However, a stock with a high P/E ratio is not necessarily a better investment than one with a lower P/E ratio, as a high P/E ratio can indicate that the stock is being overvalued. All the four stocks looks good to me based on the P/E ratio, especially AMZN and TSLA

A company's earnings per share, or EPS, is found by taking net income (or profits) divided by the shares of common stock outstanding. This measure allows the analyst to understand the amount of money left over for each share of stock issued to the public. So the future earnings estimates are arguably the most important input when attempting to value a firm. Based on this, AMZN seems to be an good option.


# Analysis of the 4 stocks

## Candlestick {.tabset data-width=650}

### TSLA

```{r}
getSymbols("TSLA", src = "yahoo", from='2017-01-01')
TSLA_x <- TSLA
dygraph(TSLA_x[, -5], main = "TSLA") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Daily Stock Closing Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
  dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 60)
```

### GOOG

```{r}
getSymbols("GOOG", src = "yahoo", from='2017-01-01')
GOOG_x <- GOOG
dygraph(GOOG_x[, -5], main = "GOOG") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Daily Stock Closing Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
  dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 60)
```

### AMZN

```{r}
getSymbols("AMZN", src = "yahoo", from='2017-01-01')
AMZN_x <- AMZN
dygraph(AMZN_x[, -5], main = "AMZN") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Daily Stock Closing Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
  dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 60)
```

### DELL

```{r}
getSymbols("DELL", src = "yahoo", from='2017-01-01')
DELL_x <- DELL
dygraph(DELL_x[, -5], main = "DELL") %>%
  dyCandlestick() %>%
  dyAxis("y", label="Daily Stock Closing Price") %>%
  dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
  dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
  dyRangeSelector(height = 60)
```

## Analysis {.sidebar}

From the previous analysis, I can tell that AMZN and TSLA are both good options, relatively speaking. 
With the recent crackdown on Tech companies from the Chinese government and further tightening of foreign investments, the market is expecting more fluctuation in the industry.

TSLA also seems like a good option to invest for the sake of garnishing short term gains.


# Conclusion

Based on the P/E Ratio and Market Cap, AMZN and TSLA serve as the more appealing candidates compared to the other two stocks. However, AMZN is better than TSLA based on the EPS and stocks historical closing price plot.