Python script to generate an amortization schedule (for amortized loans such as mortgages). Supports extra payments towards principal.

scuti a1cdd69c42 merge branch publish 4 months ago
src a1cdd69c42 merge branch publish 4 months ago
Makefile a1cdd69c42 merge branch publish 4 months ago
README.md a1cdd69c42 merge branch publish 4 months ago

README.md

amort

Generates an amortization schedule based on the principal, interest rate, term, and any additional payments towards principal.

requirements

Only imports argparse and json for the main block of the script.

  • saves results to a file schedule.csv
  • does not access the web or internet

usage

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.

extra payments

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-explanatory

misc

This 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.