aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/collateral/citi.py5
-rw-r--r--python/collateral/common.py7
2 files changed, 9 insertions, 3 deletions
diff --git a/python/collateral/citi.py b/python/collateral/citi.py
index ce4356af..00722b4c 100644
--- a/python/collateral/citi.py
+++ b/python/collateral/citi.py
@@ -1,7 +1,6 @@
import pandas as pd
-from pandas.tseries.offsets import BDay
from . import DAILY_DIR
-from .common import load_pdf, get_col
+from .common import load_pdf, get_col, next_business_day
def load_file(d):
@@ -76,7 +75,7 @@ def get_total_collateral(d):
def collateral(d, dawn_trades, **kwargs):
- df = load_file(d + BDay())
+ df = load_file(next_business_day(d))
collat = get_total_collateral(d)
df = df[["Operations File", "Market Value", "BasicAmt"]].dropna(
subset=["Operations File"]
diff --git a/python/collateral/common.py b/python/collateral/common.py
index 3db7349e..be08a25a 100644
--- a/python/collateral/common.py
+++ b/python/collateral/common.py
@@ -140,3 +140,10 @@ def prev_business_day(d: datetime.date):
return d - datetime.timedelta(days=3)
else:
return d - datetime.timedelta(days=1)
+
+
+def next_business_day(d: datetime.date):
+ if (offset := 7 - d.weekday()) > 3:
+ return d + datetime.timedelta(days=1)
+ else:
+ return d + datetime.timedelta(days=offset)