qfinbox.tvm.loans
Loan calculations and amortization.
Functions
|
Generate loan amortization schedule. |
|
Calculate remaining loan balance after specified payments. |
|
Calculate periodic loan payment. |
|
Calculate total interest paid over the life of the loan. |
|
Validate that a value is positive. |
- qfinbox.tvm.loans.loan_payment(principal: float, annual_rate: float, years: float, payments_per_year: int = 12) float[source]
Calculate periodic loan payment.
- Parameters:
- Returns:
Periodic payment amount.
- Return type:
Examples
>>> loan_payment(300000, 0.05, 30) 1610.46
- qfinbox.tvm.loans.loan_balance(principal: float, annual_rate: float, years: float, payments_made: int, payments_per_year: int = 12) float[source]
Calculate remaining loan balance after specified payments.
- Parameters:
- Returns:
Remaining loan balance.
- Return type:
Examples
>>> loan_balance(300000, 0.05, 30, 120) 260108.58
- qfinbox.tvm.loans.total_interest_paid(principal: float, annual_rate: float, years: float, payments_per_year: int = 12) float[source]
Calculate total interest paid over the life of the loan.
- Parameters:
- Returns:
Total interest paid.
- Return type:
Examples
>>> total_interest_paid(300000, 0.05, 30) 279767.35
- qfinbox.tvm.loans.amortization_schedule(principal: float, annual_rate: float, years: float, payments_per_year: int = 12) DataFrame[source]
Generate loan amortization schedule.
- Parameters:
- Returns:
Amortization schedule with columns: Payment, Interest, Principal, Balance.
- Return type:
pd.DataFrame
Examples
>>> schedule = amortization_schedule(300000, 0.05, 30) >>> schedule.head() Payment Interest Principal Balance 0 1610.46 1250.00 360.46 299639.54 1 1610.46 1248.50 361.96 299277.58