rolladjust: Adjusts daily returns for futures contracts roll

View source: R/rolladjust.R

rolladjustR Documentation

Adjusts daily returns for futures contracts roll

Description

Returns a xts price or return object adjusted for contract roll. The methodology used to adjust returns is to remove the daily returns on the day after expiry and for prices to adjust historical rolling front month contracts by the size of the roll at each expiry. This is conducive to quantitative trading strategies as it reflects the PL of a financial trader.

Usage

rolladjust(x, commodityname = c("cmewti"), rolltype = c("Last.Trade"), ...)

Arguments

x

A df of returns.

commodityname

Name of commodity in expiry_table: unique(expiry_table$cmdty) or "cmecan" for WCW

rolltype

Type of contract roll: "Last.Trade" or "First.Notice".

...

Other parms

Value

Roll-adjusted xts object of returns

Author(s)

Philippe Cote

Examples

ret <- dplyr::tibble(date = seq.Date(Sys.Date() - 60, Sys.Date(), 1), CL01 = rnorm(61, 0, 1))
rolladjust(x = ret, commodityname = c("cmewti"), rolltype = c("Last.Trade"))

RTL documentation built on Oct. 21, 2023, 1:06 a.m.