Compare commits

...

3 Commits

2 changed files with 7 additions and 3 deletions

View File

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

4
db.py
View File

@@ -100,6 +100,7 @@ def init_db():
ann_growth_avg REAL, ann_growth_avg REAL,
ann_growth_max REAL, ann_growth_max REAL,
ann_growth_simple REAL, ann_growth_simple REAL,
which_growth STRING,
FOREIGN KEY(freq) REFERENCES bill_freq(id) FOREIGN KEY(freq) REFERENCES bill_freq(id)
)''') )''')
@@ -379,7 +380,7 @@ def insert_bill_type( bt, fq ):
conn = connect_db(False) conn = connect_db(False)
cur = conn.cursor() cur = conn.cursor()
print( f"fq={fq}" ) print( f"fq={fq}" )
cur.execute( f"insert into bill_type ( 'name', 'freq', 'ann_growth_min', 'ann_growth_avg', 'ann_growth_max', 'ann_growth_simple' ) values ( '{bt}', {fq}, 0, 0, 0, 0 )" ) cur.execute( f"insert into bill_type ( name, freq, ann_growth_min, ann_growth_avg, ann_growth_max, ann_growth_simple, which_growth ) values ( '{bt}', {fq}, 0, 0, 0, 0, 'cpi' )" )
conn.commit() conn.commit()
conn.close() conn.close()
return return
@@ -403,6 +404,7 @@ def delete_bill(id):
def delete_bill_type( id ): def delete_bill_type( id ):
conn = connect_db(False) conn = connect_db(False)
cur = conn.cursor() cur = conn.cursor()
cur.execute( f"delete from bill_data where bill_type = '{id}'" )
cur.execute( f"delete from bill_type where id = '{id}'" ) cur.execute( f"delete from bill_type where id = '{id}'" )
conn.commit() conn.commit()
conn.close() conn.close()