aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral/cs.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral/cs.py')
-rw-r--r--python/collateral/cs.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/python/collateral/cs.py b/python/collateral/cs.py
index 47eb62e2..67d827b8 100644
--- a/python/collateral/cs.py
+++ b/python/collateral/cs.py
@@ -50,13 +50,20 @@ def get_collateral(d):
DATA_DIR = DAILY_DIR / "CS_reports"
# get most recent file before current date
pdf_file = DATA_DIR / f"CollateralCptyStatement161SerenitasCGMFRVM_{d:%m%d%Y}.pdf"
-
- g = iter(load_pdf(pdf_file))
- for e in g:
- if e.text == "Cash USD (US Dollar)":
- next(g)
- value = next(g).text
- return float(value.strip().replace(",", ""))
+ collat = 0
+ for collat_type in ("RVM", "IM"):
+ pdf_file = (
+ DATA_DIR
+ / f"CollateralCptyStatement161SerenitasCGMF{collat_type}_{d:%m%d%Y}.pdf"
+ )
+ g = iter(load_pdf(pdf_file))
+ for e in g:
+ if e.text == "Cash USD (US Dollar)":
+ next(g)
+ value = next(g).text
+ collat += float(value.strip().replace(",", ""))
+ break
+ return collat
def collateral(d, dawn_trades, *args):