Skip to main content

Python library for calculating amortizations and generating amortization schedules

Project description

License License Version Version
Github Actions Github Actions Coverage CodeCov
Supported versions Python Versions Wheel Wheel
Status Status Downloads Downloads

amortization

Python library for calculating amortizations and generating amortization schedules

Installation

pip install amortization
pip install amortization[cli]

Usage

Python

Amortization Amount

from amortization.amount import calculate_amortization_amount

amount = calculate_amortization_amount(150000, 0.1, 36)

Amortization Period

from amortization.period import calculate_amortization_period

period = calculate_amortization_period(150000, 0.1, 4840.08)

Amortization Schedule

from amortization.schedule import amortization_schedule

for number, amount, interest, principal, balance in amortization_schedule(150000, 0.1, 36):
    print(number, amount, interest, principal, balance)

Amortization Schedule (using tabulate)

from amortization.schedule import amortization_schedule
from tabulate import tabulate

table = (x for x in amortization_schedule(150000, 0.1, 36))
print(
    tabulate(
        table,
        headers=["Number", "Amount", "Interest", "Principal", "Balance"],
        floatfmt=",.2f",
        numalign="right"
    )
)

Command line

amortize -h
usage: amortize [-h] -P PRINCIPAL -r INTEREST_RATE [-s] [-f {daily,weekly,biweekly,semimonthly,monthly,quarterly,semiyearly,yearly}] (-n PERIOD | -a AMOUNT)

Python library for calculating amortizations and generating amortization schedules

options:
  -h, --help            show this help message and exit
  -s, --schedule        Generate amortization schedule
  -f, --frequency {daily,weekly,biweekly,semimonthly,monthly,quarterly,semiyearly,yearly}
                        Payment frequency
  -n, --period PERIOD   Total number of periods
  -a, --amount AMOUNT   Amortization amount per period

required arguments:
  -P, --principal PRINCIPAL
                        Principal amount
  -r, --interest-rate INTEREST_RATE
                        Interest rate per year
amortize -P 150000 -n 36 -r 0.1             # period
amortize -P 150000 -n 36 -r 0.1 -s          # schedule
amortize -P 150000 -a 4840.08 -r 0.1        # amount
amortize -P 150000 -n 36 -r 0.1 -f weekly   # period (specify payment frequency)
% amortize -P 150000 -n 36 -r 0.1 -s           
Number        Amount    Interest    Principal     Balance
--------  ----------  ----------  -----------  ----------
1           4,840.08    1,250.00     3,590.08  146,409.92
2           4,840.08    1,220.08     3,620.00  142,789.92
3           4,840.08    1,189.92     3,650.16  139,139.76
4           4,840.08    1,159.50     3,680.58  135,459.18
5           4,840.08    1,128.83     3,711.25  131,747.93
6           4,840.08    1,097.90     3,742.18  128,005.75
7           4,840.08    1,066.71     3,773.37  124,232.38
8           4,840.08    1,035.27     3,804.81  120,427.57
9           4,840.08    1,003.56     3,836.52  116,591.05
10          4,840.08      971.59     3,868.49  112,722.56
11          4,840.08      939.35     3,900.73  108,821.83
12          4,840.08      906.85     3,933.23  104,888.60
13          4,840.08      874.07     3,966.01  100,922.59
14          4,840.08      841.02     3,999.06   96,923.53
15          4,840.08      807.70     4,032.38   92,891.15
16          4,840.08      774.09     4,065.99   88,825.16
17          4,840.08      740.21     4,099.87   84,725.29
18          4,840.08      706.04     4,134.04   80,591.25
19          4,840.08      671.59     4,168.49   76,422.76
20          4,840.08      636.86     4,203.22   72,219.54
21          4,840.08      601.83     4,238.25   67,981.29
22          4,840.08      566.51     4,273.57   63,707.72
23          4,840.08      530.90     4,309.18   59,398.54
24          4,840.08      494.99     4,345.09   55,053.45
25          4,840.08      458.78     4,381.30   50,672.15
26          4,840.08      422.27     4,417.81   46,254.34
27          4,840.08      385.45     4,454.63   41,799.71
28          4,840.08      348.33     4,491.75   37,307.96
29          4,840.08      310.90     4,529.18   32,778.78
30          4,840.08      273.16     4,566.92   28,211.86
31          4,840.08      235.10     4,604.98   23,606.88
32          4,840.08      196.72     4,643.36   18,963.52
33          4,840.08      158.03     4,682.05   14,281.47
34          4,840.08      119.01     4,721.07    9,560.40
35          4,840.08       79.67     4,760.41    4,799.99
36          4,839.99       40.00     4,799.99        0.00
Totals    174,242.79   24,242.79   150,000.00

Dependencies

tabulate (optional, required for CLI)

Author

Ronie Martinez

References

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

amortization-3.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amortization-3.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file amortization-3.0.0.tar.gz.

File metadata

  • Download URL: amortization-3.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for amortization-3.0.0.tar.gz
Algorithm Hash digest
SHA256 0c212ca96a71190c793c64b3ccc71a3ab8effa2462fe724d223a334c8f113a62
MD5 92f3612615e404cc6ed1abd05cfeb5cc
BLAKE2b-256 c806510c9a8df12c4bea294002493a5c442049b73ba01bdbf9b6c2bb0484015b

See more details on using hashes here.

File details

Details for the file amortization-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: amortization-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for amortization-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fe14ff73f0b00d77ca56a0927daa5cc02f8c3cd3031d0f3e6b6c059c1409e25
MD5 248e7ff1edb64dc238745ff304371cee
BLAKE2b-256 1461a980e8fd44b937980bd7c3aeddee7948e5edda9243ac4a5bd992476a77df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page