factor_positions: Get time series of long and short factor positions

Description Usage Arguments Value

View source: R/functions.r

Description

Get time series of long and short factor positions

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
factor_positions(
  data,
  update_frequency,
  sort_variable,
  sort_levels,
  ranking_period,
  long_threshold,
  short_threshold,
  weighted
)

Arguments

data

a dataframe/tibble. Columns must include name, date, field and value.

update_frequency

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

sort_variable

a scalar character vector. Specifies the name of the variable to use for sorting. Must be found in the field columns of data.

sort_levels

a scalar logical vector. If TRUE, sort is done on sort_variable's levels, else on relative changes. Default: FALSE.

ranking_period

a scalar integer vector. Specifies number of periods in term of update_frequency looking backward for averaging sort_variable.

long_threshold

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

short_threshold

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

Value

A data.table with factor positions by rebalancing date. Columns include date, name and position.


bautheac/factorem documentation built on June 7, 2021, 12:11 p.m.