diff options
Diffstat (limited to 'python/report_ops/utils.py')
| -rw-r--r-- | python/report_ops/utils.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/python/report_ops/utils.py b/python/report_ops/utils.py index 3b47a50f..035b2e13 100644 --- a/python/report_ops/utils.py +++ b/python/report_ops/utils.py @@ -102,7 +102,7 @@ def check_cleared_cds(date, fund, conn): _tolerance = {"IG": 0.10, "HY": 0.20, "EU": 0.20, "XO": 0.30} with conn.cursor() as c: c.execute( - "SELECT *, abs(price-globeop_price) AS difference FROM list_cds_marks(%s, NULL, %s) WHERE ((notional * factor) - globeop_notional) < 100;", + "SELECT *, abs(price-globeop_price) AS difference FROM list_cds_marks(%s, NULL, %s) WHERE abs((notional * factor) - globeop_notional) < 100;", (date, fund), ) for row in c: @@ -350,6 +350,42 @@ class CDXQuoteMonitor( ) +class CDXNotionalMonitor( + Monitor, + headers=( + "security_desc", + "security_id", + "maturity", + "admin_notional", + "serenitas_notional", + "difference", + ), + num_format=[("{0:,.2f}", 3), ("{0:,.2f}", 4), ("{0:,.2f}", 5)], +): + @classmethod + def email(cls, fund): + if not cls._staging_queue: + return + cls._em.send_email( + f"CDX Notional Mismatches: {fund}", + 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>Mismatched cleared cds notional mismatches below:<br><br>{cls.to_tabulate()} + </body> +</html>""" + ), + to_recipients=_cc_recipients[fund], + ) + + class SettlementMonitor( Monitor, headers=("date", "account", "currency", "projected_balance"), |
