diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/lmcg_monitor.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/python/lmcg_monitor.py b/python/lmcg_monitor.py new file mode 100644 index 00000000..ea39ebb3 --- /dev/null +++ b/python/lmcg_monitor.py @@ -0,0 +1,33 @@ +import datetime +import argparse +from serenitas.analytics.dates import prev_business_day +from serenitas.utils.db import dbconn +from serenitas.utils.exchange import ExchangeMessage + + +def monitor_scotia(date, conn): + with conn.cursor() as c: + c.execute( + "SELECT 1 FROM cash_balances cb WHERE fund='ISOSEL' AND account_number = '476960681512' AND date=%s;" + ) + if not (_ := c.fetchone()): + em = ExchangeMessage() + em.send_email( + f"*Action Requested* Scotia Balance Missing {date}", + "Please enter missing cash balance to the blotter.", + to_recipients=("Nyops@lmcg.com",), + ) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "cob", + nargs="?", + type=datetime.date.fromisoformat, + default=prev_business_day(datetime.date.today()), + help="working date", + ) + args = parser.parse_args() + conn = dbconn("dawndb") + monitor_scotia(args.cob, conn) |
