diff options
Diffstat (limited to 'python/umb_monitor.py')
| -rw-r--r-- | python/umb_monitor.py | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/python/umb_monitor.py b/python/umb_monitor.py deleted file mode 100644 index 305b78f3..00000000 --- a/python/umb_monitor.py +++ /dev/null @@ -1,73 +0,0 @@ -import datetime -from exchangelib import HTMLBody - -from serenitas.utils.db import dbconn - -from report_ops.utils import Monitor - - -class UmbEurMonitor( - Monitor, - headers=( - "settle_date", - "account", - "counterparty", - "asset_class", - "currency", - "receive_amount", - ), - num_format=[("{0:,.2f}", 5)], -): - @classmethod - def email(cls): - if not cls._staging_queue: - return - cls._em.send_email( - "*Euro Settlements Today* 159260.2", - HTMLBody( - f""" -<html> - <head> - <style> - table, th, td {{ border: 1px solid black; border-collapse: collapse;}} - th, td {{ padding: 5px; }} - </style> - </head> - <body> - Good morning,<br><br>We are expecting the following Euro wires to settle today. Could you revert back once you've received these wires<br><br>{cls.to_tabulate()} - </body> -</html>""" - ), - to_recipients=("lmcgcustody@umb.com",), - cc_recipients=("nyops@lmcg.com",), - ) - - -def check_eur_settlements(date, fund, conn): - with conn.cursor() as c: - c.execute( - "SELECT settle_date, name as counterparty, asset_class, currency, payment_amount as receive_amount FROM payment_settlements ps WHERE settle_date =%s AND fund=%s AND account IN ('UMB Fund Services', 'OTC') AND payment_amount > 0 AND currency='EUR';", - (date, fund), - ) - for row in c: - d = row._asdict() | {"account": "159260.2"} - UmbEurMonitor.stage(d) - UmbEurMonitor.email() - UmbEurMonitor.clear() - - -if __name__ == "__main__": - import argparse - - parser = argparse.ArgumentParser() - parser.add_argument( - "cob", - nargs="?", - type=datetime.date.fromisoformat, - default=datetime.date.today(), - help="working date", - ) - args = parser.parse_args() - conn = dbconn("dawndb") - - check_eur_settlements(args.cob, "SERCGMAST", conn) |
