models
Loan and analysis data models.
LoanParams
dataclass
Parameters for a mortgage loan.
Attributes:
| Name | Type | Description |
|---|---|---|
balance |
float
|
Loan balance. |
rate |
float
|
Annual interest rate as a decimal. |
term_years |
float
|
Loan term in years. |
Source code in src/refi_calculator/core/models.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
monthly_payment
property
Monthly payment using the standard amortization formula.
Returns:
| Type | Description |
|---|---|
float
|
Monthly payment amount. |
monthly_rate
property
Monthly interest rate.
Returns:
| Type | Description |
|---|---|
float
|
Monthly interest rate as a decimal. |
num_payments
property
Total number of monthly payments.
Returns:
| Type | Description |
|---|---|
int
|
Total number of payments. |
total_interest
property
Total interest paid over the life of the loan.
RefinanceAnalysis
dataclass
Results of refinance breakeven analysis.
Attributes:
| Name | Type | Description |
|---|---|---|
current_payment |
float
|
Current monthly payment. |
new_payment |
float
|
New monthly payment. |
monthly_savings |
float
|
Monthly savings from refinancing. |
simple_breakeven_months |
float | None
|
Months to simple breakeven (nominal). |
npv_breakeven_months |
int | None
|
Months to NPV breakeven. |
current_total_interest |
float
|
Total interest of the current loan. |
new_total_interest |
float
|
Total interest of the new loan. |
interest_delta |
float
|
Interest difference between new and current loans. |
five_year_npv |
float
|
NPV of savings over five years. |
cumulative_savings |
list[tuple[int, float, float]]
|
Cumulative savings timeline. |
current_after_tax_payment |
float
|
Current payment after tax benefit. |
new_after_tax_payment |
float
|
New payment after tax benefit. |
after_tax_monthly_savings |
float
|
After-tax monthly savings. |
after_tax_simple_breakeven_months |
float | None
|
After-tax simple breakeven. |
after_tax_npv_breakeven_months |
int | None
|
After-tax NPV breakeven. |
after_tax_npv |
float
|
After-tax NPV of savings. |
current_after_tax_total_interest |
float
|
Current loan interest after tax. |
new_after_tax_total_interest |
float
|
New loan interest after tax. |
after_tax_interest_delta |
float
|
Interest delta after tax. |
new_loan_balance |
float
|
Balance of the new loan. |
cash_out_amount |
float
|
Cash out amount included in the refinance. |
accelerated_months |
int | None
|
Months to payoff when maintaining payment. |
accelerated_total_interest |
float | None
|
Total interest when accelerating payoff. |
accelerated_interest_savings |
float | None
|
Interest savings from acceleration. |
accelerated_time_savings_months |
int | None
|
Months saved by accelerating payoff. |
current_total_cost_npv |
float
|
NPV of the current loan total cost. |
new_total_cost_npv |
float
|
NPV of the new loan total cost. |
total_cost_npv_advantage |
float
|
NPV advantage of refinancing. |
Source code in src/refi_calculator/core/models.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |