<> Python
import math

class ReverseMortgageCalculator:
    def __init__(self, home_value, age, expected_rate, margin, upfront_costs=0):
        """
        :param home_value: Current appraised value of the home
        :param age: Age of the youngest borrower
        :param expected_rate: The 10-year swap rate or Treasury rate used for PLF lookup
        :param margin: The lender's margin
        :param upfront_costs: Sum of Initial MIP, Origination fee, and Closing costs
        """
        # HUD Lending Limit (Current 2024 limit is $1,149,825)
        self.hud_limit = 1149825
        self.eligible_value = min(home_value, self.hud_limit)
        
        self.age = age
        self.expected_rate = expected_rate
        self.margin = margin
        self.upfront_costs = upfront_costs
        
        # Total Loan Rate = Expected Rate + 0.5% (Ongoing MIP)
        self.ongoing_mip = 0.005
        self.compounding_rate = (expected_rate + margin + self.ongoing_mip) / 12

    def get_plf(self):
        """
        In a production environment, this would look up the HUD PLF table.
        This simplified logic approximates the Principal Limit Factor.
        """
        # Base approximation: factor increases with age and decreases with rate
        base_factor = (self.age - 62) * 0.006 + 0.40
        rate_adjustment = (0.05 - self.expected_rate) * 2.5
        plf = max(0.1, min(0.75, base_factor + rate_adjustment))
        return round(plf, 3)

    def calculate_initial_principal_limit(self):
        plf = self.get_plf()
        return self.eligible_value * plf

    def project_loan_balance(self, years, monthly_draw=0, initial_draw=0):
        """
        Projects how the loan balance grows over time.
        """
        initial_pl = self.calculate_initial_principal_limit()
        balance = self.upfront_costs + initial_draw
        schedule = []

        for month in range(1, (years * 12) + 1):
            # Interest and MIP accrue on the previous balance
            interest_accrued = balance * self.compounding_rate
            balance += interest_accrued + monthly_draw
            
            if month % 12 == 0:
                schedule.append({
                    "Year": month // 12,
                    "Balance": round(balance, 2),
                    "Accrued_Interest_MIP": round(interest_accrued, 2)
                })
        
        return {
            "Initial_Principal_Limit": round(initial_pl, 2),
            "Net_Available_Cash": round(initial_pl - self.upfront_costs, 2),
            "Projections": schedule
        }

# --- Example Usage ---
calc = ReverseMortgageCalculator(
    home_value=500000, 
    age=72, 
    expected_rate=0.045, 
    margin=0.025, 
    upfront_costs=12000
)

results = calc.project_loan_balance(years=10, monthly_draw=500)

print(f"Initial Principal Limit: ${results['Initial_Principal_Limit']}")
print(f"Net Available at Closing: ${results['Net_Available_Cash']}")
print("\n10-Year Growth Projection:")
for year in results['Projections']:
    print(f"Year {year['Year']}: Balance = ${year['Balance']}")

Ready to meet?

Ready to turn your real estate dreams into reality? Let’s connect and discuss your goals. Fill out the form below, and let the journey to your dream home or property investment begin!