aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral/ms.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral/ms.py')
-rw-r--r--python/collateral/ms.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/python/collateral/ms.py b/python/collateral/ms.py
index dba13c67..1c4c11eb 100644
--- a/python/collateral/ms.py
+++ b/python/collateral/ms.py
@@ -48,9 +48,9 @@ def download_files(em, count=20, *, fund="Serenitas", **kwargs):
p.write_bytes(attach.content)
-def collateral(d, dawn_trades, *, fund="Serenitas", **kwargs):
+def get_total_collateral(date, fund):
df = pd.read_excel(
- DAILY_DIR / fund / "MS_reports" / f"Collateral_Detail_{d:%Y%m%d}.xls"
+ DAILY_DIR / fund / "MS_reports" / f"Collateral_Detail_{date:%Y%m%d}.xls"
)
collat = df.loc[1, "coll_val_ccy"].replace(",", "")
if "(" in collat:
@@ -58,6 +58,11 @@ def collateral(d, dawn_trades, *, fund="Serenitas", **kwargs):
collat = -float(collat)
else:
collat = float(collat)
+ return collat
+
+
+def collateral(d, dawn_trades, *, fund="Serenitas", **kwargs):
+ collat = get_total_collateral(d, fund)
df = pd.read_excel(DAILY_DIR / fund / "MS_reports" / f"Trade_Detail_{d:%Y%m%d}.xls")
try:
df_fx = pd.read_excel(