Provides various tools for loan analysis, including generating loan amortization schedule and total interest paid using daily calculation.
Project description
Loan Analysis Toolkit
This packages generates all transactions and an interest schedule for loan accounts such as home loans. It runs daily interest accrual which makes it more accurate than simple formula based calculations. Most banks calculates interests daily and charge them monthly. This package mimics that process. In runs through a daily loop and performs calculation until the loan is paid off.
Technical Documentation
https://salaken-ds.github.io/loan_analysis_toolkit/
Features:
- calculates daily interest which makes the schedule very accurate
- adjusts account balance on repayment dates
- charges interest on monthly loan anniversary e.g. if loan is settled on the 3rd of the month then interest is always charged on the 3rd of the month
- supports offset account with zero or non-zero initial balance
- regular contribution of offset account
- returns (1) all transactions, (2) monthly summary containing interest charged, repayment, loan balance and offset account balance and (3) total interest charged to the customer
Assumption:
- Daily interest charge is based on 365 days in a year, even in a leap year. This is because most Australian bank does it that way.
Usage examples:
- Generate all transactions to the loan account to cross-check against bank. Helps to make sure bank is not making any mistakes. (It may sound surprising, but banks DO make a lot of mistakes!)
- Calculate interest savings by adding an offset account, and making regular contributions. This helps creating strategies to pay out the loan faster and helps with financial wellbeing.
from loan_analysis_toolkit.schedule import prepare_loan_summary
if __name__ == "__main__":
# loan parameters
loan_amount = 650_000 # Loan amount in dollars
annual_rate = 5.34 # Annual interest rate in percentage
loan_duration_years = 30 # Loan term in years
loan_duration_months = 0 # Additional months in loan term
start_date = '2025-10-05' # Loan settlement date
repayment_frequency = 'fortnightly' # Repayment frequency
initial_offset_amount = 20_000 # Initial offset account balance in dollars
offset_contribution_frequency = 'monthly' # Offset contribution frequency
offset_contribution_regular_amount = 500 # Offset contribution amount in dollars
loan_parameters = {'loan_amount' : loan_amount,
'annual_rate' : annual_rate,
'loan_duration_years' : loan_duration_years,
'loan_duration_months' : loan_duration_months,
'start_date' : start_date,
'repayment_frequency' : repayment_frequency,
'initial_offset_amount' : initial_offset_amount,
'offset_contribution_frequency' : offset_contribution_frequency,
'offset_contribution_regular_amount' : offset_contribution_regular_amount
}
res = prepare_loan_summary(loan_parameters, store_results = True)
total_interest_paid_by_customer = res['total_interest_charged']
print("total interested paid by the customer: {}".format(total_interest_paid_by_customer))
print(res['monthly_summary'].head())
Contributions
Please raise a pull request outlining changes.
Others
- Pre-requisite:
uv(eitherpip install uvor see https://docs.astral.sh/uv/getting-started/installation/#standalone-installer) - Clone and then build using:
uv build - Local install into another virtual environment using the built package (assuming you're currently in directory
xyzwhich is at the same level asloan_analysis_toolkit):uv pip install ../loan_analysis_toolkit/dist/loan_analysis_toolkit-0.1.0.tar.gz
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loan_analysis_toolkit-0.1.2.tar.gz.
File metadata
- Download URL: loan_analysis_toolkit-0.1.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
740eab23719cdac3aada08bf9dfecb000de6d343b7f2b3d31ffe1604cea866c3
|
|
| MD5 |
a2a6022d12cc95146cf228815749da50
|
|
| BLAKE2b-256 |
77efe1cbd76f1e388e2e77af7d6a0da7f57711aa86add40271f71306e869e086
|
File details
Details for the file loan_analysis_toolkit-0.1.2-py3-none-any.whl.
File metadata
- Download URL: loan_analysis_toolkit-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f719427bda4e950ed937a3ea05272b8bffddf3c0c640b281463136172ebd579
|
|
| MD5 |
76ca97dcee852cbd8fe7ccc0df0467b9
|
|
| BLAKE2b-256 |
11306bfd25c00b5437b51bb9e9cd3c0da4fa8b609ad6800fd758c396a4b29135
|