diff options
Diffstat (limited to 'python/report_ops/custodians.py')
| -rw-r--r-- | python/report_ops/custodians.py | 14 |
1 files changed, 11 insertions, 3 deletions
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") |
