Introduction

The Chicago Board Options Exchange (CBOE) introduced the Volatility Index (VIX) in 1993 to provide a measure of the implied volatility of 30-day, at the money S&P 100 Index Options. Volatility has become a widely accepted asset class since the introduction of the VIX Futures contracts in 2004. VIX Futures are often used for hedging purpose because of its negative correlation with the Equity market return. When we talk about the term structure of Futures, we often refer to the forward curve. The VIX forward curve consists of VIX Futures prices at various delivery times in the future. Academic research states that volatility follows a mean reverting process. When the VIX Futures curve is upward sloped (in contango), the VIX is expected to rise because it is low relative to long-term average levels and vice versa for the downward sloped VIX Future curve. In this study, we will create a strategy with the term structure effect of VIX Futures and hedge the term structure risk with the S&P500 Futures.

Method

The trading strategy uses VIX Futures as a trading vehicle and S&P E-mini for hedging purposes. The spot VIX price data and the price of continuous VIX and E-mini S&P500 Futures in the daily resolution are mapped from the contract with highest open interest.

  1. def initialize(self):
  2. vix = self.add_index("VIX", Resolution.DAILY)
  3. self.vix = vix.symbol
  4. self.vix_multiplier = vix.symbol_properties.contract_multiplier
  5. self.vx1 = self.add_future(Futures.indices.VIX,
  6. resolution = Resolution.DAILY,
  7. extended_market_hours = True,
  8. data_normalization_mode = DataNormalizationMode.BACKWARDS_RATIO,
  9. data_mapping_mode = DataMappingMode.OPEN_INTEREST,
  10. contract_depth_offset = 0
  11. )
  12. self.vx1_multiplier = self.vx1.symbol_properties.contract_multiplier
  13. self.es1 = self.add_future(Futures.indices.SP500E_MINI,
  14. resolution = Resolution.DAILY,
  15. extended_market_hours = True,
  16. data_normalization_mode = DataNormalizationMode.BACKWARDS_RATIO,
  17. data_mapping_mode = DataMappingMode.OPEN_INTEREST,
  18. contract_depth_offset = 0
  19. )
  20. self.es1_multiplier = self.es1.symbol_properties.contract_multiplier
+ Expand

Futures basis is defined as the difference between the underlying product cash price and Futures contract price at a given time.

Basist=St−Ft

Where St is the adjusted VIX price, Ft is the adjusted VIX Futures price. Note that the adjustments are based on different contract multiplier for different assets. The basis is in contango means the Futures price is higher than the spot price. The opposite of Contango is Backwardation. It refers to the market condition in which the Futures price is less than the spot price.

Contango=StFt

While this trading strategy takes advantage of the roll by selling VIX Futures at a premium to the VIX and by buying VIX Futures at a discount to the VIX, it is exposed to the potentially substantial risks associated with adverse moves in the VIX Futures curve. However, as the tendency of VIX Futures prices to move inversely to Equity returns, much of this risk can be hedged by opening the E-mini S&P 500 Futures position in the same direction.

The number of mini-S&P Futures contracts to buy or sell per VIX Futures contract is based on the hedge ratio estimates. The hedge ratios are constructed from regressions of VIX Futures price changes on a constant and on contemporaneous percentage changes of the front mini-S&P 500 Futures contract both alone and multiplied by the number of business days that the VIX Futures contract is from the settlement, as shown below.

ΔPVXt= Î²0+β1∗rESt+β2∗(rESt∗sVXt)+μt

where rESt is the return of ES at time t and sVXt is the time to settlement for VX at time t. After we get the parameters β0, β1 and β2, the formula for the hedge ratio is

HRt=β1+β2∗st−1PESt−1

  1. def calculate_hedge_ratio(self, es1_price):
  2. price__v_x = np.array(list(self.price__v_x))[::-1]/self.vx1_multiplier
  3. price__e_s = np.array(list(self.price__e_s))[::-1]/self.es1_multiplier
  4. delta__v_x = np.diff(price__v_x)
  5. res__e_s = np.diff(price__e_s)/price__e_s[:-1]*100
  6. tts = np.array(list(self.days_to_maturity))[::-1][1:]
  7. df = pd.DataFrame({"delta__v_x":delta__v_x, "SPRET":res__e_s, "product":res__e_s*tts}).dropna()
  8. # remove rows with zero value
  9. df = df[(df != 0).all(1)]
  10. y = df['delta__v_x'].astype(float)
  11. X = df[['SPRET', "product"]].astype(float)
  12. X = sm.add_constant(X)
  13. model = sm.OLS(y, X).fit()
  14. beta_1 = model.params[1]
  15. beta_2 = model.params[2]
  16. hedge_ratio = (beta_1 + beta_2*((self.vx1.mapped.id.date-self.time).days))/float(es1_price*50)
  17. return hedge_ratio
