A simple python package to provide mortgage repayment calculations using the French method of amortization
Project description
Parameterized Mortgage
A package to provide an easily vizualizable mortgage class, built on the Holoviz Param and Panel packages.
Installation
Install the package using pip:
pip install parameterized_mortgage
Import the Mortgage class:
from parameterized_mortgage import Mortgage
Demo
The package includes a demo dashboard application to show how the Mortgage class can be embedded in visualizations using holoviz panel. See the code in parameterized_mortgage.dashboard
to see how this is achieved.
To run the demo on your own machine, install the package using pipx (install pipx if necessary):
pipx install git+https://github.com/JonathanMair/parameterized_mortgage.git
The run the following command:
dashboard
The panel app will launch and should open automatically in a browser. It will look like this:
Usage
Mortgage class constructor and user-set parameters
The Mortgage constructor takes 3 named parameters:
- principal (float): amount initially borrowed
- rate (float): annual interest rate expressed as a %
- term (int): mortgage term in years
e.g.:
mortgage = Mortgage(principal=300000, rate=4.5, term=20)
These three parameters can be re-set at any time and all other members will be recalculated automatically as a result.
e.g.:
mortgage.rate = 3.8
Other class members
Mortgage.monthly_payment
: A float representing the value of monthly repayments without rounding
Mortgage.get_monthly_payment()
: Returns the monthly repayment as a string, formatted to 2 decimal places
Mortgage.repayment_schedule()
: Returns a pandas DataFrame containing the full repayment schedule or amortization table
Mortgage.annual_summary()
: Returns a pandas DataFrame containing the repayment schedule summarized by year
Mortgage.lifetime_summary()
: Returns a pandas DataFrame containing the repayment schedule summarized over the whole lifetime of the mortgage
Mortgage.custom_widgets()
: Returns dictionary detailing customised widgets for a panel.Param object that will allow the user-set parameters to be incorporated easily in a dashboard
Mortgage.amortization_chart()
: Returns a plot of the outstanding loan over time
Mortgage.chart_interest_vs_capital()
: Returns a plot of the interest and capital components of monthly payments over time
Contributing
Contributions are welcome!
License
This project is licensed under the GNU GENERAL PUBLIC LICENSE Version 3.
Disclaimer
This software makes calculations that could be relevant to investment decisions, but it is provided without warranty. Users' attention is drawn to the relevant paragraphs of the licence.
Change log
- 0.1.5: updated README.md
- 0.1.4: added script entrypoint
- 0.1.3: moved main.py with demo cli to module
dashboard
- 0.1.2: fixed error in param.depends declarations in Mortgage
Project details
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
Hashes for parameterized_mortgage-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7a4259987ed6ae731c1298fe1841c3c8c49860adae4a83f85ffbe2e5c6badf4 |
|
MD5 | c8fb84846886be60db25e89892e61f5f |
|
BLAKE2b-256 | db1a7127551aac70b8a4d4f96e5bbedbf418678f1c1eed115b01abdcc7b841a1 |
Hashes for parameterized_mortgage-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27c419c427b1176ccf266084726573318dd4a8807c1d93230ec0ced8b30250ee |
|
MD5 | e9700d4b7d900b049a17c8becaa1493b |
|
BLAKE2b-256 | 287a964cbffc0dcdb6613cfc19a7ab9abd0ccd2974147c9454a1343ddfe9a63a |