Finance Calculator Tutorial
Welcome to the FinanceCalculator2025 package documentation! FinanceCalculator2025 is a Python package that can be used for calculating financial metrics specifically for loans and investment scenarios. This package is a convenient tool for managing personal finances, offering 4 useful functions: present_value, future_value, n_periods, and calculate_contribution.
Meet Tommy
Tommy is a middle-aged family man juggling work, raising kids, and managing household responsibilities. Recently, he’s realized he needs to take his financial planning more seriously if he wants to secure a comfortable future for himself and his family. With some loans to pay off, a growing list of goals, and a desire to save more, Tommy is looking for practical tools that can help him make smarter financial decisions.
Enter FinanceCalculator2025 — a simple, easy-to-use Python package designed to help people like Tommy take control of their finances. Whether he’s planning for his retirement, saving for a dream family vacation, or just trying to understand how much he needs to set aside each month, FinanceCalculator2025 is here to guide him through the process.
Tommy’s Financial Goals
Tommy currently has $151,000 dollars in his savings account. Each month, after all living expenses have been paid off, he has $2,000 left over that he wants to use to start achieving his goals. Using the FinanceCalculator2025 package, we will walk Tommy through the following steps:
Buying a Home: Tommy can use the
present_valuefunction to estimate how much funds he needs to put away today in order to buy a home in 10 years.Retirement: Tommy can use the
future_valuefunction to calculate how much he can save for retirement.Car Loan: Tommy can use the
calculate_contributionfunction to calculate how much he needs to contribute monthly to pay off his car loan.Family Vacation: Tommy can use the
n_periodsfunction to calculate how long it will take him to save up for a dream family vacation
To get started, lets import the financecalculator2025 package and functions:
import pandas as pd
import financecalculator2025
from financecalculator2025.present_value import present_value
from financecalculator2025.future_value import future_value
from financecalculator2025.contribution import calculate_contribution
from financecalculator2025.n_periods import n_periods
present_value()
Buying a Home
Tommy dreams of buying a house in the next 10 years. He decides to set aside $50,000 of his savings, and will contribute $500 per month towards this goal, with an annual interest rate of 4%, compounded monthly.
Using the present_value function, Tommy can estimate how much his savings will grow at the end of 10 years, considering his monthly contributions and interest earned over time.
Input Parameters:
Current Savings (
principal): $50,000Annual Interest Rate (
annual_rate): 4% (provided by the bank)Total Number of Periods (
n_periods): 120 months (10 years * 12 months)Monthly Contribution (
contribution): 500 (monthly saving from Tommy’s budget)
Tommy runs the following calculation in Python:
from financecalculator2025.present_value import present_value
principal = 50000 # current saving for education
annual_rate = 4 # Annual interest rate in percentage
n_periods = 10 * 12 # Time period (in months)
contribution = 500 # Monthly contribution
present_value(principal, annual_rate, n_periods, contribution)
| Present Value | Principal | Contributions | Interest Saved | |
|---|---|---|---|---|
| 0 | 99385.087429 | 50000 | 60000 | 39385.087429 |
Under the current plan, Tommy’s initial savings, in addition to his interest earned on monthly contributions will be worth $99,385.09! This, combined with his $500 contributions over 10 years will hopefully be enough for a downpayment on a home (although it may not be if he lives in Vancouver!)
Note: The annual_rate input parameter should be entered in percentage form i.e. enter 4 for 4%. If you enter a low interest rate (less than 1), FinanceCalculator2025 will return a warning so Tommy can make sure he entered the correct inputs. For example, if Tommy input annual_rate = 0.04 he would recieve this warning:
present_value(principal=50000, annual_rate=0.04, n_periods=120, contribution=500)
/home/docs/checkouts/readthedocs.org/user_builds/financecalculator/checkouts/latest/src/financecalculator2025/present_value.py:69: UserWarning: Warning: Annual rate is percentage. E.g. if you want to enter 0.05 for 5%, please enter 5.
warnings.warn("Warning: Annual rate is percentage. E.g. if you want to enter 0.05 for 5%, please enter 5.", UserWarning)
| Present Value | Principal | Contributions | Interest Saved | |
|---|---|---|---|---|
| 0 | 109879.163854 | 50000 | 60000 | 49879.163854 |
After contributing towards the house, Tommy still has $101,000 left in his savings and $1,500 remaining for his monthly savings. Let’s see how else Tommy can manage his finances!
future_value()
Retirement
On top of buying a home, Tommy also wants to ensure he has enough funds saved up for a comfortable retirement. The future_value function can help him calculate how much his current savings will grow over time. Tommy thinks he should start by setting aside $75,000. He hopes to retire in 25 years, and he also decides he should contribute $900 dollars each month to go towards this goal. The bank will give him an average annual interest rate of 6%, compounded monthly.
Input Parameters:
Current Savings (
principal): $75,000Annual Interest Rate (
annual_rate): 6% (provided by the bank)Total Number of Periods (
n_periods): 300 months (25 years * 12 months)Monthly Contribution (
contribution): 900 (monthly saving from Tommy’s budget)
Tommy runs the following calculation in Python:
from financecalculator2025.future_value import future_value
principal = 75000 # Current savings
annual_rate = 6 # Annual interest rate in percentage
n_periods = 12*25 # time period (in months)
contribution = 900 # Monthly contribution
future_value(principal, annual_rate, n_periods, contribution)
| Future Value | Principal | Contributions | Interest Earned | |
|---|---|---|---|---|
| 0 | 958567.3 | 75000 | 270000 | 613567.3 |
Tommy will be able to save a total of $958,567.30 dollars by the time of his retirement! This is such a relief for Tommy, he’s so glad he started planning now!
calculate_contribution()
Car Loan
Tommy recently purchased a car and took out a loan of $25,000. The loan has an annual interest rate of 6% (compounded monthly) and must be repaid in 5 years. Tommy wants to figure out how much he needs to contribute each month to fully repay the loan by the end of the term. The calculate_contribution function allows for adjustments in terms, rates, and goals, making it useful for diverse financial planning scenarios!
Input Parameters:
Loan Value (
principal): $-25,000Future Value (
future_value): $0 (To pay off the entire loan)Annual Interest Rate (
annual_rate): 6% (provided by the bank)Total Number of Periods (
n_periods): 60 months (5 years * 12 months)
Tommy runs the following calculation in Python:
from financecalculator2025.contribution import calculate_contribution
principal = -25000 # Loan amount (negative value)
future_value = 0 # Goal is to pay off the loan completely
annual_rate = 6 # Annual interest rate in percentage
n_periods = 5 * 12 # Loan term (in months)
calculate_contribution(principal, future_value, annual_rate, n_periods)
483.32003823570676
To fully repay his car loan in 5 years, Tommy will need to make monthly payments of $483.32.
Note: The principal input parameter for a loan is entered as a negative value to represent amount owed.
n_periods()
Family Vacation
Tommy is feeling so relieved that he has enough in savings and after monthly expenses to save for a home, retirement, and pay off his car loan! He still has a little extra money left over that he wants to put aside to save for a family vacation. He hopes to have $2,000 saved over the next 2 years. Given he still has $1,000 left in his savings, if sets aside $100 per month, and a 5% interest rate compounded monthly, he wonders how long it will take him to save for this dream vacation. Using the n_periods function, Tommy can input his principal amount, annual interest rate, future value, and monthly contributions to determine how long he needs to save.
Input Parameters:
Current Savings (
principal): $1,000Annual Interest Rate (
annual_rate): 5% (provided by the bank)Savings Goal (
n_periods): $2,000Monthly Contribution (
contribution): 100 (monthly saving from Tommy’s budget)
Tommy runs the following calculation in Python:
from financecalculator2025.n_periods import n_periods
principal = 1000 # Current savings
annual_rate = 5 # Annual interest rate in percentage
future_value = 2000 # Savings goal
contribution = 100 # Monthly contribution
# Calculate the number of periods (months)
months = n_periods(principal, annual_rate, future_value, contribution)
print(f"Tommy needs to save for {months} months to reach his goal.")
Tommy needs to save for 9 months to reach his goal.
This means Tommy can reach his $2,000 goal in just 9 months if he consistently saves $100 per month! The interest from the bank helps him achieve his goal even faster.
Final Remarks
We hope you found these examples useful, and see how the FinanceCalculator2025 package can help you realize your financial goals, just like Tommy! If you would like to explore our package further, please refer to the documentation or checkout the packages github repository here