diff options
Diffstat (limited to 'python/mtm_status.py')
| -rw-r--r-- | python/mtm_status.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/python/mtm_status.py b/python/mtm_status.py index 92240b19..1d61bfc5 100644 --- a/python/mtm_status.py +++ b/python/mtm_status.py @@ -25,7 +25,6 @@ def run(conn, date): with conn.cursor() as c: for row in df.itertuples(): - cpty_id = row.BrokerSecRef try: c.execute( @@ -43,16 +42,23 @@ def run(conn, date): except UniqueViolation: conn.rollback() else: - _product_type = {"CDISW": "swaptions", "TRN": "cds"} - sql_str = f"UPDATE {_product_type[row.ProductType]} SET cpty_id = %s WHERE dealid = %s" if (row.SwapType == "NEW") and (row.BrokerId != "BNPBNY") and cpty_id: - c.execute( - sql_str, - ( - cpty_id, - row.TicketNo, - ), - ) + if row.ProductType == "CDISW": + c.execute( + "UPDATE swaptions SET cpty_id = %s WHERE dealid = %s", + ( + cpty_id, + row.TicketNo, + ), + ) + elif row.ProductType == "TRN": + c.execute( + "UPDATE cds SET cpty_id = %s WHERE dealid = %s", + ( + cpty_id, + row.TicketNo, + ), + ) conn.commit() |
