aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/parse_citi_pdf.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/python/parse_citi_pdf.py b/python/parse_citi_pdf.py
index c4cfa007..71bdc4c8 100644
--- a/python/parse_citi_pdf.py
+++ b/python/parse_citi_pdf.py
@@ -26,7 +26,7 @@ def parse_num(s):
def get_df(l, col1, col2, col3):
df = pd.DataFrame({"amount": get_col(l, *col2),
- "currency": get_col(l, *col3)},
+ "currency": get_col(l, *col3)},
index=get_col(l, *col1))
df.amount = df.amount.apply(parse_num)
df.index = df.index.str.lstrip()
@@ -44,10 +44,12 @@ def get_citi_collateral(d):
col3 = (370, 500, 500, 600)
variation_margin = get_df(l, col1, col2, col3)
-
- col1 = (650, 800, 70, 100)
- col2 = (650, 800, 100, 500)
- col3 = (650, 800, 500, 600)
+ anchor = next(c for c in l if c.text == "Non Regulatory Initial Margin")
+ top = int(anchor["top"]) + 10
+ bottom = top + 150
+ col1 = (top, bottom, 70, 100)
+ col2 = (top, bottom, 100, 500)
+ col3 = (top, bottom, 500, 600)
initial_margin = get_df(l, col1, col2, col3)
return variation_margin.loc["VM Total Collateral", "amount"] + \
initial_margin.loc["Non Reg IM Total Collateral", "amount"]