Python script to generate an amortization schedule (for amortized loans such as mortgages). Supports extra payments towards principal.
scuti 2b84cd0a73 Merge branch 'master' into publish | hai 6 meses | |
---|---|---|
src | hai 6 meses | |
Makefile | hai 6 meses | |
README.md | hai 6 meses |
Generates an amortization schedule based on the principal, interest rate, term, and any additional payments towards principal.
Only imports argparse
and json
for the main block of the script.
schedule.csv
Invoke make test
to generate a schedule based on loan of 100,000 over a 3 year term given an interest rate of 5.0% with a one-time payment towards principal of 5000 at the 13th month.
For extra payments towards principal, invoking the script will look like:
python src/amort.py -p {principal} -i {interest rate} -t {years} --extra-payments extra_payments.json
A valid json file contains a list named extra-payments
. Each element is an object with the attributes payment-number
and amount
.
{
"extra-payments" : [
{
"payment-number": 1,
"amount": 500
}, {
"payment-number": 2,
"amount": 500
}, {
"payment-number": 3,
"amount": 500
}
]
}
payment-number
is the month when the payment has been made.amount
is self-explanatoryThis originated from me playing with ChatGPT. I asked it a question and it blurted out a semi-functional script as an answer. Then I made this repo to track the errors I fixed.