A brief look at VIX

R
time_series
Author

Robert W. Walker

Published

June 24, 2021

Get Some VIX data

NB: I originally wrote this on February 27, 2020 so there is commentary surrounding that date. It was done on the quick for curiosity. I will update it by recompiling it with new data and will update the commentary noting when it took place.

Chicago Board Of Exchange (CBOE) makes data available regularly. To judge the currency of the data, I have tailed it below after converting the dates to a valid date format.

library(tidyverse)
VIX <- read.csv(url("https://cdn.cboe.com/api/global/us_indices/daily_prices/VIX_History.csv"))
VIX$Dates <- as.Date(VIX$DATE,
  format = "%m/%d/%Y")
tail(VIX)
           DATE  OPEN  HIGH   LOW CLOSE      Dates
8310 12/21/2022 21.25 21.29 19.94 20.07 2022-12-21
8311 12/22/2022 20.08 24.30 20.01 21.97 2022-12-22
8312 12/23/2022 22.17 22.64 20.78 20.87 2022-12-23
8313 12/27/2022 21.67 22.80 21.59 21.65 2022-12-27
8314 12/28/2022 21.47 22.26 20.96 22.14 2022-12-28
8315 12/29/2022 22.25 22.31 21.36 21.44 2022-12-29

The data was straightforward to get a hold of. Now let me plot it. I want to do this with a candlestick plot – a way of displaying intra-day volatility. There’s so much data that the views aren’t great.

library(plotly)
# create the candlestick plot
fig <- VIX  %>% plot_ly(x = ~Dates, type="candlestick",
          open = ~OPEN, close = ~CLOSE,
          high = ~HIGH, low = ~LOW) 
fig <- fig %>% layout(title = "A Historical Look at VIX")
fig

As an overall it has been worse, but keep in mind, that big blip happened TODAY! What does it look like in perspective [keeping in mind that the futures are currently just under 40] since 2012?

fig2 <- VIX %>% filter(Dates > as.Date("01/01/2012", format = "%m/%d/%Y")) %>% plot_ly(x = ~Dates, type="candlestick",
          open = ~OPEN, close = ~CLOSE,
          high = ~HIGH, low = ~LOW) 
fig2 <- fig2 %>% layout(title = "VIX Since 2012")
fig2

Day to Day Changes?

I will touch the file about daily to track the evolution.

library(hrbrthemes); library(viridis)
VIX <- VIX %>% mutate(Percent.Change = (CLOSE - lag(CLOSE)) / lag(CLOSE)) 
p <- ggplot(VIX, aes(x=Dates, y=Percent.Change, size=Percent.Change/10, color=Percent.Change)) + 
  geom_point(alpha=0.5, shape=21, inherit.aes = TRUE) +
  scale_size_continuous(range=c(0.05,2), guide=FALSE) +
  geom_line() + 
  geom_smooth(color="orange", method="loess", span=0.05, se=FALSE) + 
  geom_vline(xintercept = as.Date("02/27/2020", format = "%m/%d/%Y"), color="red", alpha=0.2, linetype = "dotted") + 
  geom_vline(xintercept = as.Date("09/12/2008", format = "%m/%d/%Y"), color="red", alpha=0.4) +
  geom_label(data = data.frame(x = as.Date("2008-02-12"),
    y = 0.75, label = "Lehman Brothers"),mapping = aes(x = x, y = y, label = label), size = 3.86605783866058, angle = 0L, lineheight = 1L, hjust = 0.5, vjust = 0.5, colour = "red", family = "sans", fontface = "plain", label.padding = structure(0.25, class = "unit", valid.unit = 3L, unit = "lines"), label.size = 0.25, label.r = structure(0.15, class = "unit", valid.unit = 3L, unit = "lines"), inherit.aes = FALSE, show.legend = FALSE) + 
  scale_color_viridis_c(guide="none") +
  scale_fill_viridis_c(guide="none") +
    theme_ipsum()
fig3 <- ggplotly(p)
fig3

NB: This commentary was in mid-March. This doesn’t look good. The smooth on a small span is uncomfortably headed upward and today will shock it like no previous day in a very long while.