From f52a6ef0331cdbe780da4140c33e1a61048b79be Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Thu, 20 Feb 2025 15:52:14 +1100 Subject: [PATCH] laying ground-work for car leasing to reflect changing to monthly after-tax or even buying out. For now, no actual change in calcs, just prep work --- calc.py | 70 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/calc.py b/calc.py index fb247b7..65aef12 100644 --- a/calc.py +++ b/calc.py @@ -3,8 +3,8 @@ from datetime import datetime, timedelta def add_annotation(finance, dt, total, delta, text): # dont add an annotation for small changes (jic) - if abs(delta) < 5000: - return +# if abs(delta) < 5000: +# return tm = dt.timestamp() * 1000 if delta > 0: text += f": ${int(abs(delta))}" @@ -36,29 +36,55 @@ def calculate_savings_depletion(finance): TLS_price = finance['TLS_price'] CBA_price = finance['CBA_price'] + ### COMPLEX tax implications with my leave I have not taken. It will be taxed in the year I 'quit' ### + # leave in days, 10 business days to a fortnight, # paid before tax I earn $7830.42 / fortnight. Tax on that will be at 37% or $4933.16 after tax # if we could stretch this to July 2026, then would be more (due to less tax) - after_tax_extra_leave_per_fortnight = 4933.16 - D_leave_after_tax = (D_leave_owed_in_days/10) * after_tax_extra_leave_per_fortnight; + bus_days_in_fortnight=10 + + # this is what I earn before-tax + pre_tax_D_earning = 7830.42 + + # as the leave is just on top of my existing earnings and if in 2024 fin year, just take tax at 37% for the extra leave amount + D_leave_after_tax = (D_leave_owed_in_days/bus_days_in_fortnight) * pre_tax_D_earning * (1-0.37) + + # However, if I quit in the next fin year - tax for 2025 will be: $4,288 plus 30c for each $1 over $45,000 + # (assuming the 7830.42 * ~90/bus_days_in_fortnight = ~ $64k - > 45k and < $135k bracket is 30%) + # Given, I probably can't stop Deakin doing PAYG deductions, I won't get + # the tax back until the end of the financial year, so work out the + # amount of tax I will get back info: tax_diff_D_leave + tax_on_leave = (pre_tax_D_earning * (D_leave_owed_in_days/bus_days_in_fortnight) - 45000)*.3 + 4288 + D_leave_after_tax_new_fin_year = pre_tax_D_earning * (D_leave_owed_in_days/bus_days_in_fortnight) - tax_on_leave + tax_diff_D_leave = D_leave_after_tax_new_fin_year-D_leave_after_tax + + ### leave / tax items finished ### + + # convenience vars to make it easier to read conditional leave tax/payment logic below + D_has_quit = False + claim_tax_on_leave = False + new_fin_year_25 = datetime(2025, 7, 1) + new_fin_year_26 = datetime(2026, 7, 1) # Constants for interest calculations annual_interest_rate = Interest_Rate / 100.0 daily_interest_rate = annual_interest_rate / 365 - # Time periods: start from now, and simulate till D is 65 (April 25) + # main loop range -- start from now, and simulate till D is 60 (April 2031) 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 # Fortnightly payment after salary ends + 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 - post_lease_car_costs = 800 + 2000 + ioniq6_rego = 800 + ioniq6_ins = 2200 + post_lease_car_costs = ioniq6_rego + ioniq6_ins # Start the calculation current_savings = Savings @@ -103,11 +129,24 @@ def calculate_savings_depletion(finance): D_Num_fortnights_pay -= 1 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 + if current_date > new_fin_year_25: + 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}" ) current_savings += D_leave_after_tax add_annotation(finance, current_date, current_savings, D_leave_after_tax, "D quit" ) D_leave_after_tax = 0 + # its end of 'next' fin year, if tax_diff > 0, then ddp quit after new tax year and gets back the overpaid tax + if current_date > new_fin_year_26 and claim_tax_on_leave: + current_savings += tax_diff_D_leave + add_annotation(finance, current_date, current_savings, tax_diff_D_leave, "D quit - tax back" ) + # can only claim the tax back once :) + claim_tax_on_leave=False + if fortnight_income: print(f"salary paid by Deakin: {current_date} adding: {fortnight_income}" ) current_savings += fortnight_income @@ -139,10 +178,13 @@ def calculate_savings_depletion(finance): current_savings -= Car_balloon add_annotation(finance, current_date, current_savings, -Car_balloon, "car balloon") - # Anniversary of Car balloon so pay insurance/rego - if current_date.year >= car_balloon_date.year and current_date.month == car_balloon_date.month and current_date.day == car_balloon_date.day: - current_savings -= post_lease_car_costs - add_annotation(finance, current_date, current_savings, -post_lease_car_costs, "IONIQ 6 ins/rego" ) + # 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" ) if current_date.date() == overseas_trip_date.date(): current_savings -= Overseas_trip @@ -166,10 +208,14 @@ def calculate_savings_depletion(finance): print( f"DRP {current_date} - adding {drp} CBA shares" ) D_CBA_shares += int( (2.25*D_CBA_shares/CBA_price) ) - if Sell_shares>0 and current_date.month == 7 and current_date.day == 1: + # if selling shares, and its 1st of July... + # BUT not if D quits so his leave payout comes in 2025 fin year, then don't sell shares at all as we will be over as already paying tax + if D_has_quit and Sell_shares>0 and current_date.month == 7 and current_date.day == 1: # 2024 Govt. value tax_threshold = 18200 + # cap-gains is 50% of profit (lazy profit calc here, just assume its all profit) can_sell = 2*tax_threshold + actual_sell = 0 # sell off TLS first - and they are way under the limit, so just sell them all in one hit if D_TLS_shares > 0: