quantlab.risk.config.FactorRiskConfig#

class quantlab.risk.config.FactorRiskConfig(*, exposures, dataset, exposure_data_strategy, regression_path=None, estu_name=None, price_column='adjClose', market_cap_column='marketcap', risk_free_column='risk_free', risk_free_symbol=None, estimate_path=None, name=None)[source]#

Bases: FrozenConfig

Config of quantlab.risk.base.FactorRiskModel: what every factor risk model has.

The exposures come from exposures, a factor whose outputs the model names (FactorRiskModel.exposure_names, and estu_name when set); the returns, market caps and risk-free rate come from dataset. For exposures that use a risk-free rate themselves, it should be the dataset they read, so exposures and returns agree on what “excess” means. A model’s method parameters are in its own config, a subclass of this one.

Examples

>>> cfg = Use4RiskConfig(
...     exposures=style, dataset=prices, exposure_data_strategy="read",
...     regression_path="risk/use4_regression.zarr",
... )
>>> isinstance(cfg, FactorRiskConfig), cfg.estu_name
(True, 'estu')
dataset#

The dataset holding price_column, market_cap_column and risk_free_column, or a list of datasets, merged into one.

estimate_path = None#

Path of the Zarr store of the estimates (factor covariance and specific risk), computed from the regression store.

estu_name = None#

The exposures variable that is 1 inside the estimation universe, the symbols the model is fitted on; None fits on every symbol.

exposure_data_strategy#

"read" reads the exposures from their store, "cal" computes them: for the model’s stores, factor attribution, bias statistics and the decisions of a rule reading the model (FactorRiskStoreEstimator).

exposures#

The factor whose outputs are the exposures.

market_cap_column = 'marketcap'#

Dataset variable holding the market capitalization.

name = None#

Dotted import path of the risk model class; filled by the config setter.

price_column = 'adjClose'#

Dataset variable holding the split- and dividend-adjusted close.

regression_path = None#

Path of the Zarr store of the regression (factor returns, specific returns and diagnostics).

risk_free_column = 'risk_free'#

Dataset variable holding the risk-free rate as a decimal return per bar.

risk_free_symbol = None#

When set, the risk-free rate is risk_free_column of this one symbol, broadcast across the others, as BarraStyleParameters.risk_free_symbol.