diff --git a/README b/README index 03883f6..ad13cd0 100644 --- a/README +++ b/README @@ -10,7 +10,6 @@ CONSIDER in real-world: while the balance is > $250k it offsets individual bank risk * maybe buying shares in something like berkshire-hathaway, or vanguard ETFs? - To run the code: cd ~/src/finplan diff --git a/calc.py b/calc.py index b64654f..edc4b59 100644 --- a/calc.py +++ b/calc.py @@ -65,6 +65,7 @@ def calculate_savings_depletion(finance): # convenience vars to make it easier to read conditional leave tax/payment logic below D_has_quit = False + D_quit_year = 0 claim_tax_on_leave = False new_fin_year_25 = datetime(2025, 7, 1) new_fin_year_26 = datetime(2026, 7, 1) @@ -134,6 +135,7 @@ def calculate_savings_depletion(finance): if D_Num_fortnights_pay == 0 and D_leave_after_tax > 0: D_has_quit = True + D_quit_year = current_date.year # 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 @@ -227,8 +229,9 @@ def calculate_savings_depletion(finance): D_CBA_shares += int( (2.25*D_CBA_shares/CBA_price) ) # 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: + # BUT not if D quits before end of financial year - as I won't be able to sell CBA shares for no cap gains + # so wait until the following year + if current_date.month == 7 and current_date.day == 1 and D_has_quit and Sell_shares>0 and (current_date.year > D_quit_year or current_date.year == D_quit_year and claim_tax_on_leave == False): # 2024 Govt. value tax_threshold = 18200 # cap-gains is 50% of profit (lazy profit calc here, just assume its all profit) diff --git a/db.py b/db.py index b45156c..185f55f 100644 --- a/db.py +++ b/db.py @@ -96,7 +96,7 @@ def init_db(): cur.execute('''INSERT INTO finance (D_Salary, D_Num_fortnights_pay, School_Fees, Car_loan_via_pay, Car_loan, Car_balloon, Car_buyout, Living_Expenses, Savings, Interest_Rate, Inflation, Mich_present, Overseas_trip, Mark_reno, D_leave_owed_in_days, D_TLS_shares, M_TLS_shares, D_CBA_shares, TLS_price, CBA_price, Overseas_trip_date, Mark_reno_date, Car_buyout_date, Sell_shares, compare_to, Ioniq6_future) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''', - (4762.29, 10, 22000, 620, 2412, 45824.68, 83738.74, 84000, 421271.5, 5.0, 3.0, 10000, 30000, 10000, 94.66, 1000, 750, 1095, 3.9, 158.9, '2025-06-01', '2025-09-01', '2025-02-20', 5, 0, 0)) + (4762.29, 8, 22000, 620, 2412, 45824.68, 83738.74, 84000, 427318.76, 4.75, 3.2, 10000, 30000, 10000, 94.66, 1000, 750, 1095, 4.12, 142.77, '2025-06-01', '2025-09-01', '2025-02-20', 5, 0, 0)) conn.commit() conn.close() @@ -200,6 +200,7 @@ def get_comp_set_data(cset_id): if not res: return None COMP['vars']= dict(res) + COMP['buffer'] = COMP['vars']['CBA']*COMP['vars']['CBA_price']+COMP['vars']['TLS']*COMP['vars']['TLS_price'] conn.close() # open new connection so we get rows back as basic array diff --git a/templates/index.html b/templates/index.html index b54a934..01e981d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -141,7 +141,7 @@ {% if COMP %} - + {% endif %}