Skip to content

Commit

Permalink
Make affordability check compatible with essential consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-carro committed Apr 15, 2022
1 parent f153b8c commit 30e020e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/java/housing/Bank.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ MortgageAgreement requestApproval(Household h, double housePrice, double desired
if (isHome) {
// Affordability constraint: it sets a maximum value for the monthly mortgage payment divided by the
// household's monthly gross employment income
double affordable_principal = getHardMaxAffordability() * h.getMonthlyGrossEmploymentIncome()
/ getMonthlyPaymentFactor(true, h.getAge());
double affordable_principal = getHardMaxAffordability(h.getMonthlyGrossEmploymentIncome())
* h.getMonthlyGrossEmploymentIncome() / getMonthlyPaymentFactor(true, h.getAge());
if (getMonthlyPaymentFactor(true, h.getAge()) == 1.0) affordable_principal = 0.0;
approval.principal = Math.min(approval.principal, affordable_principal);
// Loan-To-Income (LTI) constraint: it sets a maximum value for the principal divided by the household's
Expand Down Expand Up @@ -472,7 +472,7 @@ MortgageAgreement requestApproval(Household h, double housePrice, double desired
if (isHome) {
// Affordability constraint: it sets a maximum value for the monthly mortgage payment divided by the
// household's monthly gross employment income
double affordable_max_price = max_downpayment + getHardMaxAffordability()
double affordable_max_price = max_downpayment + getHardMaxAffordability(h.getMonthlyGrossEmploymentIncome())
* h.getMonthlyGrossEmploymentIncome() / getMonthlyPaymentFactor(true, h.getAge());
if (getMonthlyPaymentFactor(true, h.getAge()) == 1.0) affordable_max_price = max_downpayment;
max_price = Math.min(max_price, affordable_max_price);
Expand Down Expand Up @@ -637,9 +637,14 @@ private double getLoanToValueLimitOld(boolean isFirstTimeBuyer, boolean isHome)

/**
* Get the most constraining affordability limit, between the private and the central bank policies
* @param monthlyGrossEmploymentIncome The monthly gross employment income of this household
* @return The affordability limit applicable to this household
*/
private double getHardMaxAffordability() {
return Math.min(hardMaxAffordability, centralBank.getHardMaxAffordability());
private double getHardMaxAffordability(double monthlyGrossEmploymentIncome) {
double limitGivenByEssentialConsumption =
1.0 - config.ESSENTIAL_NOMINAL_CONSUMPTION / monthlyGrossEmploymentIncome;
return Math.min(limitGivenByEssentialConsumption,
Math.min(hardMaxAffordability, centralBank.getHardMaxAffordability()));
}

/**
Expand Down

0 comments on commit 30e020e

Please sign in to comment.