model_clo_insight.engines.hypo_pool module¶
This Module Contains the Primary Methods for Constructing Stressed Modeling Pools (Hypo Pools)
- class HypoResultMonitor(is_solve, riskscore_solution, riskscore_realized, credit_dispersion, adj_bdr, bdr, sdr, sdr_diag, obligors)¶
Bases:
object
Object which stores the result fields for the hypo_pool_formula_constraints() method Descriptions can be found below in
model_clo_insight.engines.hypo_pool.hypo_pool_formula_constraints
- hypo_pool_discrete_constraints(pool_par, conc_limit_basis, dscore_min, ob_max, ind_max, riskscore_max, ob_exceptions, ind_exceptions, ob_floor, ind_floor, risk_score_tbl, tables, force_high=None, force_low=None, is_simple_industry=False, n_simple_industry=40)¶
Main entry point for constructing the hypothetical modeling pool where the CQT constraints are an explicit Dscore and risk score (CQT matrix)
General Algorithm
Solver Goal => Pool actual Dscore ~ Dscore constraint (slightly higher)
2 stage solver: - The outer layer (this method) iterates over the concentration limitation exceptions - The inner layer (the solvers.XXX methods) use numerical optimization on the base concentration limitations
Note: the solver performs the rating overlay once the pool percentages are computed
General steps of the algorithm:
Calculate scaling factor for cases where the conc limit basis is different from actual pool par, and apply
Run solver and check if solution is found (the solvers spin down the base ob/ind concentration limitation, then rating overlay)
If no solution is found, iteratively remove the last (smallest) obligor conc limit exception
If Dscore in compliance, solve for partial last (smallest) obligor percentage s.t. Dscore_act approx Dscore_trigger
If Dscore not in compliance, go to next obligor exception
If no solution is found and all obligor conc limits are removed, iteratively remove the last (smallest) industry conc limit exception until a solution is found
- Parameters
pool_par (float) – Aggregate par balance of the current portfolio
conc_limit_basis (float) – Basis for concentration limitations; typically defined the same as rvst target par
dscore_min (float) – maximum diversity score limit for the pool
ob_max (float) – base max obligor concentration limitation
ind_max (float) – base max industry concentration limitation
riskscore_max (float) – max DBRSM risk score of the pool
ob_exceptions (list[clo_internal_objects.ConcLimitException]) – obligor concentration limitations
ind_exceptions (list[clo_internal_objects.ConcLimitException]) – industry concentration limitations
ob_floor (float) – lowest level that the base obligor concentration limitation is allowed to spin down to
ind_floor (float) – lowest level that the base industry concentration limitation is allowed to spin down to
risk_score_tbl (dict[int, float]) – lookup table for DBRSM Risk Score
tables (dict[str, np.ndarray]) – Lookup tables for Dscore and industry codes
force_high (tuple) – high rating (rating integer, percentage) to lock prior to solving for belly ratings
force_low (tuple) – low rating (rating integer, percentage) to lock prior to solving for belly ratings
is_simple_industry (bool) – if true, industry allocation is done on a repeating sequence. Hypo only iterates on obligor in this case.
n_simple_industry (int) – if is_simple_industry is True, this is the number of industries to repeat in sequence
- Returns
results dictionary
- Return type
Results Dictionary Keys:
is_solve: True if solver found solution, False otherwise
dscore: diversity score calculated on the actual pool
riskscore: DBRSM risk score calculated on the actual pool
ob_base: base obligor concentration limitation that the solver found
ind_base: base industry concentration limitation that the solver found
ob_exceptions: obligor concentration limit exceptions actually used
ind_exceptions: industry concentration limit exceptions actually used
obligors: OrderedDict[objects.Obligor] pool of Obligors.
- hypo_pool_formula_constraints(hypo_pool_diversity, run_mode, rs_abs_max, coef_bdr, coef_sdr, risk_score_tbl, IDT_sp, WARF_sp, rvst_target_par, collat_prin_amt, was, warr, wal, rs_bound_lower, rs_bound_higher, monitor_cushion, force_high=None, force_low=None)¶
Main entry point for constructing the hypothetical modeling pool where a continuous formula is the constraint
General Algorithm
Solver Goal => Solve for the worst rating mixture such that the Monitor BDR ~ Monitor SDR
Notes: - Diversity should be solved for prior to running this method; this method solves for rating mixture
General steps of the algorithm:
Check edge case to see if using the max allowable risk score causes BDR < SDR
Check edge case to see if using the min allowable risk score causes BDR > SDR
Run a bisection optimizer to solver for a rating mixture (via a risk score) such that BDR ~ SDR
Iterate the resulting risk score locally in small chunks until BDR > SDR
- Parameters
hypo_pool_diversity (list[clo_internal_objects.Obligor]) – pool where obligor & industry percentages have been previously solved for a given Dscore
run_mode (str) – Expected portfolio default rate or WA Rating Factor
rs_abs_max (float) – absolute max risk score as per deal (monitor solver won’t create pools any worse than this)
coef_bdr (list) – Break even default rate (BDR) coefficients for the transaction
coef_sdr (list) – Scenario even default rate (SDR) coefficients for the transaction
risk_score_tbl (ndarray) – DBRSM risk score 1-D table
IDT_sp (ndarray) – Idealized default 2-D table; sourced from transaction documents
WARF_sp (ndarray) – WARF-equivalent 1-D table; sourced from transaction documents
was (float) – Target porfolio weighted average spread
warr (float) – Target portfolio weighted average recovery
wal (float) – Target portfolio weighted average life
rs_bound_lower (float) – max risk score boundary (low), required for optimizer
rs_bound_higher (float) – max risk score boundary (high), required for optimizer
monitor_cushion (float) – optional; can be used to keep a constant cushion between BDR and SDR when solving
force_high (tuple) – (rating_number, pct) for higher rtg prior to solving for risk score, force this on pool
force_low (tuple) – (rating_number, pct) for lower rtg prior to solving for risk score, force this on pool
- Returns
instance results data class object
- Return type