diff options
Diffstat (limited to 'python/process_queue.py')
| -rw-r--r-- | python/process_queue.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/python/process_queue.py b/python/process_queue.py index 6a2605e8..f4ed318c 100644 --- a/python/process_queue.py +++ b/python/process_queue.py @@ -30,7 +30,7 @@ from typing import Tuple, Union from quantlib.time.api import pydate_from_qldate, UnitedStates, Days, Date from tabulate import tabulate from headers import get_headers, get_termination_headers -from mtm_upload import mtm_process_upload +from trade_dataclasses import DealKind _client_name = {"SERCGMAST": "Serenitas", "BOWDST": "HEDGEMARK", "BRINKER": "LMCG"} @@ -70,12 +70,11 @@ def process_indicative( trade_type: str, upload: bool, session: blpapi.session.Session, - conn: psycopg.connection, + conn: psycopg.Connection, ) -> None: process_fun = globals().get( f"{trade_type}_trade_process", lambda conn, session, trade: trade ) - mtm_uploads = [] for trade in get_trades(p, trade_type): process_fun(conn, session, trade) fund = trade["fund"] @@ -83,13 +82,14 @@ def process_indicative( fund in ("SERCGMAST", "BOWDST") or trade_type in ("cds", "swaption") ): p.rpush(f"{trade_type}_upload", dumps(trade)) - if ( - (trade_type == "cds" and trade.get("attach")) - or (trade_type == "swaption" and trade.get("swap_type", "CD_INDEX_OPTION")) - ) and trade.get("upload", True): - mtm_uploads.append(trade["id"]) - if mtm_uploads: - mtm_process_upload(mtm_uploads, trade_type) + if trade.get("swap_type", None) in ( + "CD_INDEX_OPTION", + "CD_INDEX_TRANCHE", + "BESPOKE", + ): + DealKind[trade_type].from_dict(**trade).mtm_stage() + if Deal := DealKind[trade_type]: + Deal.mtm_upload() p.delete(trade_type) |
