diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/collateral/baml_isda.py | 10 | ||||
| -rw-r--r-- | python/collateral/gs.py | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/python/collateral/baml_isda.py b/python/collateral/baml_isda.py index b53cdaa6..ba42ec81 100644 --- a/python/collateral/baml_isda.py +++ b/python/collateral/baml_isda.py @@ -63,7 +63,10 @@ def download_files(d=None, count=20): em = ExchangeMessage() emails = em.get_msgs(path=["NYops", "Margin Calls Baml"], count=count) for msg in emails: - if msg.sender.name == "us_otc_client_valuation@baml.com": + if ( + msg.sender.name == "us_otc_client_valuation@baml.com" + or msg.sender.name == "us_otc_client_valuation@bofa.com" + ): soup = BeautifulSoup(msg.body, features="lxml") a = soup.find("a") url = urlsplit(a["href"]) @@ -113,7 +116,10 @@ def collateral(d, dawn_trades, *args): raise ValueError("no data for date {d}") df = pd.read_excel(fname, skiprows=6, skipfooter=6) df = df.drop(0, axis=0) - collateral = float(df.Notional) + try: + collateral = float(df.Notional) + except TypeError: + collateral = df.Notional.sum() d -= BDay() fname = REPORTS_DIR / f"Interest Rates Trade Summary_{d:%d-%b-%Y}.xls" # TODO: make more robust diff --git a/python/collateral/gs.py b/python/collateral/gs.py index a011259f..bfb4f7f7 100644 --- a/python/collateral/gs.py +++ b/python/collateral/gs.py @@ -30,7 +30,10 @@ def load_file(d, pattern): def collateral(d, dawn_trades, *args): df = load_file(d, "Collateral_Detail") df = df.dropna(subset=["Quantity"]) - collateral = float(df.Quantity) + try: + collateral = float(df.Quantity) + except TypeError: + collateral = df.Quantity.sum() df = load_file(d, "Trade_Detail") df = df.dropna(subset=["GS Entity"]) df = df[["Trade Id", "Transaction Type", "NPV (USD)", "Initial Margin Required"]] |
