aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral/baml_isda.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral/baml_isda.py')
-rw-r--r--python/collateral/baml_isda.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/python/collateral/baml_isda.py b/python/collateral/baml_isda.py
index 4df80c68..619ce309 100644
--- a/python/collateral/baml_isda.py
+++ b/python/collateral/baml_isda.py
@@ -139,18 +139,24 @@ def load_excel(fname):
def collateral(d, dawn_trades, *args):
+ report_date = d + BDay()
REPORTS_DIR = DAILY_DIR / "BAML_ISDA_reports"
try:
- fname = next(REPORTS_DIR.glob(f"Collat_*{d:%m%d%Y}_*.xls"))
+ fname = next(REPORTS_DIR.glob(f"Collat_*{report_date:%m%d%Y}_*.xls"))
except StopIteration:
- raise ValueError(f"no data for date {d}")
+ raise ValueError(f"no collateral data for date {report_date}")
df = pd.read_excel(fname, skiprows=6, skipfooter=6)
df = df.drop(0, axis=0)
try:
collateral = float(df.Notional)
except TypeError:
collateral = df.Notional.sum()
- fname = next(REPORTS_DIR.glob(f"301__LMCG_INVESTMENTSLP_CSA_{d:%m%d%Y}_*"))
+ try:
+ fname = next(
+ REPORTS_DIR.glob(f"301__LMCG_INVESTMENTSLP_CSA_{report_date:%m%d%Y}_*")
+ )
+ except StopIteration:
+ raise ValueError(f"no trade-level data for date {report_date}")
df = load_excel(fname)
df = df[["Trade ID", "MTM(USD)"]]
df = df.merge(dawn_trades, how="left", left_on="Trade ID", right_on="cpty_id")