aboutsummaryrefslogtreecommitdiffstats
path: root/python/monthly_interest.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/monthly_interest.py')
-rw-r--r--python/monthly_interest.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/python/monthly_interest.py b/python/monthly_interest.py
index e48e84c9..aadc36f1 100644
--- a/python/monthly_interest.py
+++ b/python/monthly_interest.py
@@ -106,7 +106,7 @@ def get_MS(path):
return -round(df["LOCAL_ACCRUAL"].sum(), 2)
-def get_interest():
+def get_interest(delete=False):
interest_amounts = defaultdict(float)
counterparties = ["BNP", "CITI", "CS", "GS", "MS"]
for cp in counterparties:
@@ -127,10 +127,13 @@ def get_interest():
g = iter(load_pdf(file))
amount = func(g)
interest_amounts[cp] = interest_amounts[cp] + amount
- # try:
- # shutil.rmtree(f'/home/serenitas/Daily/Serenitas/MonthlyInterest/{cp}_reports')
- # except FileNotFoundError:
- # pass
+ if delete:
+ try:
+ shutil.rmtree(
+ f"/home/serenitas/Daily/Serenitas/MonthlyInterest/{cp}_reports"
+ )
+ except FileNotFoundError:
+ pass
return pd.DataFrame(interest_amounts, index=[0]).T
@@ -150,4 +153,4 @@ for cp in counterparties:
download_messages(em, cp, args.start, args.end)
if args.auto:
- df = get_interest()
+ df = get_interest(delete=args.auto)