aboutsummaryrefslogtreecommitdiffstats
path: root/python/report_ops
diff options
context:
space:
mode:
Diffstat (limited to 'python/report_ops')
-rw-r--r--python/report_ops/__main__.py4
-rw-r--r--python/report_ops/custodians.py14
-rw-r--r--python/report_ops/misc.py1
3 files changed, 15 insertions, 4 deletions
diff --git a/python/report_ops/__main__.py b/python/report_ops/__main__.py
index 68708109..2f49169c 100644
--- a/python/report_ops/__main__.py
+++ b/python/report_ops/__main__.py
@@ -1,4 +1,5 @@
from serenitas.analytics.dates import prev_business_day
+from serenitas.utils.exchange import ExchangeMessage
from serenitas.utils.db import dbconn
import logging
import argparse
@@ -93,8 +94,9 @@ if args.wire_reports:
if args.send_to_custodians:
conn = dbconn("dawndb")
+ em = ExchangeMessage()
for account in ("UMB", "BBH"):
try:
- upload_to_custodian(account, args.date, conn, not args.no_upload)
+ upload_to_custodian(account, args.date, conn, not args.no_upload, em)
except ValueError as e:
logger.info(e)
diff --git a/python/report_ops/custodians.py b/python/report_ops/custodians.py
index dd0832c6..c9803e2a 100644
--- a/python/report_ops/custodians.py
+++ b/python/report_ops/custodians.py
@@ -1,8 +1,8 @@
-from serenitas.utils.exchange import ExchangeMessage
+from serenitas.utils.exchange import ExchangeMessage, FileAttachment
from serenitas.utils.env import DAILY_DIR
import warnings
import datetime
-from .misc import get_dir
+from .misc import get_dir, _recipients, _cc_recipients
import gpg
from serenitas.ops.trade_dataclasses import BondDeal
from serenitas.ops.funds import Service
@@ -17,7 +17,7 @@ _sql = (
_bond_query = "SELECT * FROM bond_trades WHERE id in %s;"
-def upload_to_custodian(account, trade_date, conn, upload):
+def upload_to_custodian(account, trade_date, conn, upload, em):
_fund = {"BBH": "BRINKER", "UMB": "UMB"}
custodian = Service[_fund[account]]
with conn.cursor() as c:
@@ -43,6 +43,14 @@ def upload_to_custodian(account, trade_date, conn, upload):
custodian.staging_queue.clear()
conn.commit()
if upload:
+ em.send_email(
+ f"{account}: Bond Positions Uploaded for {trade_date}",
+ "Hi, \nWe've just uploaded the positions via SFTP. File receipt attached to this email",
+ _recipients.get(account, _cc_recipients[_fund]),
+ cc_recipients=_cc_recipients[_fund],
+ reply_to=_cc_recipients[_fund],
+ attach=(FileAttachment(name=buf.name, content=buf.get_value()),),
+ )
custodian.upload(buf, dest.name, confirm=account != "UMB")
diff --git a/python/report_ops/misc.py b/python/report_ops/misc.py
index 6d435efe..af6d2dd4 100644
--- a/python/report_ops/misc.py
+++ b/python/report_ops/misc.py
@@ -19,6 +19,7 @@ _recipients = {
),
"BAML_FCM": ("footc_margin_csr_amrs@bofa.com",),
"NYOPS": ("nyops@lmcg.com",),
+ "UMB": ("lmcgcustody@umb.com",),
}
_sma_recipients = {