fair change in calcs to handle switching from fortnightly lease payments while working to monthly when I quit, and allowing for a buyout instead of continuing the lease when I quit - this will be a bit dodgy until we get an accurate buyout figure and its around when I officially leave work / my final payment - so not really sure how all that will land with +12 weeks notice, etc. But, its functional/as accurate as I can make it for now - with a question still as to how many actual extra payments are made after I stop working - I presume its pay forward, so last pay will include 2 weeks of lease paid, but I am not dealing with that overlap 2 weeks / so might be short a $2k payment or even half it - Again, need accurate figures at time of quitting
This commit is contained in:
63
calc.py
63
calc.py
@@ -1,6 +1,9 @@
|
||||
# calc.py
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
# GLOBAL CONSTANTS
|
||||
LEASE = 0
|
||||
|
||||
def add_annotation(finance, dt, total, delta, text):
|
||||
# dont add an annotation for small changes (jic)
|
||||
# if abs(delta) < 5000:
|
||||
@@ -21,6 +24,7 @@ def calculate_savings_depletion(finance):
|
||||
Car_loan_via_pay = finance['Car_loan_via_pay']
|
||||
Car_loan = finance['Car_loan']
|
||||
Car_balloon = finance['Car_balloon']
|
||||
Car_buyout = finance['Car_buyout']
|
||||
Living_Expenses = finance['Living_Expenses']
|
||||
Savings = finance['Savings']
|
||||
Interest_Rate = finance['Interest_Rate']
|
||||
@@ -35,6 +39,7 @@ def calculate_savings_depletion(finance):
|
||||
D_CBA_shares = finance['D_CBA_shares']
|
||||
TLS_price = finance['TLS_price']
|
||||
CBA_price = finance['CBA_price']
|
||||
Ioniq6_future = finance['Ioniq6_future']
|
||||
|
||||
### COMPLEX tax implications with my leave I have not taken. It will be taxed in the year I 'quit' ###
|
||||
|
||||
@@ -74,17 +79,12 @@ def calculate_savings_depletion(finance):
|
||||
current_date = datetime.now()
|
||||
end_date = datetime(2031, 4, 15)
|
||||
|
||||
# Fortnightly pay
|
||||
car_loan_via_pay = Car_loan_via_pay # Fortnightly payment while income is paid
|
||||
regular_car_loan = Car_loan/2 # Fortnightly payment after salary ends (current cost in in months) -- TODO: make this be paid monthly
|
||||
|
||||
# Calculate daily living expenses
|
||||
daily_living_expenses = Living_Expenses / 365
|
||||
|
||||
# take a stab at future rego and insurance on the Ioniq 6 when we finish the lease - paid every anniversary of the Car balloon payment date
|
||||
ioniq6_rego = 800
|
||||
ioniq6_ins = 2200
|
||||
post_lease_car_costs = ioniq6_rego + ioniq6_ins
|
||||
|
||||
# Start the calculation
|
||||
current_savings = Savings
|
||||
@@ -99,6 +99,7 @@ def calculate_savings_depletion(finance):
|
||||
# significant dates - but who knows when? :)
|
||||
overseas_trip_date = datetime.strptime( finance['Overseas_trip_date'], "%Y-%m-%d")
|
||||
mark_reno_date = datetime.strptime( finance['Mark_reno_date'], "%Y-%m-%d")
|
||||
car_buyout_date = datetime.strptime( finance['Car_buyout_date'], "%Y-%m-%d")
|
||||
|
||||
# to force deakin pay cycles to match reality, we work from the 8th of Jan as our "day-zero" so we are paid on the 8/1/25, 22/1/25, etc.
|
||||
days_count = ( current_date - datetime(2025,1,1) ).days
|
||||
@@ -128,6 +129,11 @@ def calculate_savings_depletion(finance):
|
||||
fortnight_income += D_Salary
|
||||
D_Num_fortnights_pay -= 1
|
||||
|
||||
# keep paying car off fortnightly until the end of the car loan (while I am still working) - once I quit, pay reverts to monthly on the 15th
|
||||
if not D_has_quit and current_date < car_balloon_date:
|
||||
current_savings -= Car_loan_via_pay
|
||||
print( f"{current_date}: making car loan pay as pre-tax lease: ${Car_loan_via_pay}" )
|
||||
|
||||
if D_Num_fortnights_pay == 0 and D_leave_after_tax > 0:
|
||||
D_has_quit = True
|
||||
# okay, if we leave before Jun 30th 2024, then I pay full tax, otherwise I get 'extra', but have to await end of next fin year
|
||||
@@ -135,7 +141,7 @@ def calculate_savings_depletion(finance):
|
||||
claim_tax_on_leave = True
|
||||
else:
|
||||
claim_tax_on_leave = False
|
||||
print(f"D has resigned {current_date}: get paid out my 9 weeks leave and lose 45% to tax - ${D_leave_after_tax}" )
|
||||
print(f"{current_date}: D has resigned - get paid out my 9 weeks leave and lose 45% to tax - ${D_leave_after_tax}" )
|
||||
current_savings += D_leave_after_tax
|
||||
add_annotation(finance, current_date, current_savings, D_leave_after_tax, "D quit" )
|
||||
D_leave_after_tax = 0
|
||||
@@ -148,43 +154,60 @@ def calculate_savings_depletion(finance):
|
||||
claim_tax_on_leave=False
|
||||
|
||||
if fortnight_income:
|
||||
print(f"salary paid by Deakin: {current_date} adding: {fortnight_income}" )
|
||||
print(f"{current_date}: salary paid by Deakin - adding: {fortnight_income}" )
|
||||
current_savings += fortnight_income
|
||||
fortnight_income = 0 # reset for next fortnight
|
||||
|
||||
# keep paying car off until the end of the car loan
|
||||
if current_date < car_balloon_date:
|
||||
if D_Num_fortnights_pay > 0:
|
||||
current_savings -= car_loan_via_pay
|
||||
else:
|
||||
current_savings -= regular_car_loan
|
||||
|
||||
savings_per_fortnight.append((current_date.strftime("%Y-%m-%d"), round(current_savings, 2)))
|
||||
|
||||
# if I have quit, then car lease payments are made on the 15th of the month for full Car_loan
|
||||
if D_has_quit and current_date.day == 15:
|
||||
if Ioniq6_future == LEASE and current_date <= car_balloon_date:
|
||||
current_savings -= Car_loan
|
||||
print( f"{current_date}: making car loan pay (after quitting): ${Car_loan}" )
|
||||
elif Ioniq6_future != LEASE and current_date <= car_buyout_date:
|
||||
current_savings -= Car_loan
|
||||
print( f"{current_date}: making car loan pay (after quitting): ${Car_loan}" )
|
||||
|
||||
if is_end_of_month:
|
||||
current_savings += monthly_interest
|
||||
#print(f"interest paid {current_date}: ${monthly_interest}")
|
||||
#print(f"{current_date}: interest paid - ${monthly_interest}")
|
||||
monthly_interest = 0
|
||||
# monthly increase living expenses by a monthly inflation multiplier
|
||||
Living_Expenses += (Inflation/100.0)/12 * Living_Expenses
|
||||
daily_living_expenses = Living_Expenses / 365
|
||||
#print(f"Living Exp inceased {current_date}: ${Living_Expenses}")
|
||||
#print(f"{current_date}: Living Exp inceased - ${Living_Expenses}")
|
||||
|
||||
if current_date.date() == school_fees_date.date():
|
||||
current_savings -= School_Fees
|
||||
add_annotation(finance, current_date, current_savings, -School_Fees, "School Fees")
|
||||
|
||||
if current_date.date() == car_balloon_date.date():
|
||||
if Ioniq6_future == LEASE and current_date.date() == car_balloon_date.date():
|
||||
current_savings -= Car_balloon
|
||||
add_annotation(finance, current_date, current_savings, -Car_balloon, "car balloon")
|
||||
print(f"{current_date}: car balloon - ${Car_balloon}" )
|
||||
|
||||
if Ioniq6_future != LEASE and current_date.date() == car_buyout_date.date():
|
||||
current_savings -= Car_buyout
|
||||
add_annotation(finance, current_date, current_savings, -Car_buyout, "car buyout")
|
||||
print(f"{current_date}: car buyout - ${Car_buyout}" )
|
||||
|
||||
# Anniversary of Car purchase/balloon so potentially insurance/rego
|
||||
# when I quit, the if we haven't paid the car outright, then need to add rego, but not insurance
|
||||
# if we pay-out the car, then add insurace and rego
|
||||
if current_date.month == car_balloon_date.month and current_date.day == car_balloon_date.day:
|
||||
if current_date.year > car_balloon_date.year:
|
||||
current_savings -= post_lease_car_costs
|
||||
add_annotation(finance, current_date, current_savings, -post_lease_car_costs, "IONIQ 6 ins/rego" )
|
||||
# staying with the lease (0), if I have quit, then pay monthly rego only up to lease date, but full cost after car balloon date
|
||||
if Ioniq6_future == LEASE:
|
||||
if current_date.year > car_balloon_date.year:
|
||||
current_savings -= (ioniq6_ins + ioniq6_rego)
|
||||
add_annotation(finance, current_date, current_savings, -(ioniq6_ins+ioniq6_rego), "IONIQ 6 ins/rego" )
|
||||
else:
|
||||
current_savings -= ioniq6_rego
|
||||
add_annotation(finance, current_date, current_savings, -ioniq6_rego, "IONIQ 6 rego" )
|
||||
# if we buy car outright, then as long as this anniversary is after buyout date, pay ins and rego
|
||||
elif current_date.year > car_buyout_date.year:
|
||||
current_savings -= (ioniq6_ins + ioniq6_rego)
|
||||
add_annotation(finance, current_date, current_savings, -(ioniq6_ins+ioniq6_rego), "IONIQ 6 ins/rego" )
|
||||
|
||||
if current_date.date() == overseas_trip_date.date():
|
||||
current_savings -= Overseas_trip
|
||||
|
||||
Reference in New Issue
Block a user