Column

P-E Ratio - It is the ratio of a company’s share price to the company’s earnings per share. This ratio is used for valuing companies and to find out whether they are overvalued or undervalued.

EPS - It is the portion of a company’s profit that is allocated to every individual share of the stock and helps in understanding the financial strength of a company

Dividend Yield Ratio - is a financial ratio that shows how much a company pays out in dividends each year relative to its stock price.

Market Cap - the total value of a company’s shares.

Key Indicator Analysis

Stock Prices

Column

Amazon (AMZN)

Mastercard (MA)

Coca-Cola (KO)

NVDA (NVDA)

Adjusted Closing Prices

Column

Adjusted Closing Prices for Amazon, Mastercard, CocaCola and NVDA

Trading Volumes

Column

Trading Volumes for Amazon, Mastercard, NVDA and CocaCola

Summary

Column

By analyzing key indicators such as “P/E Ratio”, “Price/EPS Estimate Next Year”, “Dividend Yield” and “Market Capitalization” to compare four different companies’ performance

Amazon has the highest P-E Ratio (89.16), which means that investors are expecting higher earnings growth in the future, then followed by NVDA (51.82), Mastercard (38.2) and CocaCola (26.72).

According to EPS, Amazon is also the highest one with 60.36, which indicates how much money a company makes for each share of its stock, followed by NVDA (44.83), Mastercard (31.45) and CocaCola (23.89).

Based on dividend yield, CocaCola has the highest (2.9%), followed by Mastercard (0.51%), NVDA (0.08%) and Amazon (0%), which indicates though CocaCola is not favorable in terms of P-E Ratio nor EPS, its high Dividend yield is good for investors to gain dividends.

From the market capitalization perspective, Amazon is the highest, followed by NVDA and Mastercard. Overall, from the key indicators, Amazon is a better company to invest in among others, then NVDA, Mastercard and CocaCola.

I analyzed about 5 years of financial data for 4 companies- Amazon(AMZN), Mastercard (MA), CocaCola (KO) and NVDA (NVDA). The data was sourced from Yahoo Finance and the time period of the data is from January 2018 to January 2023.

Stock Prices tab provides a graphical representation of the daily open and closing stock prices, along with the daily low and high for each of the 4 companies. The second tab (Adjusted Closing Prices) compares the closing stock prices of all the 4 companies. The third tab (Trading Volumes) compares the trends in trading volumes of all the 4 companies. In this tab, I will discuss the results and conclusions.

Amazon and Mastercard’s stock prices have risen significantly since 2017 and the upward trend looks sustainable over the long-term. CocaCola on the other hand, experience smaller growth but stay quite sustainable over time. On the other hand, NVDA were subject to severe fluctuations and seem to be highly volatile. There has been some huge declining for all four stocks throughout 2022. As of Jan 2023, the adjusted closing price for Mastercard is the highest at around $340, followed by NVDA at $320, Amazon at $90 and CocaCola at around $50. Amazon and NVDA lead in terms of trading volume but they are subject to more votality.

Considering this from short term perspective, I recommend investing in Mastercard, followed by Amazon and NVDA.However, I may want to consider CocaCola if the goals is also gaining more dividends.


---
title: "ANLY 512 LAB 1"
author: "Tin Bui"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    social: menu
    source_code: embed
    vertical_layout: fill
  html_document:
    df_print: paged
---    
Column {data-width=600}
-------------------------------------
P-E Ratio - It is the ratio of a company's share price to the company's earnings per share. This ratio is used for valuing companies and to find out whether they are overvalued or undervalued.

EPS - It is the portion of a company's profit that is allocated to every individual share of the stock and helps in understanding the financial strength of a company

Dividend Yield Ratio - is a financial ratio that shows how much a company pays out in dividends each year relative to its stock price.

Market Cap - the total value of a company's shares.


Key Indicator Analysis
=====================================

```{r}
library(quantmod)
library(plyr)
library(DT)
library(tidyquant)
library(dplyr)
library(highcharter)
library(viridisLite)
library(ggplot2)
library(broom)
library(xts)
library(zoo)
what_metrics <- yahooQF(c("Price/Sales", 
                          "P/E Ratio",
                          "Price/EPS Estimate Next Year",
                          "PEG Ratio",
                          "Dividend Yield", 
                          "Market Capitalization"))
tickers <- c("AMZN", "MA", "KO", "NVDA")
metrics <- getQuote(paste(tickers, sep = ",", collapse = ";"), what = what_metrics)
metrics <- data.frame(Symbol = tickers, metrics[,2:length(metrics)])
colnames(metrics) <- c("Symbol", "P-E Ratio", "EPS", "Dividend Yield Ratio", "Market Cap")
DT::datatable(metrics)

```


Stock Prices
=====================================

```{r setup, include=FALSE}
chooseCRANmirror(graphics=FALSE, ind=1)
library(flexdashboard)
library(pdfetch)
library(dygraphs)
library(xts)
identifiers <- c("AMZN", "MA", "KO", "NVDA")
```


Column {.tabset data-height=550}
-----------------------------------------------------------------------

### Amazon (AMZN)

```{r}
Amazon <- pdfetch_YAHOO("AMZN", fields = c("open", "high", "low", "close"), from = as.Date("2018-01-01"),interval = "1d")
colnames(Amazon)=c("Open","High","Low","Close")

x <- tail(Amazon, n = 1500)

#plot
dygraph(x,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
dyCandlestick() %>%
dyLegend(width = 400) %>%
dyRangeSelector()
```


### Mastercard (MA)

