aboutsummaryrefslogtreecommitdiffstats
path: root/python/citco_submission.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/citco_submission.py')
-rw-r--r--python/citco_submission.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/python/citco_submission.py b/python/citco_submission.py
index 968ca7d9..71e94d34 100644
--- a/python/citco_submission.py
+++ b/python/citco_submission.py
@@ -37,13 +37,30 @@ def insert_todb(conn, queue):
return True
+def instrument_table(instrument_id):
+ if instrument_id.startswith("IRS"):
+ return "citco_irs"
+ elif instrument_id.startswith("SWPO_") or instrument_id.startswith("BNDO_"):
+ return "citco_swaption"
+ elif instrument_id.startswith("CDS_"):
+ return "citco_tranche"
+ elif instrument_id.startswith("TRS"):
+ return "citco_trs"
+
+
+def update_instrument(conn, instrument_id):
+ table = instrument_table(instrument_id)
+ sql = f"UPDATE {table} SET committed=True where dealid=%s"
+ with conn.cursor() as c:
+ c.execute(sql, (instrument_id,))
+
+
def run():
from lru import LRU
_cache = LRU(128)
sftp = SftpClient.from_creds("citco")
while True:
- # try:
conn = dbconn("dawndb")
em = ExchangeMessage()
sftp.client.chdir("/outgoing/notifications")
@@ -65,6 +82,7 @@ def run():
identifier_type = "instrument"
serenitas_id = line["External_Security_Id"]
identifier = line["Internal_Security_Id"]
+ update_instrument(conn, serenitas_id)
_insert_queue.append(
[
fname_short,
@@ -77,7 +95,7 @@ def run():
em.send_email(
subject=f"(CITCO) Successfully Processed {f.filename}",
body="",
- to_recipients=("selene-ops@lmcg.com",),
+ to_recipients=("fyu@lmcg.com",),
)
else:
_insert_queue.append(
@@ -90,7 +108,7 @@ def run():
em.send_email(
subject=f"(CITCO) Failed Upload Selene {f.filename}",
body="",
- to_recipients=("selene-ops@lmcg.com",),
+ to_recipients=("fyu@lmcg.com",),
attach=[
FileAttachment(
name=f.filename,