only sell shares in the first year if its not in the same financial year, also show original buffer in comparing note
This commit is contained in:
1
README
1
README
@@ -10,7 +10,6 @@ CONSIDER in real-world:
|
|||||||
while the balance is > $250k it offsets individual bank risk
|
while the balance is > $250k it offsets individual bank risk
|
||||||
* maybe buying shares in something like berkshire-hathaway, or vanguard ETFs?
|
* maybe buying shares in something like berkshire-hathaway, or vanguard ETFs?
|
||||||
|
|
||||||
|
|
||||||
To run the code:
|
To run the code:
|
||||||
|
|
||||||
cd ~/src/finplan
|
cd ~/src/finplan
|
||||||
|
|||||||
7
calc.py
7
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
|
# convenience vars to make it easier to read conditional leave tax/payment logic below
|
||||||
D_has_quit = False
|
D_has_quit = False
|
||||||
|
D_quit_year = 0
|
||||||
claim_tax_on_leave = False
|
claim_tax_on_leave = False
|
||||||
new_fin_year_25 = datetime(2025, 7, 1)
|
new_fin_year_25 = datetime(2025, 7, 1)
|
||||||
new_fin_year_26 = datetime(2026, 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:
|
if D_Num_fortnights_pay == 0 and D_leave_after_tax > 0:
|
||||||
D_has_quit = True
|
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
|
# 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:
|
if current_date > new_fin_year_25:
|
||||||
claim_tax_on_leave = True
|
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) )
|
D_CBA_shares += int( (2.25*D_CBA_shares/CBA_price) )
|
||||||
|
|
||||||
# if selling shares, and its 1st of July...
|
# 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
|
# BUT not if D quits before end of financial year - as I won't be able to sell CBA shares for no cap gains
|
||||||
if D_has_quit and Sell_shares>0 and current_date.month == 7 and current_date.day == 1:
|
# 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
|
# 2024 Govt. value
|
||||||
tax_threshold = 18200
|
tax_threshold = 18200
|
||||||
# cap-gains is 50% of profit (lazy profit calc here, just assume its all profit)
|
# cap-gains is 50% of profit (lazy profit calc here, just assume its all profit)
|
||||||
|
|||||||
3
db.py
3
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,
|
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)
|
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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
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.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
@@ -200,6 +200,7 @@ def get_comp_set_data(cset_id):
|
|||||||
if not res:
|
if not res:
|
||||||
return None
|
return None
|
||||||
COMP['vars']= dict(res)
|
COMP['vars']= dict(res)
|
||||||
|
COMP['buffer'] = COMP['vars']['CBA']*COMP['vars']['CBA_price']+COMP['vars']['TLS']*COMP['vars']['TLS_price']
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
# open new connection so we get rows back as basic array
|
# open new connection so we get rows back as basic array
|
||||||
|
|||||||
@@ -141,7 +141,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
{% if COMP %}
|
{% if COMP %}
|
||||||
<div style="display:none" id="comp_alert" class="alert alert-info mt-2">Note: {{ '$%0.2f' % COMP['amount']|float }} is the final value of the compared to data. Hover over blue labels above to see what compared to values differed</div>
|
<div style="display:none" id="comp_alert" class="alert alert-info mt-2">Note: {{ '$%0.2f' % COMP['amount']|float }} is the final value of the compared to data (with a buffer of: {{ '$%0.2f' % COMP['buffer']|float }}). Hover over blue labels above to see what compared to values differed</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user