diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/baml_fcm_fx.py | 22 | ||||
| -rw-r--r-- | python/citco_ops/utils.py | 16 |
2 files changed, 38 insertions, 0 deletions
diff --git a/python/baml_fcm_fx.py b/python/baml_fcm_fx.py new file mode 100644 index 00000000..2ba8fef0 --- /dev/null +++ b/python/baml_fcm_fx.py @@ -0,0 +1,22 @@ +import datetime +from serenitas.utils.db import dawn_engine +from citco_ops.utils import BamlFcmNotify +import pandas as pd +from exchangelib import HTMLBody + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument( + "date", + nargs="?", + type=datetime.date.fromisoformat, + default=datetime.date.today(), + help="working date", + ) + args = parser.parse_args() + sql_str = "SELECT trade_date, near_rate, near_settle_date, near_buy_currency, near_buy_amount, near_sell_currency, near_sell_amount FROM fx_swaps fs2 WHERE cash_account ='V0NSCLMSPT' AND trade_date = %s;" + df = pd.read_sql_query(sql_str, con=dawn_engine, params=(args.date,)) + if not df.empty: + BamlFcmNotify.email_fcm(args.date, HTMLBody(df.to_html(index=False))) diff --git a/python/citco_ops/utils.py b/python/citco_ops/utils.py index ebe33abd..eaf7b5ae 100644 --- a/python/citco_ops/utils.py +++ b/python/citco_ops/utils.py @@ -6,6 +6,7 @@ import csv from serenitas.ops.trade_dataclasses import Deal from serenitas.utils.exchange import ExchangeMessage from psycopg.errors import UniqueViolation +from exchangelib import HTMLBody logger = logging.getLogger(__name__) @@ -135,6 +136,7 @@ _recipients = { "SERENITAS.FA@sscinc.com", "SERENITAS.ops@sscinc.com", ), + "BAML_FCM": ("fyu@lmcg.com",), } @@ -190,3 +192,17 @@ class GFSMonitor(Payment): "Bowdoin-Ops@LMCG.com" if fund == "BOWDST" else "NYOps@lmcg.com", ), ) + + +class BamlFcmNotify: + @classmethod + def email_fcm(cls, date, data): + em = ExchangeMessage() + em.send_email( + f"FX Details: 6MZ20049 {date}", + HTMLBody( + f"Hello,<br><br>Please see below details for an FX Spot Trade we did with the desk today for account 6MZ20049. Please let me know if you need more information<br><br>{data}" + ), + to_recipients=_recipients["BAML_FCM"], + cc_recipients=("nyops@lmcg.com",), + ) |
