contango_hedged: Implement a Hedged Contango-Based Volatility Trading Strategy

Description Usage Arguments Details Value Note Author(s) References Examples

Description

Implements the following volatility strategy: Each day, hold XIV/SPXU (weighted for zero beta) if contango is greater than xiv.spxu.cutpoint, hold VXX/UPRO (weighted for zero beta) if contango is less than vxx.upro.cutpoint, and hold cash otherwise.

Usage

1
2
3
4
5
6
contango.hedged(contango,
                xiv.spxu.gains = NULL, vxx.upro.gains = NULL,
                xiv.spxu.cutpoint = 6.36, vxx.upro.cutpoint = 5.45,
                xiv.allocation = 0.46, vxx.allocation = 0.46,
                xiv.beta = NULL, vxx.beta = NULL,
                initial = 10000)

Arguments

contango

Numeric vector of contango values at the end of each trading day (or week, month, etc.).

xiv.spxu.gains

2-column numeric matrix of gains for XIV and SPXU. Number of rows should match length of contango. The first row should give XIV and SPXU gain for the day AFTER the first contango value.

vxx.upro.gains

2-column numeric matrix of gains for VXX and UPRO. Number of rows should match length of contango. The first row should give VXX and UPRO gain for the day AFTER the first contango value.

xiv.spxu.cutpoint

Numeric value giving the contango cutpoint for XIV/SPXU position. For example, if xiv.spxu.cutpoint = 5, then XIV/SPXU will be held whenever contango is greater than 5.

vxx.upro.cutpoint

Numeric value giving the contango cutpoint for VXX/UPRO position. For example, if vxx.upro.cutpoint = -5, then VXX/UPRO will be held whenever contango is less than -5.

xiv.allocation

Numeric value indicating XIV allocation for XIV/SPXU positions. For example, if set to 0.46, then 46% is allocated to XIV and 54% to SPXU when contango is greater than xiv.spxu.cutpoint.

vxx.allocation

Numeric value indicating VXX allocation for VXX/UPRO positions. For example, if set to 0.46, then 46% is allocated to VXX and 54% to UPRO when contango is less than than vxx.upro.cutpoint.

xiv.beta

Numeric value indicating XIV's beta. If specified, the function figures out what xiv.allocation needs to be for zero-beta XIV/SPXU positions. For example, if set to 3.5, then 46.2% XIV/53.8% SPXU achieves zero beta.

vxx.beta

Numeric value indicating VXX's beta. If specified, the function figures out what vxx.allocation needs to be for zero-beta VXX/UPRO positions. For example, if set to -3.5, then 46.2% VXX/53.8% UPRO achieves zero beta.

initial

Numeric value giving the initial value of the portfolio.

Details

You can find historical contango values from The Intelligent Investor Blog. You can click the first link at http://investing.kuchita.com/2012/06/28/xiv-data-and-pricing-model-since-vix-futures-available-2004/ to download a zip file containing an Excel spreadsheet. Then, you will need to calculate whatever version of "contango" you prefer. I typically define contango as what percent higher the second-month VIX futures are acompared to the first- month futures, i.e. dividing the "2nd mth" column by the "1st mth" column, subtracting 1, and then multiplying by 100.

To load daily gains for XIV, SPXU, VXX, and UPRO, you can use load.gains, which uses the quantmod package [1] to load data from Yahoo! Finance. You will have to specify the from and to inputs to match the date range for your contango values.

Value

A 4-element list containing the following: (1) A character vector named holdings indicating what fund was held each day (XIV/SPXU, VXX/UPRO, or cash); (2) a numeric vector named port.gains giving the portfolio gain for each day, which will be 0 for days that cash was held and the weighted XIV/SPXU or VXX/UPRO gain for days that one of those positions was held; (3) a numeric vector named port.balances giving the portfolio balance each day; and (4) a numeric value named trades giving the total number of trades that were executed.

Note

NA

Author(s)

Dane R. Van Domelen

References

1. Jeffrey A. Ryan (2016). quantmod: Quantitative Financial Modelling Framework. R package version 0.4-6, https://cran.r-project.org/package=quantmod.

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

Examples

1

Example output

Loading required package: rbenchmark
[1] NA

stocks documentation built on May 2, 2019, 5:22 p.m.