Description Usage Arguments Details Value References

View source: R/contango_hedged.R

Implements the following strategy: Each day, hold XIV/SPXU (weighted for zero
beta) if contango > `xiv.spxu.cutpoint`

, hold VXX/UPRO (weighted for
zero beta) if contango < `vxx.upro.cutpoint`

, and hold cash otherwise.
Perhaps not very useful since XIV closed on Feb. 20, 2018.

1 2 3 4 | ```
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)
``` |

`contango` |
Numeric vector of contango values at the end of each trading day. |

`xiv.spxu.gains` |
2-column numeric matrix with gains for XIV and SPXU.
Should have the same number of rows as |

`vxx.upro.gains` |
2-column numeric matrix with gains for VXX and UPRO.
Should have the same number of rows as |

`xiv.spxu.cutpoint` |
Numeric value giving the contango cutpoint for
XIV/SPXU position. For example, if |

`vxx.upro.cutpoint` |
Numeric value giving the contango cutpoint for
VXX/UPRO position. For example, if |

`xiv.allocation` |
Numeric value specifying XIV allocation for XIV/SPXU
position. For example, if set to 0.46, 46% is allocated to XIV and 54% to
SPXU when contango > |

`vxx.allocation` |
Numeric value specifying VXX allocation for VXX/UPRO
position. For example, if set to 0.46, 46% is allocated to VXX and 54% to
UPRO when contango < |

`xiv.beta` |
Numeric value specifying XIV's beta. If specified, the
function figures out what |

`vxx.beta` |
Numeric value indicating VXX's beta. If specified, the
function figures out what |

`initial` |
Numeric value giving the initial value of the portfolio. |

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 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.

List containing:

Character vector named

`holdings`

indicating what fund was held each day (XIV/SPXU, VXX/UPRO, or cash).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.Numeric vector named

`port.balances`

giving the portfolio balance each day.Numeric value named

`trades`

giving the total number of trades executed.

Ryan, J.A. and Ulrich, J.M. (2017) quantmod: Quantitative Financial Modelling Framework. R package version 0.4-12, https://CRAN.R-project.org/package=quantmod.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.