Given a reference dataset and a set of parameters, construct the desired asset pricing factor and returns its return and position time series by leg.
factorem( name = "", data, update_frequency = "month", return_frequency = "day", price_variable = "PX_LAST", sort_variable = "PX_LAST", sort_levels = T, weighted = T, ranking_period = 1L, long_threshold = 0.5, short_threshold = 0.5 )
name | a scalar character vector specifying the name to use for the factor. |
---|---|
data | a dataframe/tibble. Columns must include |
update_frequency | a scalar character vector. Specifies the rebalancing frequency. Must be one of 'year', 'semester', 'quarter', 'month', 'week' or 'day'. 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'. |
price_variable | a scalar character vector. Specifies the name of the variable
hosting asset prices. Must be found in the |
sort_variable | a scalar character vector. Specifies the name of the variable
to use for sorting. Must be found in the |
sort_levels | a scalar logical vector. If |
weighted | a scalar |
ranking_period | a scalar integer vector. Specifies number of periods in term
of |
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. |
An S4 object of class AssetPricingFactor
.