Updated files to produce current daily interest accrual information. Fixed calculation bug. Added current balance to loan information screen.

This commit is contained in:
john
2024-05-20 18:15:36 -04:00
parent d6bd844d5d
commit b5645e2492
2 changed files with 5 additions and 1 deletions

View File

@@ -68,6 +68,7 @@
<tr><td><b>Term: </b></td><td>{{model.parameters.periods }} months </td></tr> <tr><td><b>Term: </b></td><td>{{model.parameters.periods }} months </td></tr>
<tr><td><b>Next Payment Due Date:</b></td><td> {{model.parameters.next_due_date}} </td></tr> <tr><td><b>Next Payment Due Date:</b></td><td> {{model.parameters.next_due_date}} </td></tr>
<tr><td><b>Payment Due:</b></td><td> {{ "$%.2f"|format(model.parameters.next_payment_amt) }} </td></tr> <tr><td><b>Payment Due:</b></td><td> {{ "$%.2f"|format(model.parameters.next_payment_amt) }} </td></tr>
<tr><td><b>Current Balance</b></td><td> {{ "$%.2f"|format(model.current_balance) }}</td></tr>
<tr><td><b>Daily Interest Accrual:</b></td><td> {{ "$%.2f"|format(model.current_daily_interest_accrual) }}</td></tr> <tr><td><b>Daily Interest Accrual:</b></td><td> {{ "$%.2f"|format(model.current_daily_interest_accrual) }}</td></tr>
</tbody> </tbody>
</table> </table>

View File

@@ -385,6 +385,9 @@ def amortizeLoan(loan):
else: else:
loan["parameters"]["next_payment_amt"] = monthly_payment loan["parameters"]["next_payment_amt"] = monthly_payment
loan["current_balance"] = remaining_principal
loan["current_daily_interest_accrual"] = (remaining_principal * daily_interest_rate).quantize(Decimal("0.00"))
# loop over remaining scheduled payments and present estimated amortization # loop over remaining scheduled payments and present estimated amortization
while (payment_number <= total_periods) and (remaining_principal > 0): while (payment_number <= total_periods) and (remaining_principal > 0):
days_since_last_payment = (next_bill_date - interest_paid_through_date).days days_since_last_payment = (next_bill_date - interest_paid_through_date).days
@@ -419,7 +422,7 @@ def amortizeLoan(loan):
next_bill_date = date(year=old_bill_date.year, month=old_bill_date.month + 1, day=payment_day_of_month) next_bill_date = date(year=old_bill_date.year, month=old_bill_date.month + 1, day=payment_day_of_month)
else: else:
next_bill_date = date(year=old_bill_date.year + 1, month=1, day=payment_day_of_month) next_bill_date = date(year=old_bill_date.year + 1, month=1, day=payment_day_of_month)
loan["current_daily_interest_accrual"] = (remaining_principal * daily_interest_rate).quantize(Decimal("0.00"))
loan["balloon_payment"] = remaining_principal loan["balloon_payment"] = remaining_principal
loan["past_payments"] = past_payments loan["past_payments"] = past_payments
loan["future_payments"] = future_payments loan["future_payments"] = future_payments