From 6747220f2588c875db882acfd338468ebd782857 Mon Sep 17 00:00:00 2001 From: Tom Youngman Date: Wed, 19 Aug 2026 16:35:16 +0100 Subject: [PATCH 1/2] Units bug in credit market clearing was erroneously limiting credit supply to near zero --- .../markets/credit_market/func/clearing.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/macromodel/markets/credit_market/func/clearing.py b/macromodel/markets/credit_market/func/clearing.py index a4e41552..4f4d1d8c 100644 --- a/macromodel/markets/credit_market/func/clearing.py +++ b/macromodel/markets/credit_market/func/clearing.py @@ -260,19 +260,19 @@ def clear( - banks.ts.current("total_outstanding_loans") - new_credit_by_bank, ) - max_supply_based_on_preferences_firms = banks.ts.initial("new_loans_fraction_firms") * np.exp( + max_supply_based_on_preferences_firms = max_car * banks.ts.initial("new_loans_fraction_firms") * np.exp( -self.credit_supply_temperature * current_npl_firm_loans ) - max_supply_based_on_preferences_hh_cons = banks.ts.initial("new_loans_fraction_hh_cons") * np.exp( + max_supply_based_on_preferences_hh_cons = max_car * banks.ts.initial("new_loans_fraction_hh_cons") * np.exp( -self.credit_supply_temperature * current_npl_hh_cons_loans ) - max_supply_based_on_preferences_mortgages = banks.ts.initial("new_loans_fraction_mortgages") * np.exp( + max_supply_based_on_preferences_mortgages = max_car * banks.ts.initial("new_loans_fraction_mortgages") * np.exp( -self.credit_supply_temperature * current_npl_mortgages ) current_sum = ( - max_supply_based_on_preferences_firms * max_car - + max_supply_based_on_preferences_hh_cons * max_car - + max_supply_based_on_preferences_mortgages * max_car + max_supply_based_on_preferences_firms + + max_supply_based_on_preferences_hh_cons + + max_supply_based_on_preferences_mortgages ) scale = np.divide( max_car, @@ -999,19 +999,19 @@ def clear( - banks.ts.current("total_outstanding_loans") - new_credit_by_bank, ) - max_supply_based_on_preferences_firms = banks.ts.initial("new_loans_fraction_firms") * np.exp( + max_supply_based_on_preferences_firms = max_car * banks.ts.initial("new_loans_fraction_firms") * np.exp( -self.credit_supply_temperature * current_npl_firm_loans ) - max_supply_based_on_preferences_hh_cons = banks.ts.initial("new_loans_fraction_hh_cons") * np.exp( + max_supply_based_on_preferences_hh_cons = max_car * banks.ts.initial("new_loans_fraction_hh_cons") * np.exp( -self.credit_supply_temperature * current_npl_hh_cons_loans ) - max_supply_based_on_preferences_mortgages = banks.ts.initial("new_loans_fraction_mortgages") * np.exp( + max_supply_based_on_preferences_mortgages = max_car * banks.ts.initial("new_loans_fraction_mortgages") * np.exp( -self.credit_supply_temperature * current_npl_mortgages ) current_sum = ( - max_supply_based_on_preferences_firms * max_car - + max_supply_based_on_preferences_hh_cons * max_car - + max_supply_based_on_preferences_mortgages * max_car + max_supply_based_on_preferences_firms + + max_supply_based_on_preferences_hh_cons + + max_supply_based_on_preferences_mortgages ) scale = np.divide( max_car, From 774bf86d779a72ae67712dad8d598be04e8c3c9e Mon Sep 17 00:00:00 2001 From: Tom Youngman Date: Wed, 19 Aug 2026 16:36:50 +0100 Subject: [PATCH 2/2] Make default parameters for consumer loans and mortgages more sensible (LtI, LtV, DSCR, maturity) --- macromodel/configurations/bank_configuration.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macromodel/configurations/bank_configuration.py b/macromodel/configurations/bank_configuration.py index c0e27cd2..edb8dbe9 100644 --- a/macromodel/configurations/bank_configuration.py +++ b/macromodel/configurations/bank_configuration.py @@ -37,11 +37,11 @@ class BankParameters(BaseModel): firm_loans_debt_to_equity_ratio: float = Field(ge=0, le=1, default=0.03) firm_loans_return_on_equity_ratio: float = Field(ge=0, le=1, default=0.05) firm_loans_return_on_assets_ratio: float = Field(ge=0, le=1, default=0.05) - household_consumption_loans_loan_to_income_ratio: float = Field(ge=0, le=1, default=0.05) - mortgage_loan_to_income_ratio: float = Field(ge=0, le=1, default=0.05) - mortgage_loan_to_value_ratio: float = Field(ge=0, le=1, default=0.05) - mortgage_debt_service_to_income_ratio: float = Field(ge=0, le=1, default=0.05) - household_consumption_loan_maturity: int = Field(ge=0, default=1) + household_consumption_loans_loan_to_income_ratio: float = Field(ge=0, le=1, default=0.5) + mortgage_loan_to_income_ratio: float = Field(ge=0, le=10, default=3) + mortgage_loan_to_value_ratio: float = Field(ge=0, le=1.1, default=0.8) + mortgage_debt_service_to_income_ratio: float = Field(ge=0, le=1, default=0.3) + household_consumption_loan_maturity: int = Field(ge=0, default=12) long_term_firm_loan_maturity: int = Field(ge=0, default=60) mortgage_maturity: int = Field(ge=0, default=120) short_term_firm_loan_maturity: int = Field(ge=0, default=20)