model_clo_insight.clo_internal_objects module

This module serves as the location for all of the internal model object classes used in the computational engines.

Setup() method:
  • used for assigning relationships based on other objects in the model

class ConcLimitException(number, percentage)

Bases: object

Concentration limitation exception

number: int

number of exceptions allowed at this level

percentage: float

concentration limitation level for a set number of exceptions

class CorpLoan(ident, name, prop_id, par, tenor=None, recovery_rate=None, custom_pd_curve=None)

Bases: object

Represents a Loan to a Corporation

amort_sched

amortization schedule for loan

contract_tenor

actual tenor of the Security, only used in the modeling if turned on in settings

Type

float

ident

unique identifier for the loan

Type

string

name

name identifier for loan

Type

string

par

par balance of the corporate loan

Type

float

parent_obligor

instance of the parent Obligor which secures this corporate loan

Type

Obligor

pd

default probability, based on the PD curve of the obligor, tenor of security

pd_normed

pd converted to standard normal

prop_id

identifier for the parent Obligor

Type

string

recovery_rate

asset specific recovery used for the Security, only used in the modeling if turned on in settings

Type

float

reset()
set_amort(raw_amort, settings)

Compute amortization schedule for this Corp Loan

Parameters
  • raw_amort – list[float]: array containing the remaining balance at the end of each year (optional)

  • settings – takes in objects.ModelSettings

Returns

amortization schedule

setup(obligors, transaction, settings)

Setup method for the CorpLoan class

CorpLoan needs access to the fields of its parent Obligor. This method also uses the Settings object to determine which tenor assumption to use. The security PD is normalized here so that the random normals in the simulation do not have to be converted to uniforms, which saves computation time

Parameters
  • obligors (list[clo_internal_objects.Obligor]) – all Properties in the pool

  • transaction – TransactionData: pool/deal data (custom PD curves)

  • settings – ModelSettings: contains settings for tenor

Returns

None

Notes

self.pd not used in the simulation, but is needed to compute pool metrics

tenor

float:

class HypoPoolRow(row, ind_code, numerical_rtg, pct, total_par, pd_curve)

Bases: object

Represents a single line item in a pool generated by the hypo pool generators

compute_pd(tenor, pd_lookup)
ind_code: int

DBRSM industry code

numerical_rtg: int

DBRSM rating in integer form

pct: float

percentage of total par for pool item

pd_curve: numpy.ndarray

cumulative pd curve (from IDT)

row: int

single line item of the pool

total_par: float

par amount for pool item

class MethodologyParamsDefaults(IDT, rating_list, rtg_regime_map, correl)

Bases: object

Contains the Methodology Parameters for Simulating Defaults in the Pooling Method

Notes

Typically these are stored in a json file inside the project

IDT

DBRS idealized default table

Type

list of list

correl_diff_reg_diff_ind

depricated in methodology, but functionality available in model

correl_diff_reg_same_ind

depricated in methodology, but functionality available in model

correl_same_reg_diff_ind

asset correlation between different industries

Type

float

correl_same_reg_same_ind

asset correlation within industry

Type

float

rating_list

list of DBRS ratings

Type

list

rtg_regime_map

each rating mapped to the whole rating

Type

dict

class ModelSettings(n_trials, seed, n_bins, is_stochastic_rec=False, is_asset_specific_rec=False, is_asset_specific_tenor=False, is_custom_pd=False, is_amort=False)

Bases: object

Contains the User-Specified Model Settings for the Pooling Method

is_amort

if true, build asset-specific amortization schedules in terms of remaining balance

Type

bool

is_asset_specific_rec

flag for using asset specific recovery assumptions

Type

bool

is_asset_specific_tenor

flag for using asset specific tenors

Type

bool

is_custom_pd

flag for using custom pd curves

Type

bool

is_stochastic_rec

flag for using stochastic recoveries (not yet implemented)

Type

bool

n_bins

number of bins to build the default/loss distribution

n_trials

number of trials for the simulation

Type

int

seed

seed for the random number generator

Type

int

class Obligor(name, ind_code, numerical_rtg, pd_curve_ref=None)

Bases: object

Represents the Obligor Securing a Corporate Loan

Data variables

_calc_total_par(securities)

Calculates total par across all securities belonging to this Obligor

Parameters

securities – all securities belonging to obligor

Returns

Total Par for all securities

custom_pd_curve

optional, used to lookup custom PD curve vs PD base on rating

Type

string

ind_code

DBRSM industry code #testine float

Type

int

name

unique identifier

Type

string

numerical_rtg

DBRSM numerical rating (fractional implies split public ratings)

pd_curve

vector of PD curve over time

Type

np.ndarray[float]

pd_curve_normed

normalized PD, used for time-to-default lookup

Type

np.ndarray[float]

reset()

Not applicable for Obligor

Returns:

setup(corp_loans, transaction, methodology)

Setup method for the Obligor class

Obligors need to know the Corp Loans that belong to them in order to calculate total_par. This method also sets up the PD curve.

Parameters
Returns

None

total_par

total par across all securities belonging to this Obligor

Type

float

class PoolPosition(row, ob_name, sec_name, ind_code, rtg, par, rec_rate, tenor, pd_curve)

Bases: tuple

represents raw row of data for pooling inputs

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('row', 'ob_name', 'sec_name', 'ind_code', 'rtg', 'par', 'rec_rate', 'tenor', 'pd_curve')
_fields_defaults = {}
classmethod _make(iterable)

Make a new PoolPosition object from a sequence or iterable

_replace(**kwds)

Return a new PoolPosition object replacing specified fields with new values

ind_code
ob_name
par
pd_curve
rec_rate
row
rtg
sec_name
tenor
class TransactionData(pool_tenor, tranche_tenor_rolldown, tranche_tenor_level, tranche_tenor_rtg, pool_amort=None, custom_pd_dict=None)

Bases: object

Contains the Transaction Level Data

Pool and deal-level information. This object also contains transaction-specific lookup tables and settings

applicable_ind_codes

unique list of industries across the pool

Type

list

custom_pd_dict

dictionary to assign asset PD curves based on custom curve in the simulation method

pool_amort

pool amortization per rating regime

Type

dict of lists

setup(obligors)

Setup method for the Transaction Data

Transaction needs to know the Property in the pool in order to determine which property types & MSA Groups to shock in the simulation.

Parameters

obligors – list of Obligor: obligors in the pool

Returns:

tenors_agg

aggregate tenors across ratings stack

Type

list of float

tranche_tenor_level

expected final maturity of each tranche/rating level

Type

list of float

tranche_tenor_rtg

expected final maturity of each tranche/rating level

Type

list of int

transaction_tenor

tenor of the pool, generally weighted average or covenant based

Type

float

build_obs_and_loans_sp(raw_pool, pool_wal)

Used to build / debug hypo, so just assume some dummy parameters for setttings and transaction