qis.FactorsData¶
- class qis.FactorsData(factors_prices, factors=None)[source]¶
Bases:
objecttradable factor price levels, optionally validated against a factor-set descriptor.
Passing
factorsturns the column names into a checked contract: construction fails if an expected factor is missing, which catches a renamed or dropped column at load time rather than in the middle of an estimation. Leaving it None keeps the container generic.- Variables:
factors_prices (pandas.DataFrame) – factor price levels, one column per factor, indexed by date
factors (Type[enum.Enum] | None) – str-valued Enum whose values are the expected column names. None skips validation
- Raises:
ValueError – if
factorsis given and a factor it names is absent from the columns- Parameters:
- __init__(factors_prices, factors=None)¶
Methods
__init__(factors_prices[, factors])from_sql(query[, connection, factors, ...])Load factor prices from a SQL source.
get_factor_prices(factor[, time_period])Price series for one factor, by name or enum member.
get_prices([time_period])Full factor price panel, optionally time-sliced.
load(local_path[, file_name, factors, ...])Load factor prices from a CSV produced by the production layer.
Attributes
Factor column names in panel order.
- classmethod load(local_path, file_name='futures_risk_factors', factors=None, time_period=None)[source]¶
Load factor prices from a CSV produced by the production layer.
- Parameters:
local_path (str)
file_name (str)
time_period (TimePeriod | None)
- Return type:
- classmethod from_sql(query, connection=None, factors=None, time_period=None)[source]¶
Load factor prices from a SQL source.
Forward hook for database-backed instantiation using
qis.sql_engine. Wire the project connection here so cohorts can be sourced from the database without changing any consumer. Not yet implemented.- Parameters:
query (str)
time_period (TimePeriod | None)
- Return type:
- get_factor_prices(factor, time_period=None)[source]¶
Price series for one factor, by name or enum member.
- Parameters:
time_period (TimePeriod | None)
- Return type:
- get_prices(time_period=None)[source]¶
Full factor price panel, optionally time-sliced.
- Parameters:
time_period (TimePeriod | None)
- Return type: