rolladjust {RTL} | R Documentation |
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.
rolladjust(x, commodityname = c("cmewti"), rolltype = c("Last.Trade"), ...)
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 |
Roll-adjusted xts object of returns
Philippe Cote
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"))