-
Notifications
You must be signed in to change notification settings - Fork 0
/
interest_calc.py
15 lines (13 loc) · 736 Bytes
/
interest_calc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import argparse
compounding_map = {"weekly" : 52, "monthly" : 12, "quarterly" : 4, "biannually" : 2}
parser = argparse.ArgumentParser(description="Calculate yield after n years of an interest rate x")
parser.add_argument("interest", type=float)
parser.add_argument("years", type=int)
parser.add_argument("initial_investment", type=float)
parser.add_argument("--recurring", type=float)
parser.add_argument("--period", choices=["weekly", "monthly", "quarterly", "biannually", "annually"], default="annually")
parser.add_argument("--compounding", choices=["weekly", "monthly", "quarterly", "biannually", "annually"], default="annually")
args = parser.parse_args()
intr = args.interest
years = args.years
inital = args.initial_investment