fixed bug where we sell $0 of shares each year once we run out of shares

This commit is contained in:
2026-03-05 16:58:57 +11:00
parent d8bef8bbe7
commit e123fdaf49
2 changed files with 4 additions and 4 deletions

2
BUGS
View File

@@ -1,5 +1,3 @@
* if run out of shares, we still sell "$0" of them (annotation)
* cannot remove bill type (Kayo) - OR (TODO): modify it to yearly from monthly
* can put in dumb dates - DO SOME INPUT VALIDATION, *sigh*

View File

@@ -285,8 +285,10 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
D_CBA_shares -= 1
Sell_shares -= 1
current_savings += actual_sell
add_annotation(finance, current_date, current_savings, actual_sell, "Sell shares" )
# can run out, if so, no need to add :)
if actual_sell>0:
current_savings += actual_sell
add_annotation(finance, current_date, current_savings, actual_sell, "Sell shares" )
current_date += timedelta(days=1)