```{r}
Mastercard <- pdfetch_YAHOO("MA", fields = c("open", "high", "low", "close"), from = as.Date("2018-01-01"),interval = "1d")
colnames(Mastercard)=c("Open","High","Low","Close")

x <- tail(Mastercard, n = 1500)

#plot
dygraph(x,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
dyCandlestick() %>%
dyLegend(width = 400) %>%
dyRangeSelector()
```


### Coca-Cola (KO)

```{r}
CocaCola <- pdfetch_YAHOO("KO", fields = c("open", "high", "low", "close"), from = as.Date("2018-01-01"),interval = "1d")
colnames(CocaCola)=c("Open","High","Low","Close")

x <- tail(CocaCola, n = 1500)

#plot
dygraph(x,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
dyCandlestick() %>%
dyLegend(width = 400) %>%
dyRangeSelector()
```

### NVDA (NVDA)

```{r}
NVDA <- pdfetch_YAHOO("NVDA", fields = c("open", "high", "low", "close"), from = as.Date("2018-01-01"),interval = "1d")
colnames(NVDA)=c("Open","High","Low","Close")

x <- tail(NVDA, n = 1500)

#plot
dygraph(x,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
dyCandlestick() %>%
dyLegend(width = 400) %>%
dyRangeSelector()
```


Adjusted Closing Prices
=====================================

Column {.tabset data-height=550}
-----------------------------------------------------------------------

### Adjusted Closing Prices for Amazon, Mastercard, CocaCola and NVDA
```{r}
financialData <- pdfetch_YAHOO(identifiers, fields = c("open","adjclose"), from = as.Date("2018-01-01"), interval = "1d")

Adj_close <- cbind(financialData$AMZN.adjclose,financialData$MA.adjclose, financialData$KO.adjclose, financialData$NVDA.adjclose)
colnames(Adj_close) <-c("AMZN","MA","KO", "NVDA")

x <- tail(Adj_close, n = 1500)

#plot
dygraph(x,
        main = "Adjusted Closing Price", 
        ylab = "Closing Price ($)",
        group = "trading") %>%
dyOptions(strokeWidth = 2,colors = RColorBrewer::brewer.pal(5, "Set2"))%>%
dyHighlight(highlightCircleSize = 3, 
              highlightSeriesBackgroundAlpha = 0.2,
              hideOnMouseOut = TRUE)%>%
dyLegend(width = 400) %>%
dyRangeSelector()
```


Trading Volumes
=====================================

Column {.tabset data-height=550}
-----------------------------------------------------------------------

### Trading Volumes for Amazon, Mastercard, NVDA and CocaCola
```{r}
financialData <- pdfetch_YAHOO(identifiers, fields = c("open", "high", "low", "close","volume","adjclose"), from = as.Date("2017-01-01"),interval = "1d")

Trade_vol <- cbind(financialData$AMZN.volume,financialData$MA.volume, financialData$KO.volume, financialData$NVDA.volume)
colnames(Trade_vol) <-c("AMZN","MA","KO", "NVDA")

x <- tail(Trade_vol, n = 1500)

#plot
dygraph(x,
        main = "Trading Volume", 
        ylab = "Volume",
        group = "trading") %>%
dyOptions(strokeWidth = 2,colors = RColorBrewer::brewer.pal(5, "Set2"))%>%
dyHighlight(highlightCircleSize = 3, 
              highlightSeriesBackgroundAlpha = 0.2,
              hideOnMouseOut = TRUE)%>%
dyLegend(width = 400) %>%
dyRangeSelector()
```

Summary 
=====================================


Column {data-width=600}
-------------------------------------

###

By analyzing key indicators such as “P/E Ratio”, “Price/EPS Estimate Next Year”, "Dividend Yield" and “Market Capitalization” to compare four different companies' performance

Amazon has the highest P-E Ratio (89.16), which means that investors are expecting higher earnings growth in the future, then followed by NVDA (51.82), Mastercard (38.2) and CocaCola (26.72). 

According to EPS, Amazon is also the highest one with 60.36, which indicates how much money a company makes for each share of its stock, followed by NVDA (44.83), Mastercard (31.45) and CocaCola (23.89). 

Based on dividend yield, CocaCola has the highest (2.9%), followed by Mastercard (0.51%), NVDA (0.08%) and Amazon (0%), which indicates though CocaCola is not favorable in terms of P-E Ratio nor EPS, its high Dividend yield is good for investors to gain dividends. 

From the market capitalization perspective, Amazon is the highest, followed by NVDA and Mastercard. Overall, from the key indicators, Amazon is a better company to invest in among others, then NVDA, Mastercard and CocaCola.


I analyzed about 5 years of financial data  for 4 companies- Amazon(AMZN), Mastercard (MA), CocaCola (KO) and NVDA (NVDA). The data was sourced from Yahoo Finance and the time period of the data is from January 2018 to January 2023.

Stock Prices tab provides a graphical representation of the daily open and closing stock prices, along with the daily low and high for each of the 4 companies. The second tab (Adjusted Closing Prices) compares the closing stock prices of all the 4 companies. The third tab (Trading Volumes) compares the trends in trading volumes of all the 4 companies. In this tab, I will discuss the results and conclusions.

Amazon and Mastercard's stock prices have risen significantly since 2017 and the upward trend looks sustainable over the long-term. CocaCola on the other hand, experience smaller growth but stay quite sustainable over time. On the other hand, NVDA were subject to severe fluctuations and seem to be highly volatile. There has been some huge declining for all four stocks throughout 2022. As of Jan 2023, the adjusted closing price for Mastercard is the highest at around $340, followed by NVDA at $320, Amazon at $90 and CocaCola at around $50. Amazon and NVDA lead in terms of trading volume but they are subject to more votality. 

Considering this from short term perspective, I recommend investing in Mastercard, followed by Amazon and NVDA.However, I may want to consider CocaCola if the goals is also gaining more dividends.