aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/globeop_monitor.py21
-rw-r--r--python/report_ops/__main__.py2
-rw-r--r--python/report_ops/utils.py18
3 files changed, 19 insertions, 22 deletions
diff --git a/python/globeop_monitor.py b/python/globeop_monitor.py
index 05b0d5c9..57864ff5 100644
--- a/python/globeop_monitor.py
+++ b/python/globeop_monitor.py
@@ -2,7 +2,7 @@ import datetime
import logging
from serenitas.analytics.dates import prev_business_day
from serenitas.utils.db import dbconn
-from report_ops.utils import GFSMonitor, CDXQuoteMonitor
+from report_ops.utils import GFSMonitor, CDXQuoteMonitor, check_cleared_cds
def check_gfs(date, fund, conn):
@@ -20,25 +20,6 @@ def check_gfs(date, fund, conn):
GFSMonitor._staging_queue.clear()
-def check_cleared_cds(date, fund, conn):
- with conn.cursor() as c:
- c.execute(
- "SELECT *, abs(serenitas_quote-globeop_quote) AS difference FROM list_cds_marks(%s, NULL, %s)",
- (date, fund),
- )
- for row in c:
- d = row._asdict()
- match d["index"]:
- case "IG":
- if d["difference"] > 0.10:
- CDXQuoteMonitor.stage(d)
- case "HY":
- if d["difference"] > 0.20:
- CDXQuoteMonitor.stage(d)
- CDXQuoteMonitor.email(fund)
- CDXQuoteMonitor._staging_queue.clear()
-
-
if __name__ == "__main__":
import argparse
diff --git a/python/report_ops/__main__.py b/python/report_ops/__main__.py
index da634f74..a5172a24 100644
--- a/python/report_ops/__main__.py
+++ b/python/report_ops/__main__.py
@@ -8,7 +8,7 @@ from .cash import CashReport
from .admin import CitcoReport
from .wires import Wire
from .custodians import upload_to_custodian
-from .utils import notify_payment_settlements, notify_fx_hedge, PaymentMonitor, FxHedge
+from .utils import notify_payment_settlements, notify_fx_hedge
from .misc import _fund_custodians
logger = logging.getLogger(__name__)
diff --git a/python/report_ops/utils.py b/python/report_ops/utils.py
index c4c1561d..f5a5ee35 100644
--- a/python/report_ops/utils.py
+++ b/python/report_ops/utils.py
@@ -98,6 +98,22 @@ def notify_fx_hedge(date, fund, conn):
FxHedge._staging_queue.clear()
+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_quote) AS difference FROM list_cds_marks(%s, NULL, %s)",
+ (date, fund),
+ )
+ for row in c:
+ d = row._asdict()
+ d["serenitas_quote"] = d["price"]
+ if d["difference"] > _tolerance[d["index"]]:
+ CDXQuoteMonitor.stage(d)
+ CDXQuoteMonitor.email(fund)
+ CDXQuoteMonitor._staging_queue.clear()
+
+
@dataclass
class CitcoSubmission(Deal, deal_type=None, table_name="citco_submission2"):
id: int = field(init=False, metadata={"insert": False})
@@ -300,7 +316,7 @@ class CDXQuoteMonitor(
Monitor,
headers=(
"security_desc",
- "identifier",
+ "security_id",
"maturity",
"globeop_quote",
"serenitas_quote",