aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/collateral/baml_fcm.py11
-rw-r--r--python/collateral/wells.py11
2 files changed, 12 insertions, 10 deletions
diff --git a/python/collateral/baml_fcm.py b/python/collateral/baml_fcm.py
index fa3e120e..8a175a51 100644
--- a/python/collateral/baml_fcm.py
+++ b/python/collateral/baml_fcm.py
@@ -51,7 +51,7 @@ def collateral(d, positions, engine):
df = df[df.groupby(["security_id", "maturity"])["NOTIONAL"].sum() != 0.0]
compare_notionals(df, positions, "BAML")
positions["dirtyupfront"] = df.reindex(positions.index)["DIRTYUPFRONT"]
- positions["amount"] = positions["notional"] * positions["dirtyupfront"]
+ positions["Amount"] = positions["notional"] * positions["dirtyupfront"]
positions.folder = positions.folder.replace(
{
"HEDGE_MBS": "MBSCDSCSH",
@@ -61,6 +61,7 @@ def collateral(d, positions, engine):
"IGOPTDEL": "COCSH",
"IGINX": "TCSH",
"HYINX": "TCSH",
+ "XOINX": "TCSH",
}
)
@@ -72,11 +73,11 @@ def collateral(d, positions, engine):
positions.folder = positions.apply(aux, axis=1)
df = (
- positions.groupby("folder")
- .agg({"amount": "sum", "currency": "first"})
- .reset_index("folder")
+ positions.groupby(["folder", "currency"])
+ .agg({"Amount": "sum"})
+ .reset_index(["folder", "currency"])
)
- df.columns = ["Strategy", "Amount", "Currency"]
+ df = df.rename(columns={"folder": "Strategy", "currency": "Currency"})
df_margin = pd.read_csv(
DAILY_DIR / "BAML_reports" / f"OTC_Moneyline_{d:%Y%m%d}.CSV",
usecols=["Statement Date", "AT CCY", "Initial Margin Requirement"],
diff --git a/python/collateral/wells.py b/python/collateral/wells.py
index 8ae1f532..3603bbe9 100644
--- a/python/collateral/wells.py
+++ b/python/collateral/wells.py
@@ -101,7 +101,7 @@ def collateral(d, positions, engine):
df.index.names = ["security_id", "maturity"]
compare_notionals(df, positions, "Wells")
positions = positions.join(df, how="left")
- positions["amount"] = positions["notional"] * positions["DIRTYUPFRONT"]
+ positions["Amount"] = positions["notional"] * positions["DIRTYUPFRONT"]
positions.folder = positions.folder.replace(
{
"HEDGE_MBS": "MBSCDSCSH",
@@ -111,6 +111,7 @@ def collateral(d, positions, engine):
"IGOPTDEL": "COCSH",
"IGINX": "TCSH",
"HYINX": "TCSH",
+ "XOINX": "TCSH",
}
)
@@ -123,11 +124,11 @@ def collateral(d, positions, engine):
positions.folder = positions.apply(aux, axis=1)
df = (
- positions.groupby("folder")
- .agg({"amount": "sum", "currency": "first"})
- .reset_index("folder")
+ positions.groupby(["folder", "currency"])
+ .agg({"Amount": "sum"})
+ .reset_index(["folder", "currency"])
)
- df.columns = ["Strategy", "Amount", "Currency"]
+ df = df.rename(columns={"folder": "Strategy", "currency": "Currency"})
df_margin = pd.read_csv(
DAILY_DIR
/ "Wells_reports"