abaquant.portfolio.stress_testing

Import path: abaquant.portfolio.stress_testing

Domain: Portfolio construction, optimization, backtesting, risk metrics, and stress testing.

Purpose

Historical fixed-weight portfolio stress testing.

When to use it

Use this package to transform return histories and covariance estimates into weights, then evaluate those weights out of sample and under explicit scenarios.

Public objects

  • function: run_stress_test — Evaluate a fixed-weight portfolio through one predefined historical scenario.

  • function: run_all_scenarios — Evaluate a fixed-weight portfolio through every predefined historical scenario.

Detailed reference

Historical fixed-weight portfolio stress testing.

Purpose

The module applies a supplied allocation to predefined historical windows and reports performance conditional on available price coverage.

Conventions

Price panels use dates on the index and asset labels on columns. Assets without enough coverage can be excluded and surviving weights are renormalized under the documented rule.

Scope and limitations

Historical scenarios are descriptive rather than probabilistic forecasts.

References

[ 1 ] Markowitz, H. (1952), “Portfolio Selection”.

abaquant.portfolio.stress_testing.run_stress_test(prices_full, weights, scenario_name, min_coverage=0.6)

Evaluate a fixed-weight portfolio through one predefined historical scenario.

Parameters:
  • prices_full (pd.DataFrame) – Broad historical price panel used to assess scenario coverage and performance.

  • weights (pd.Series) – Portfolio weights, either a mapping keyed by asset or an ordered numeric vector as documented by the callable.

  • scenario_name (str) – Key identifying one predefined historical stress scenario.

  • min_coverage (float, default=0.6) – Minimum fraction of scenario dates with usable prices required for an asset.

Returns:

Dictionary of named model outputs, metrics, or workflow results defined by the current public schema.

Return type:

dict[str, object]

abaquant.portfolio.stress_testing.run_all_scenarios(prices_full, weights)

Evaluate a fixed-weight portfolio through every predefined historical scenario.

Parameters:
  • prices_full (pd.DataFrame) – Broad historical price panel used to assess scenario coverage and performance.

  • weights (pd.Series) – Portfolio weights, either a mapping keyed by asset or an ordered numeric vector as documented by the callable.

Returns:

Dictionary of named model outputs, metrics, or workflow results defined by the current public schema.

Return type:

dict[str, object]