aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral')
-rw-r--r--python/collateral/gs.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/python/collateral/gs.py b/python/collateral/gs.py
index a57b4e5d..b4889677 100644
--- a/python/collateral/gs.py
+++ b/python/collateral/gs.py
@@ -1,6 +1,9 @@
+import logging
import pandas as pd
from . import DAILY_DIR
+logger = logging.getLogger(__name__)
+
paths = {
"Serenitas": ["NYops", "Margin calls"],
"Brinker": ["NYops", "Margin Calls GS-Brinker"],
@@ -37,17 +40,16 @@ def collateral(d, dawn_trades, *, fund="Serenitas", **kwargs):
collateral = df.Quantity.sum()
df = load_file(d, fund, "Trade_Detail")
df = df.dropna(subset=["GS Entity"])
- df = df[df["Notional (USD)"] != 0.0]
df = df[["Trade Id", "Transaction Type", "NPV (USD)", "Initial Margin Required"]]
df = df.merge(dawn_trades, how="left", left_on="Trade Id", right_on="cpty_id")
missing_ids = df.loc[df.cpty_id.isnull(), "Trade Id"]
missing_ids = missing_ids[~missing_ids.str.startswith("FX")]
if not missing_ids.empty:
- raise ValueError(f"{missing_ids.tolist()} not in the database")
+ logger.error(f"{missing_ids.tolist()} not in the database")
# we allocate all the FX collateral to tranches
df.loc[df["Transaction Type"] == "FX", "folder"] = "TCSH"
df = df[["folder", "NPV (USD)", "Initial Margin Required"]]
- df = df.groupby("folder").sum()
+ df = df.groupby("folder", dropna=False).sum()
df = df.sum(axis=1).to_frame(name="Amount")
df["Currency"] = "USD"
df = df.reset_index()