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.py19
1 files changed, 19 insertions, 0 deletions
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)