Intro


Global Index Performance in the 21st Century

By Joseph Connolly

Professor Charley Ferrari

CUNY SPS, MSDS: Data 608

Spring, 2022



This final project for Data 608, Knowledge and Visual Analytics, at the CUNY School of Professional Studies, entails a Flexdashboard to visualize and display the performance of global indexes in the 21st Century. From Kaggle.com, I downloaded and imported a global index dataset that contains stock information ranging from 1965-2021. This was cleaned and sub-setted to only include data onward from December 31st, 1999


Included in this application is a simple Shiny app that shows the summaries of all indexes from the dataset. You may access it via the link embedded in ShinySummaries


Data Source: kaggle.com


This application is for academic purposes only

Price and Volume


Closing Prices and Volume

Instructions


Click on the icons within the “Index” key to customize which indexes are displayed on the graph


Draw a box to zoom in and see a shorter time frame

Row


Indexes

The time frame is adjustable by dragging the “time window” from the left and right towards the center. This renders a closer view of each indexes’ performance.



Row


Row


Row


Row


Row


Row

---
title: "Indexes in the 21st Century"
author: "Joseph Connolly"
output: 
  flexdashboard::flex_dashboard:
    theme: readable
    orientation: rows
    social: menu
    source_code: embed
---


```{r setup, include = FALSE}
library(ggplot2)
library(plotly)
library(plyr)
library(flexdashboard)
library(quantmod)
library(TTR)
library(shiny)
library(htmltools)
library(purrr)
library(rsconnect)

setwd("C:/Users/jmcon/OneDrive/D608_FP")

markets <- read.csv("https://raw.githubusercontent.com/jconno/R-data/master/indexProcessed.csv")

markets$macd <- MACD(markets$Close, nFast = 12, nSlow = 26, nSig = 9)
markets$sma <- SMA(markets$Close, n=12)

#tibble::view(markets)


# Factor Index column
factorize <- c("Index")
markets[factorize] <- lapply(markets[factorize], factor)

# As.Date
markets$Date <- as.Date(markets$Date)
markets <- markets %>% filter(Date > "1999-12-31")

# Subsetting Indexes

sz.399001 <- markets %>% filter(Index == "399001.SZ")
ss.000001 <- markets %>% filter(Index == "000001.SS")
gdaxi <- markets %>% filter(Index == "GDAXI")
gsptse <- markets %>% filter(Index == "GSPTSE")
hsi <- markets %>% filter(Index == "HSI")
ixic <- markets %>% filter(Index == "IXIC")
J203.JO <- markets %>% filter(Index == "J203.JO")
n100 <- markets %>% filter(Index == "N100")
n225 <- markets %>% filter(Index == "N225")
nsei <- markets %>% filter(Index == "NSEI")
nya <- markets %>% filter(Index == "NYA")
ssmi <- markets %>% filter(Index == "SSMI")
twii <- markets %>% filter(Index == "TWII")

```


Intro
=======================================================================

Global Index Performance in the 21st Century

By Joseph Connolly

Professor Charley Ferrari

CUNY SPS, MSDS: Data 608

Spring, 2022



This final project for Data 608, Knowledge and Visual Analytics, at the CUNY School of Professional Studies, entails a Flexdashboard to visualize and display the performance of global indexes in the 21st Century. From Kaggle.com, I downloaded and imported a global index dataset that contains stock information ranging from 1965-2021. This was cleaned and sub-setted to only include data onward from December 31st, 1999


Included in this application is a simple Shiny app that shows the summaries of all indexes from the dataset. You may access it via the link embedded in ShinySummaries


Data Source: kaggle.com


This application is for academic purposes only

Price and Volume =======================================================================

Closing Prices and Volume

Instructions


Click on the icons within the "Index" key to customize which indexes are displayed on the graph


Draw a box to zoom in and see a shorter time frame

