diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/collateral/bnp.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/collateral/bnp.py b/python/collateral/bnp.py index 634e443b..51067014 100644 --- a/python/collateral/bnp.py +++ b/python/collateral/bnp.py @@ -30,7 +30,11 @@ def load_file(d: datetime.date, report_type: str): def collateral(d: datetime.date, dawn_trades: pd.DataFrame, *args): df = load_file(d, "Collateral Positions") - collateral = float(df["Mkt Val (Agmt Ccy)"]) + if df.at[0, "Held/Posted"] == "Posted": + sign = 1.0 + else: + sign = -1.0 + collateral = sign * df.at[0, "Mkt Val (Agmt Ccy)"] df = load_file(d, "Exposure Statement") df = df[["Trade Ref", "Exposure Amount (Agmt Ccy)", "Lock Up (Agmt Ccy)"]] df["Trade Ref"] = df["Trade Ref"].str.replace("MBO-", "") @@ -48,7 +52,7 @@ def collateral(d: datetime.date, dawn_trades: pd.DataFrame, *args): df = df.append( { "Strategy": "M_CSH_CASH", - "Amount": -collateral - df.Amount.sum(), + "Amount": collateral - df.Amount.sum(), "Currency": "USD", }, ignore_index=True, |
