aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral')
-rw-r--r--python/collateral/__main__.py2
-rw-r--r--python/collateral/cs.py19
2 files changed, 20 insertions, 1 deletions
diff --git a/python/collateral/__main__.py b/python/collateral/__main__.py
index f8781003..36d424ba 100644
--- a/python/collateral/__main__.py
+++ b/python/collateral/__main__.py
@@ -31,7 +31,7 @@ parser.add_argument(
"-s", "--send-email", action="store_true", help="send email to Globeop"
)
args = parser.parse_args()
-counterparties = ["citi", "baml_isda", "ms", "gs", "bnp", "baml_fcm", "wells"]
+counterparties = ["citi", "baml_isda", "ms", "gs", "bnp", "baml_fcm", "wells", "cs"]
if args.download:
for cp in counterparties:
cp_mod = import_module(f".{cp}", "collateral")
diff --git a/python/collateral/cs.py b/python/collateral/cs.py
new file mode 100644
index 00000000..b2d5c959
--- /dev/null
+++ b/python/collateral/cs.py
@@ -0,0 +1,19 @@
+import pandas as pd
+from . import DAILY_DIR
+
+
+def download_files(count=20):
+ from exchange import ExchangeMessage
+
+ em = ExchangeMessage()
+ emails = em.get_msgs(
+ path=["NYops", "Margin calls CS"], count=count, subject__contains="Margin"
+ )
+ DATA_DIR = DAILY_DIR / "CS_reports"
+ for msg in emails:
+ for attach in msg.attachments:
+ fname = attach.name
+ if fname.endswith("xlsx"):
+ p = DATA_DIR / fname
+ if not p.exists():
+ p.write_bytes(attach.content)