aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/collateral/__main__.py9
-rw-r--r--python/collateral/jpm.py33
2 files changed, 30 insertions, 12 deletions
diff --git a/python/collateral/__main__.py b/python/collateral/__main__.py
index 86c1916f..85375107 100644
--- a/python/collateral/__main__.py
+++ b/python/collateral/__main__.py
@@ -60,7 +60,6 @@ cp_dict = {
"fcms": ("baml_fcm", "wells"),
"isda_cps": (
"baml_isda",
- "jpm",
"ms",
"gs",
"bnp",
@@ -72,7 +71,13 @@ cp_dict = {
"Brinker": {"fcms": (), "isda_cps": ("ms", "gs")},
"BowdSt": {
"fcms": ("gs_fcm",),
- "isda_cps": ("ms", "bnp", "gs", "baml_isda", "cs", "jpm"),
+ "isda_cps": (
+ "ms",
+ "bnp",
+ "gs",
+ "baml_isda",
+ "cs",
+ ),
},
"Selene": {
"fcms": ("baml_fcm",),
diff --git a/python/collateral/jpm.py b/python/collateral/jpm.py
index 5d2a5cf7..242030e2 100644
--- a/python/collateral/jpm.py
+++ b/python/collateral/jpm.py
@@ -84,17 +84,30 @@ def download_files(em, count=20, *, fund="BowdSt", **kwargs):
def collateral(d, dawn_trades, *, fund="BowdSt", **kwargs):
- pdf_file = load_file(d, fund)
- pages = load_pdf(pdf_file, pages=True)
try:
- collat = get_collateral(pages[3])
- except IndexError:
- collat = 0.0
- try:
- df = pd.concat([load_positions(pages[4]), load_positions(pages[5])])
- except StopIteration:
- # No TRS
- df = load_positions(pages[4])
+ df = pd.read_excel(
+ load_file(d, fund, ext="xls"),
+ sheet_name="Open Positions",
+ skiprows=14,
+ skipfooter=13,
+ )
+ breakpoint()
+ df["Deal ID"] = "810RI" + df["Deal ID"].str.extract(r"([^-]*)-.*")
+ collat = pd.read_excel(
+ load_file(d, fund, ext="xls"), sheet_name="Collateral Holdings"
+ ).iloc[-1][-1]
+ except StopIteration: # PDF method
+ pdf_file = load_file(d, fund)
+ pages = load_pdf(pdf_file, pages=True)
+ try:
+ collat = get_collateral(pages[3])
+ except IndexError:
+ collat = 0.0
+ try:
+ df = pd.concat([load_positions(pages[4]), load_positions(pages[5])])
+ except StopIteration:
+ # No TRS
+ df = load_positions(pages[4])
df = df.merge(dawn_trades, how="left", left_on="Deal ID", right_on="cpty_id")
missing_ids = df.loc[df.cpty_id.isnull(), "Deal ID"]
if not missing_ids.empty: