Stock Price

Column

Coca-Cola

Delta Airlines

KraftHeinz

Occidental Petroleum

Day Trading

Column

Day High’s for Coca-Cola, Delta Airlines, Kraft Heinz and Occidental Petroleum

Trading Volumes

Column

Trading Volumes for Coca-Cola, Delta Airlines, Kraft Heinz and Occidental Petroleum

Summary

Column

What did I learn

The lab exercise had been really helpful and during the process I learned a lot new about Data Visualization with real-time data, In these excersice a dashboard I developed using Yahoo financial for the last quarters and analyze out of four different sector stocks what would be the best to buy and earn some profit in short term. The Airline stock for sure is not a buy and mostly displays to sell, the beverage stock is medicore which would a safe choice for a long term and petroleum is flucuating which can be profitable but in short term but its too risky, the final stock that would be safe and would make money in short term is kraft heinz as people because of hoarding food supplies during pandemic. To conclude, it has been a really productive exercise to visualize data which changes every second than to see it in tabular form.

---
title: "ANLY 512 Lab 1"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    social: menu
    source_code: embed
    vertical_layout: fill
  html_document:
    df_print: paged
---

```{r setup, include=FALSE}
library(dygraphs)
library(flexdashboard)
library(pdfetch)
library(xts)
tickers <- c("KO","DAL","KHC","OXY")
```
  Stock Price
=====================================


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

### Coca-Cola

```{r}

cola <- pdfetch_YAHOO("KO", fields = c("open", "high", "low", "close"), from = as.Date("2020-02-01"),interval = "1d")
colnames(cola)=c("Open","High","Low","Close")

dygraph(cola,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
  dyCandlestick() %>%
  dyLegend(width = 250) %>%
  dyRangeSelector()

```


### Delta Airlines

```{r}

delta <- pdfetch_YAHOO("DAL", fields = c("open", "high", "low", "close"), from = as.Date("2020-02-01"),interval = "1d")
colnames(delta)=c("Open","High","Low","Close")

dygraph(delta,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
  dyCandlestick() %>%
  dyLegend(width = 250) %>%
  dyRangeSelector()

```


### KraftHeinz

```{r}

kraft <- pdfetch_YAHOO("KHC", fields = c("open", "high", "low", "close"), from = as.Date("2020-02-01"),interval = "1d")
colnames(kraft)=c("Open","High","Low","Close")

dygraph(kraft,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
  dyCandlestick() %>%
  dyLegend(width = 250) %>%
  dyRangeSelector()

```


### Occidental Petroleum

```{r}

oxy <- pdfetch_YAHOO("OXY", fields = c("open", "high", "low", "close"), from = as.Date("2020-02-01"),interval = "1d")
colnames(oxy)=c("Open","High","Low","Close")

dygraph(oxy,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
  dyCandlestick() %>%
  dyLegend(width = 250) %>%
  dyRangeSelector()

```

  Day Trading  
=====================================

Column {.tabset data-height=550}
-----------------------------------------------------------------------
### Day High's for Coca-Cola, Delta Airlines, Kraft Heinz and Occidental Petroleum
```{r}

dayHigh <- pdfetch_YAHOO(tickers, fields = c("open","high"), from = as.Date("2020-01-01"), interval = "1d")
high <- cbind(dayHigh$KO.high, dayHigh$DAL.high, dayHigh$KHC.high, dayHigh$OXY.high)
colnames(high) <-c("KO","DAL","KHC", "OXY")

dygraph(high,
        main = "Day Trading Analysis for Short Term", 
        ylab = " (Max value for a single day $)",
        group = "trades") %>%
  dyOptions(strokeWidth = 2,colors = RColorBrewer::brewer.pal(5, "Set2"))%>%
  dyHighlight(highlightCircleSize = 3, 
              highlightSeriesBackgroundAlpha = 0.2)%>%
  dyLegend(width = 400) %>%
  dyRangeSelector()

```

Trading Volumes
=====================================
  
  Column {.tabset data-height=550}
-----------------------------------------------------------------------
  
### Trading Volumes for Coca-Cola, Delta Airlines, Kraft Heinz and Occidental Petroleum
```{r}
fd <- pdfetch_YAHOO(tickers, fields = c("open", "high", "low", "close","volume","adjclose"), from = as.Date("2020-01-01"),interval = "1d")

tradeVolume <- cbind(fd$KO.volume, fd$DAL.volume, fd$KHC.volume, fd$OXY.volume)
colnames(tradeVolume) <-c("KO","DAL","KHC", "OXY")

dygraph(tradeVolume,
        main = "Trading Volume", 
        ylab = "Volume",
        group = "trades") %>%
  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}
-------------------------------------
  
### What did I learn

The lab exercise had been really helpful and during the process I learned a lot new about Data Visualization with real-time data, In these excersice a dashboard I developed using Yahoo financial for the last quarters and analyze out of four different sector stocks what would be the best to buy and earn some profit in short term. The Airline stock for sure is not a buy and mostly displays to sell, the beverage stock is medicore which would a safe choice for a long term and petroleum is flucuating which can be profitable but in short term but its too risky, the final stock that would be safe and would make money in short term is kraft heinz as people because of hoarding food supplies during pandemic. To conclude, it has been a really productive exercise to visualize data which changes every second than to see it in tabular form.