Skip to main content

Compound Interest Calculator

This package provides a CompoundInterestCalculator class for calculating compound interest for various financial scenarios.

Features

  • Calculate the total amount with compound interest over a period of time.
  • Determine the time needed to reach a target amount with compound interest.
  • Calculate the required recurring deposit to reach a target amount.
  • Calculate the required interest rate to reach a target amount.

Installation

You can install the package using pip:

pip install compoundercalc

Usage

Importing the Calculator

from compoundercalc.compounder import CompoundInterestCalculator

Creating an Instance

calc = CompoundInterestCalculator(initial_deposit=1000, recurring_deposit=150, num_recurring_per_year=12, interest_rate=0.08)

Calculating the Final Amount

result = calc.final_amount(time_years=10)
print(f"The final amount is: {result:.2f}")

Determining the Time to Reach a Target Amount

years, months, days = calc.time_goal(target_amount=100000)
print(f"Time needed to reach the goal: {years} years, {months} months, and {days} days")

Calculating the Required Recurring Deposit

required_deposit = calc.calc_recurring_deposit(target_amount=100000, total_years=10)
print(f"The required recurring deposit is: {required_deposit:.2f}")

Calculating the Required Interest Rate

try:
    required_rate = calc.calc_interest_rate(target_amount=100000, total_years=10)
    print(f"The required annual interest rate is: {required_rate:.4f}")
except ValueError as e:
    print(e)

Running Tests

To run the tests, use the following command:

python -m unittest discover -s test

License

This project is licensed under GNU License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for compoundercalc 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compoundercalc 0.1.0
File Size Uploaded
compoundercalc-0.1.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for compoundercalc 0.1.0
File Interpreter ABI Platform
compoundercalc-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / compoundercalc-0.1.0.tar.gz

Download URL compoundercalc-0.1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c97feb11f50b71cb86886f4a1f1c43223e99874e48c57dc943355bef96954b88
BLAKE2b-256 checksum
How to use checksums
510ec706eb628cd73627315b9f018dd29abdeb8c2c4775c32369addb6eb5b546
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / compoundercalc-0.1.0-py3-none-any.whl

Download URL compoundercalc-0.1.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc44023e7a519cc4418f27adbb495ed074f58b781e17bc2e0d282c2da399648e
BLAKE2b-256 checksum
How to use checksums
474bc1634c1235636833c6aef0f610e1f373169babbbeea6a50dcd3dd982bfb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page