EquityFactorBasket#
-
class sigtech.framework.strategies.equity_factor_basket.EquityFactorBasket
Baseclasses:
SignalStrategy
EquityFactorBasket - class implementing a basket of stocks held based on factor data.
This inherits from the
SignalStrategy
.However, unlike the
SignalStrategy
, the default allocation function automatically normalizes the signal and a sparse threshold function is used.In addition to the inherited inputs, following dictionary inputs are available for creating objects:
universe_filter
: Universe time series or equity filter.factor_exposure_generator
: Optional factor exposure object, if empty a blank one is created.factors_to_weight_function
: Function mapping factors to weights.factors_to_weight_function_name
: Function name for db persistence of factor to weight function.factors_to_weight_kwargs
: Extra parameters required for the factor to weight function.universe_mapping
: Mapping from universe identifiers to instruments, if blank reinvestment strategies will be automatically generated.reinvest_dividends
: Approach to reinvesting cash dividends. Either reinvest in the awarding stock (“individual_stock”), reinvest across the portfolio using the most recent explicitly set weights (“prev_set_weights”) or to reinvest across whole portfolio keeping relative weights constant after dividend is accounted for (“post_div”) which would keep market cap exposure constant.reinvestment_strategy_overrides
: Dictionary of overrides to use in reinvestment strategy creation.use_strategy_cache
: bool flag to set if strategy service should be used for reinvestment strategies.
Example object creation:
import datetime as dtm equity_filter = sig.EquityUniverseFilter('SPX INDEX') efb = sig.EquityFactorBasket(universe_filter=equity_filter, factor_exposure_generator=factor_exposure, currency='USD', start_date=dtm.date(2019, 1, 15), end_date=dtm.date(2019, 2, 15), rebalance_frequency='1W-FRI')
-
convert_long_short_weight: Optional[bool]
-
factor_exposure_generator: Optional[FactorExposures]
-
factors_to_weight_function: Optional[Callable]
-
factors_to_weight_function_name: Optional[str]
-
factors_to_weight_kwargs: Optional[dict]
-
reinvest_dividends: Optional[Literal['prev_set_weights', 'post_div', 'individual_stock']]
-
reinvestment_strategy_overrides: Optional[dict]
-
signal_name: Optional[str]
-
t0_execution: Optional[bool]
-
universe_filter: Union[EquityUniverseFilter, Series]
-
universe_mapping: Optional[dict]
-
use_db_for_short_version: Optional[bool]
-
use_strategy_cache: Optional[bool]
-
AVAILABLE_FACTOR_TO_WEIGHT_FUNCTIONS
alias of
StandardFactorToWeightFunctions
-
factor_exposures_on_date(date: date, exact_date: bool = False) DataFrame
Fetch the stock-factor loadings for the specified
date
.- Parameters:
date – Date on which to analyse the factor exposures.
exact_date – Whether to require the factor exposures exactlty on
date
or whether to return the most recent data as-of the requesteddate
(default).
- Returns:
pd.DataFrame
of stock-factor exposures. Indexed by factor name, columns are stock names.
-
strategy_initialization(dt)
Initial decision run on the start date of the strategy.
- Parameters:
dt – Reference datetime.