diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/collateral/jpm.py | 5 | ||||
| -rw-r--r-- | python/external_deriv_marks.py | 27 |
2 files changed, 20 insertions, 12 deletions
diff --git a/python/collateral/jpm.py b/python/collateral/jpm.py index 2e991f5c..9e0eb818 100644 --- a/python/collateral/jpm.py +++ b/python/collateral/jpm.py @@ -31,7 +31,6 @@ def get_collateral(collat_page): def load_positions(positions_page): anchor = next(c for c in positions_page if c.text.startswith("Total Product Group")) bottom = int(anchor["top"]) - 30 - print(bottom) widths = (10, 160, 300, 350, 450, 500, 550, 600, 650, 750, 850, 950, 1000, 1200) cols = [ get_col(positions_page, 200, bottom, l, r) for l, r in zip(widths, widths[1:]) @@ -47,7 +46,6 @@ def load_positions(positions_page): for col in ["Trade Date", "Maturity Date"]: df[col] = pd.to_datetime(df[col], format="%d-%b-%y") df["Deal ID"] = "810RI" + df["Deal ID"].str.extract(r"([^-]*)-.*") - df[["IM Amount"]] *= -1.0 return df @@ -81,11 +79,10 @@ def collateral(d, dawn_trades, *, fund="BowdSt", **kwargs): df["Currency"] = "USD" df = df.reset_index() df.columns = ["Strategy", "Amount", "Currency"] - df.Amount *= -1 df = df.append( { "Strategy": "M_CSH_CASH", - "Amount": collat - df.Amount.sum(), + "Amount": -collat - df.Amount.sum(), "Currency": "USD", }, ignore_index=True, diff --git a/python/external_deriv_marks.py b/python/external_deriv_marks.py index 45927ff2..acb15109 100644 --- a/python/external_deriv_marks.py +++ b/python/external_deriv_marks.py @@ -122,7 +122,14 @@ def baml_navs(date: datetime.date = None, fund: str = "Serenitas"): df = load_excel(fname) df = df.set_index(["Market Value Date", "Trade ID"]) df = df[ - ["Trade Date", "Buy/Sell", "Notional 1", "local_nav", "base_nav", "ia",] + [ + "Trade Date", + "Buy/Sell", + "Notional 1", + "local_nav", + "base_nav", + "ia", + ] ] df.columns = COLUMNS dfs.append(df) @@ -254,14 +261,18 @@ def jpm_navs(date: datetime.date = None, fund: str = "BowdSt"): pages = load_pdf(fname, pages=True) df = load_positions(pages[4]) df = df[ - ["Deal ID", - "Trade Date", - "Long/ Short", - "Pay Notional", - "MTM Amount", - "MTM Amount", - "IM Amount"]] + [ + "Deal ID", + "Trade Date", + "Long/ Short", + "Pay Notional", + "MTM Amount", + "MTM Amount", + "IM Amount", + ] + ] df = df.set_index("Deal ID") + df["IM Amount"] *= -1.0 df.columns = COLUMNS date = datetime.datetime.strptime(fname.stem.split("-")[2], "%y%m%d").date() d[date] = df |
