ExposureGenerator¶
-
class
qf_lib.analysis.exposure_analysis.exposure_generator.
ExposureGenerator
(settings: qf_lib.settings.Settings, data_provider: qf_lib.data_providers.data_provider.DataProvider)[source]¶ Bases:
object
Class to generate exposure data based on provided regressors tickers
- Parameters
settings (Settings) – settings of the project
data_provider (DataProvider) – DataProvider which provides data both for the tickers and regressors
Methods
get_factor_exposure
(regression_len)Method used to generate factor-related coefficients of regressors defined in BacktestTradingSession
get_sector_exposure
(regression_len)Method used to generate sector-related coefficients of regressors defined in BacktestTradingSession
Sets factor exposure tickers
set_portfolio_nav_history
(portfolio_eod_series)Sets the timeseries used to normalize exposure
set_positions_history
(positions_history, …)Sets the positions history with defined frequency sampling
Sets sector exposure tickers
-
get_factor_exposure
(regression_len: int = 12)[source]¶ Method used to generate factor-related coefficients of regressors defined in BacktestTradingSession
- Parameters
regression_len (int) – Length of history taken for each regression in months. It is used to determine the coefficients
- Returns
Contains computed coefficients for all available factor regressors
- Return type
-
get_sector_exposure
(regression_len: int = 12)[source]¶ Method used to generate sector-related coefficients of regressors defined in BacktestTradingSession
- Parameters
regression_len (int) – Length of history taken for each regression in months. It is used to determine the coefficients
- Returns
Contains computed coefficients for all available sector regressors
- Return type
-
set_factor_exposure_tickers
(factor_exposure_tickers: List[qf_lib.common.tickers.tickers.Ticker])[source]¶ Sets factor exposure tickers
- Parameters
factor_exposure_tickers (List[Ticker]) – List of factor exposure tickers
Sets the timeseries used to normalize exposure
- Parameters
portfolio_eod_series (PricesSeries) – timeseries of value of the portfolio expressed in currency units
-
set_positions_history
(positions_history: qf_lib.containers.dataframe.qf_dataframe.QFDataFrame, frequency: qf_lib.common.enums.frequency.Frequency = <Frequency.MONTHLY: 12>)[source]¶ Sets the positions history with defined frequency sampling
- Parameters
positions_history (QFDataFrame) – QFDataFrame containing summary of the positions in the portfolio for each day
frequency (Frequency) – Data frequency. Default: Frequency.MONTHLY
-
set_sector_exposure_tickers
(sector_exposure_tickers: List[qf_lib.common.tickers.tickers.Ticker])[source]¶ Sets sector exposure tickers
- Parameters
sector_exposure_tickers (List[Ticker]) – List of sector exposure tickers