Skip to content

Instantly share code, notes, and snippets.

@duke79
Last active May 10, 2019 15:53
Show Gist options
  • Save duke79/13e4a6b320986b316992858bee7a8812 to your computer and use it in GitHub Desktop.
Save duke79/13e4a6b320986b316992858bee7a8812 to your computer and use it in GitHub Desktop.
Calculators
class Portfolio:
AGE=29 # Starting year
CTC=1000000 # Total CTC, it's assumed that only 75% comes in hand
HIKE=100000 # Assuming 1 lakh hike every year
RETURNS_PER_ANNUM = 1.10 # Assuming investment returns are 10% per annum
EXPENSES_PER_MONTH = 40000 # Assuming monthly expenses are 40k, inflation taken into account while calculating though
INFLATION=1.07 # Assuming 7% inflation
ASSETS=0 # Assuming there's no investment so far
DURATION=50 # Assuming death after 50 years
RETIRE_AFTER = 10 # Assuming a wish to retire after 10 years
INFLATION_SO_FAR = 1 # For calculation purposes
TAG_LINE = ""
p = Portfolio()
def i_make_money_pregnant():
p.TAG_LINE = """I fly away after 5 years to never return back on earth. """
p.CTC = 1000000
p.HIKE = 100000
p.RETURNS_PER_ANNUM = 1.30
p.INFLATION = 1.05
p.DURATION = 60
p.RETIRE_AFTER = 5
def i_invest_like_a_god_and_work_a_little_extra():
p.TAG_LINE = """I retire in 10 years and die of the exhaustion that comes from giving away gold coins in charity, one by one. """
p.CTC = 1000000
p.HIKE = 100000
p.RETURNS_PER_ANNUM = 1.25
p.INFLATION = 1.05
p.DURATION = 60
p.RETIRE_AFTER = 10
def i_invest_like_a_god():
p.TAG_LINE = """I retire in 5 years and still die fucking rich. """
p.CTC = 1000000
p.HIKE = 100000
p.RETURNS_PER_ANNUM = 1.25
p.INFLATION = 1.05
p.DURATION = 60
p.RETIRE_AFTER = 5
def i_invest_in_good_stocks():
p.TAG_LINE = """I can dream about retiring after 7 years and die rich. """
p.CTC = 1000000
p.HIKE = 100000
p.RETURNS_PER_ANNUM = 1.20
p.INFLATION = 1.05
p.DURATION = 60
p.RETIRE_AFTER = 7
def i_invest_in_mutual_fund():
p.TAG_LINE = """I can dream about retiring after 12 years. My money ends with me."""
p.CTC = 1000000
p.HIKE = 100000
p.RETURNS_PER_ANNUM = 1.12
p.INFLATION = 1.05
p.DURATION = 60
p.RETIRE_AFTER = 12
def i_invest_in_fixed_deposit():
p.TAG_LINE = """There's no retirement for me in the next 35 years. """
p.CTC = 1000000
p.HIKE = 100000
p.RETURNS_PER_ANNUM = 1.05
p.INFLATION = 1.05
p.DURATION = 60
p.RETIRE_AFTER = 35
def i_keep_money_in_savings_account():
p.TAG_LINE = """I work until my last breath. """
p.CTC = 1000000
p.HIKE = 100000
p.RETURNS_PER_ANNUM = 1.02
p.INFLATION = 1.05
p.DURATION = 60
p.RETIRE_AFTER = 52
def calculate():
for i in range(p.DURATION):
print("AGE: %s"% str(p.AGE+i))
# print("{:,}".format(p.ASSETS))
adjusted_assets = p.ASSETS/p.INFLATION_SO_FAR
adjusted_assets = int(int(adjusted_assets)/100)*100
print("{:,}".format(adjusted_assets)) # Adjusted inflation
if p.RETIRE_AFTER == i:
p.CTC = 0
p.HIKE = 0
print("\n")
print("*****************RETIRED****************")
p.CTC = p.CTC + p.HIKE
p.EXPENSES_PER_MONTH = p.EXPENSES_PER_MONTH * p.INFLATION
p.ASSETS = (p.ASSETS*p.RETURNS_PER_ANNUM) + p.CTC*0.75 - (12 * p.EXPENSES_PER_MONTH)
p.INFLATION_SO_FAR = p.INFLATION_SO_FAR * p.INFLATION
print("\n")
print("<Net worth estimates (inflation adjusted).>\n")
print(p.TAG_LINE)
####################################################
############# Choose an option 3#################
####################################################
# i_make_money_pregnant()
# i_invest_like_a_god_and_work_a_little_extra()
# i_invest_like_a_god()
# i_invest_in_good_stocks()
# i_invest_in_mutual_fund()
# i_invest_in_fixed_deposit()
i_keep_money_in_savings_account()
calculate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment