Provided with futures contract front price and open interest data from Bloomberg retrieved with pullit, construct open interest growth (OI) nearby factor. The open interest factor relates to futures market liquidity and is popular in the literature, in particular in the context of commodity markets research (Hong and Yogo 2012) . The nearby open interest factor is concerned with liquidity at the very front end of the term structure where it sorts on nearby front contract's open interest.

OI_nearby_factor(
  data,
  update_frequency = "month",
  return_frequency = "day",
  ranking_period = 1L,
  long_threshold = 0.5,
  short_threshold = 0.5,
  weighted = F
)

# S4 method for FuturesTS
OI_nearby_factor(
  data,
  update_frequency = "month",
  return_frequency = "day",
  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'.

ranking_period

a scalar integer vector. Specifies number of periods in term of update_frequency looking backward for nearby open interest average growth 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 OIFactor.

References

Hong H, Yogo M (2012). “What does futures market interest tell Us about the macroeconomy and asset prices?” Journal of Financial Economics, 105(3), 473--490. doi: 10.1016/j.jfineco.2012.04.005 , https://doi.org/10.1016/j.jfineco.2012.04.005.