qis.HistoricalScenarioSelection¶
- class qis.HistoricalScenarioSelection(factor='Equity', start_date='2006-01-01', count=10, end_date=None, ascending=True, return_type=ReturnTypes.LOG)[source]¶
Bases:
objectSelect the worst monthly returns of a named factor and replay full vectors.
Missing ranking history or missing co-factors on a selected date raise an error rather than substituting a less severe month. The fitting history is owned by the caller and does not determine this scenario window.
- Variables:
factor (str) – Factor whose declared change determines selection, not portfolio P&L.
start_date (str) – Inclusive first scenario month; no prior opening return is used.
count (int) – Requested number of months, ordered by factor loss.
end_date (str | None) – Optional upper date, capped by the portfolio risk date.
ascending (bool) – Select smallest changes first; False selects largest increases.
return_type (qis.perfstats.config.ReturnTypes) – Declared LOG or DIFFERENCE units used for audit labels.
- Parameters:
- __init__(factor='Equity', start_date='2006-01-01', count=10, end_date=None, ascending=True, return_type=ReturnTypes.LOG)¶
Methods
__init__([factor, start_date, count, ...])metadata(window)Describe the actual selection window for reports and provenance.
select(history, cutoff)Return complete factor vectors in loss order, with chronological ties.
window(history, cutoff)Return completed monthly vectors on the requested calendar window.
Attributes
- return_type: ReturnTypes = 'Log'¶