Skip to content

Instantly share code, notes, and snippets.

@AricLux
Created September 25, 2020 01:40
## S&P 500 INDEX ----
getSymbols("^GSPC", src = "yahoo", from = "2003-01-15", to = "2020-09-02")
spx <- cbind(GOLDAMGBD228NLBM, GSPC$GSPC.Adjusted) ## GSPC has some anomalous missing dates. 'cbind' so they produce NAs.
spx <- na.interp(spx$GSPC.Adjusted[index.biweekly])
spx <- xts(spx, order.by = index.biweekly)
spx.return <- na.omit(CalculateReturns(spx, method = "log"))
## VIX INDEX ----
getSymbols("VIXCLS", src = "FRED", from = "2003-01-15", to = "2020-09-02")
vix <- VIXCLS[index.biweekly]
vix <- na.interp(vix)
vix <- xts(vix, order.by = index.biweekly)
chg.vix <- na.omit(diff(vix, lag = 1))
master.data <- cbind(gold.returns, chg.real.rates, chg.nominal.rate,
chg.inflation, chg.euro.usd, spx.return, chg.vix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment