The Rise of FinTech and Its Impact on Traditional Investment

Midterm Project: Data and Preliminary Analysis (R version)

Data

Daily returns (%) for a FinTech fund, equities, bonds and Bitcoin. test_data.csv is synthetic, used only to test the pipeline. Replace it with real_data.csv when you have downloaded real data.

Code
df <- read.csv("test_data.csv")
df$Date <- as.Date(df$Date)
vals <- df[, -1]
stats <- data.frame(
  Mean = colMeans(vals), SD = apply(vals, 2, sd),
  Min = apply(vals, 2, min), Max = apply(vals, 2, max),
  AnnVol = apply(vals, 2, sd) * sqrt(252))
round(stats, 3)
               Mean    SD     Min    Max AnnVol
FinTech_ETF   0.056 1.691  -7.255  6.824 26.839
Equity_SP500  0.027 1.120  -4.605  4.455 17.781
Bond_AGG      0.001 0.367  -1.133  1.088  5.820
Bitcoin      -0.157 3.537 -16.058 15.980 56.149

Correlations

Code
round(cor(vals), 2)
             FinTech_ETF Equity_SP500 Bond_AGG Bitcoin
FinTech_ETF         1.00         0.80     0.16    0.45
Equity_SP500        0.80         1.00     0.24    0.38
Bond_AGG            0.16         0.24     1.00    0.15
Bitcoin             0.45         0.38     0.15    1.00

Rolling correlation (60 days)

Code
roll_cor <- function(x, y, w = 60) {
  out <- rep(NA_real_, length(x))
  for (i in w:length(x)) out[i] <- cor(x[(i-w+1):i], y[(i-w+1):i])
  out
}
r_eq  <- roll_cor(vals$FinTech_ETF, vals$Equity_SP500)
r_btc <- roll_cor(vals$FinTech_ETF, vals$Bitcoin)
plot(df$Date, r_eq, type = "l", col = "blue", ylim = c(-0.2, 1),
     xlab = "", ylab = "60-day rolling correlation")
lines(df$Date, r_btc, col = "red")
legend("bottomright", c("FinTech vs equities", "FinTech vs Bitcoin"),
       col = c("blue", "red"), lty = 1, cex = 0.8)