Provided with futures contract front price data from Bloomberg retrieved with pullit, construct term structure factor. The futures term structure factor (Szymanowska et al. 2014; Fuertes et al. 2015) is concerned with the shape (steepness) of the futures term structure and sorts on roll yield.

TS_factor(
  data,
  update_frequency = "month",
  return_frequency = "day",
  front = 1L,
  back = 2L,
  ranking_period = 1L,
  long_threshold = 0.5,
  short_threshold = 0.5,
  weighted = F
)

# S4 method for FuturesTS
TS_factor(
  data,
  update_frequency = "month",
  return_frequency = "day",
  front = 1L,
  back = 2L,
  ranking_period = 1L,
  long_threshold = 0.5,
  short_threshold = 0.5,
  weighted = F
)

Arguments

data

an S4 object of class FuturesTS. FuturesTS objects are returned by the BBG_futures_TS function from the pullit package.

update_frequency

a scalar character vector. Specifies the rebalancing frequency. Must be one of 'year', 'semester', 'quarter', 'month' or 'week'. Defaults to 'month'.

return_frequency

a scalar character vector. Specifies the frequency of the returns output. Must be one of 'year', 'semester', 'quarter', 'month', 'week' or 'day'. Defaults to 'day'.

front

a scalar integer vector. Specifies the term structure position to use as front contract in roll yield (sort variable) calculation. Defaults to 1.

back

a scalar integer vector. Specifies the term structure position to use as back contract in roll yield (sort variable) calculation. Defaults to 2.

ranking_period

a scalar integer vector. Specifies number of periods in term of update_frequency looking backward for average roll yield calculation. Defaults to 1 where sort is done on last observation only.

long_threshold

a scalar numeric vector. Specifies the threshold for short positions. Default: 0.5.

short_threshold

a scalar numeric vector. Specifies the threshold for long positions. Default: 0.5.

weighted

a scalar logical vector. If 'TRUE' adjusts portoflio weights with respect to sorting variable values, else equal weights are used. Defaults to 'FALSE'.

Value

An S4 object of class AssetPricingFactor.

References

Fuertes A, Miffre J, Fernandez-Perez A (2015). “Commodity strategies based on momentum, term structure, and idiosyncratic volatility.” Journal of Futures Markets, 35(3), 274--297. ISSN 1096-9934, doi: 10.1002/fut.21656 , https://doi.org/10.1002/fut.21656.

Szymanowska M, De Roon F, Nijman T, Van Den Goorbergh R (2014). “An anatomy of commodity futures risk premia.” The Journal of Finance, 69(1), 453--482. ISSN 1540-6261, doi: 10.1111/jofi.12096 , https://doi.org/10.1111/jofi.12096.