Major change: I have added finance_history

* pulled old values of data via restic backups
    * inserted them into a new finance_history table
    * added a finplan user, use of sudo & better ENV (container/production) & wrapper.sh into Dockerfile (like I do for other projects)
    * recalculate the bills / Living Expenses now we have real bills for a year
    * remove tax back for now (need to handle quit date vs. end of financial year better)
    * hard-coded / hacked in 2026 for pay cycle dates / should be dynamic, but not sure I'll work in 2027+
    * refactor front-end to handle 2026 as the current year / its more or less dynamic (via hard-coded FIRST_YEAR) variable - could not use datetime, as it was in late Dec. when I noticed the issue ('next pay' was in 2026, current year was 2025)
    * also added history to graphs, changed formatting to make the history /
    * savings projections to be orannge with circles, but historical is a solid line, future is a dash, also made all lines have lineWidth: 1 for aesthetics
This commit is contained in:
2026-01-17 19:28:24 +11:00
parent 2517f8e9b9
commit e05b2c7b5b
9 changed files with 123 additions and 37 deletions

12
calc.py
View File

@@ -6,7 +6,7 @@ from defines import END_YEAR
LEASE = 0
# Dates that don't change
first_pay_date = datetime(2025,1,8)
first_pay_date = datetime(2026,1,8)
school_fees_date = datetime(2025, 12, 5)
car_balloon_date = datetime(2026, 11, 15)
mich_present_date = datetime(2026,10,15)
@@ -82,7 +82,7 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
payout = 83115.84
print( f"leave payout gross={payout}" )
# However, if I quit in the next fin year - tax for 2025 will be: $4,288 plus 30c for each $1 over $45,000
# However, if I quit in the next fin year - tax 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
@@ -95,6 +95,9 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
tax_diff_D_leave = payout - D_leave_after_tax
### FIXME: for now, assume no tax back after leave - think this may be needed if I quit anytime nowish until end of Jun
tax_diff_D_leave = 0
print( f"tax_diff_D_leave: {tax_diff_D_leave}")
### leave / tax items finished ###
@@ -116,6 +119,7 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
yr=str(current_date.year)
for b in bill_data:
if yr in b['bill_date']:
print( f"Seems {yr} is in {b['bill_date']} -- add {b['amount']}" )
total += b['amount']
print( f"this yr={current_date.year} - total={total}" )
@@ -138,7 +142,7 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
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
days_count = ( current_date - datetime(2026,1,1) ).days
# Track the fortnight, and monthly interest
fortnight_income = 0
@@ -219,7 +223,7 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
# 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"{current_date}: Living Exp inceased - ${Living_Expenses}")
print(f"{current_date}: Living Exp inceased - ${Living_Expenses}")
if current_date.date() == school_fees_date.date():
current_savings -= School_Fees