Row ------------------------------------------------------------------------
```{r} p1 <- ggplot(markets, aes(x = Date, y = CloseUSD, fill = Index)) + geom_bar(stat = "identity") + ggtitle("Closing Prices") +theme_classic() p1 <- ggplotly(p1) p1_build <- plotly_build(p1) p1_build$layout$height = 350 p1_build$layout$width = 350 p1_build ``` ```{r} # Volume p2 <- ggplot(markets, aes(x = Date, y = Volume, fill = Index)) + geom_bar(stat = "identity") + ggtitle("Volume") +theme_classic() p2 <- ggplotly(p2) p2_build <- plotly_build(p2) p2_build$layout$height = 350 p2_build$layout$width = 350 p2_build ``` Indexes =======================================================================

The time frame is adjustable by dragging the "time window" from the left and right towards the center. This renders a closer view of each indexes' performance.


```{r} # Swiss Market Index # Candle colors up <- list(line = list(color = "limegreen")) down <- list(line = list(color = "red2")) fig.ssmi <- ssmi %>% plot_ly(x = ~Date, type = "candlestick", open = ~Open, close = ~ Adj.Close, high = ~High, low = ~Low, increasing = up, decreasing = down) fig.ssmi <- fig.ssmi %>% layout(title = "Swiss Market Index, CHF Fr. (Zurich, Switzerland)") fig.ssmi ```
Row ------------------------------------------------------------------------ ```{r} # NASDAQ up <- list(line = list(color = "limegreen")) down <- list(line = list(color = "magenta")) fig.ixic <- ixic %>% plot_ly(x = ~Date, type = "candlestick", open = ~Open, close = ~ Adj.Close, high = ~High, low = ~Low, increasing = up, decreasing = down) fig.ixic <- fig.ixic %>% layout(title = "NASDAQ Composite, USD (New York, USA)") fig.ixic ```
Row ------------------------------------------------------------------------ ```{r} # Shanghai up <- list(line = list(color = "limegreen")) down <- list(line = list(color = "red2")) fig.ss <- ss.000001 %>% plot_ly(x = ~Date, type = "candlestick", open = ~Open, close = ~ Adj.Close, high = ~High, low = ~Low, increasing = up, decreasing = down) fig.ss <- fig.ss %>% layout(title = "Shanghai Component Index, CNY (Shanghai, China)") fig.ss ```
Row ------------------------------------------------------------------------ ```{r} # South Africa up <- list(line = list(color = "limegreen")) down <- list(line = list(color = "hotpink")) fig.J203.JO <- J203.JO %>% plot_ly(x = ~Date, type = "candlestick", open = ~Open, close = ~ Adj.Close, high = ~High, low = ~Low, increasing = up, decreasing = down) fig.J203.JO <- fig.J203.JO %>% layout(title = "All Share Index, ZAR (Johanessburg, South Africa)") fig.J203.JO ```
Row ------------------------------------------------------------------------ ```{r} # India up <- list(line = list(color = "limegreen")) down <- list(line = list(color = "red")) fig.nsei <- nsei %>% plot_ly(x = ~Date, type = "candlestick", open = ~Open, close = ~ Adj.Close, high = ~High, low = ~Low, increasing = up, decreasing = down) fig.nsei <- fig.nsei %>% layout(title = "Nifty 50 Index, INR (Mumbai, India)") fig.nsei ```
Row ------------------------------------------------------------------------ ```{r} # Europe (Paris) up <- list(line = list(color = "limegreen")) down <- list(line = list(color = "hotpink")) fig.n100 <- n100 %>% plot_ly(x = ~Date, type = "candlestick", open = ~Open, close = ~ Adj.Close, high = ~High, low = ~Low, increasing = up, decreasing = down) fig.n100 <- fig.n100 %>% layout(title = "Euronext Index, EUR (Paris, France)") fig.n100 ```
Row ------------------------------------------------------------------------ ```{r} # Hong Kong up <- list(line = list(color = "limegreen")) down <- list(line = list(color = "red2")) fig.hsi <- hsi %>% plot_ly(x = ~Date, type = "candlestick", open = ~Open, close = ~ Adj.Close, high = ~High, low = ~Low, increasing = up, decreasing = down) fig.hsi <- fig.hsi %>% layout(title = "Hang Seng Index, HKD (Hong Kong)") fig.hsi ```