+ Expand

To perform the regression, we save the history price in deque list and update the list every day.

  1. def initialize(self):
  2. # the rolling window to save the front month VX future price
  3. self.price__v_x = RollingWindow[float](252)
  4. # the rolling window to save the front month ES future price
  5. self.price__e_s = RollingWindow[float](252)
  6. # the rolling window to save the time-to-maturity of the contract
  7. self.days_to_maturity = RollingWindow[float](252)
  8. self.set_warm_up(253, Resolution.DAILY)
  9. def on_data(self, data):
  10. if data.bars.contains_key(self.vx1.symbol) and data.bars.contains_key(self.es1.symbol):
  11. # update the rolling window price and time-to-maturity series every day
  12. vx1_price = data.bars[self.vx1.symbol].close
  13. self.price__v_x.add(float(data.bars[self.vx1.symbol].close))
  14. self.price__e_s.add(float(data.bars[self.es1.symbol].close))
  15. self.days_to_maturity.add((self.vx1.mapped.id.date-self.time).days)
+ Expand

The daily roll is defined as the difference between the front VIX Futures price and the VIX, divided by the number of business days until the VIX Futures contract settles. Short VIX Futures positions are entered when the VIX Futures basis is in contango and the daily roll exceeds 0.10 and long VIX Futures positions are entered when the VIX Futures basis is in backwardation and the daily roll is less than -0.10.

  1. # calculate the daily roll
  2. daily_roll = (vx1_price*self.vx1_multiplier - self.securities[self.vix].price*self.vix_multiplier)\
  3. /(self.vx1.mapped.id.date - self.time).days
  4. self.plot("Trade", "VIX", vx1_price)
  5. self.plot("Trade", "VIX Futures", vx1_price)
  6. self.plot("Trade", "Daily Roll", daily_roll)
  7. if not self.portfolio[self.vx1.mapped].invested:
  8. # Short if the contract is in contango with adaily roll greater than 0.10
  9. if daily_roll > 0.1:
  10. hedge_ratio = self.calculate_hedge_ratio(data.bars[self.es1.symbol].close)
  11. self.plot("Trade", "Sell", vx1_price)
  12. qty = self.calculate_order_quantity(self.vx1.mapped, -1)
  13. self.market_order(self.vx1.mapped, qty // self.vx1.symbol_properties.contract_multiplier)
  14. qty = self.calculate_order_quantity(self.es1.mapped, -1*hedge_ratio)
  15. self.market_order(self.es1.mapped, qty // self.es1.symbol_properties.contract_multiplier)
  16. # Long if the contract is in backwardation with adaily roll less than -0.10
  17. elif daily_roll < -0.1:
  18. hedge_ratio = self.calculate_hedge_ratio(data.bars[self.es1.symbol].close)
  19. self.plot("Trade", "Buy", vx1_price)
  20. qty = self.calculate_order_quantity(self.vx1.mapped, 1)
  21. self.market_order(self.vx1.mapped, qty // self.vx1.symbol_properties.contract_multiplier)
  22. qty = self.calculate_order_quantity(self.es1.mapped, 1*hedge_ratio)
  23. self.market_order(self.es1.mapped, qty // self.es1.symbol_properties.contract_multiplier)
+ Expand

Trades are exited when the motivating conditions no longer exist. The exit condition is defined as the daily roll being less than 0.05 for short trades and higher than -0.05 VIX Futures points for long trades. If these exit conditions are not triggered, trades are exited two days before the contract expires.

  1. # exit if the daily roll being less than 0.05 if holding short positions
  2. if self.portfolio[self.vx1.mapped].is_short and daily_roll < 0.05:
  3. self.liquidate()
  4. return
  5. # exit if the daily roll being greater than -0.05 if holding long positions
  6. if self.portfolio[self.vx1.mapped].is_long and daily_roll > -0.05:
  7. self.liquidate()
  8. return
  9. if self.vx1.mapped and self.es1.mapped:
  10. # if these exit conditions are not triggered, trades are exited two days before it expires
  11. if self.portfolio[self.vx1.mapped].invested and self.portfolio[self.es1.mapped].invested:
  12. if (self.vx1.mapped.id.date-self.time).days <= 2 or (self.es1.mapped.id.date-self.time).days <= 2:
  13. self.liquidate()


Reference

  1. Quantpedia - Exploiting Term Structure of VIX Futures

Author

Jing Wu

September 2018