diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/process_queue.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/python/process_queue.py b/python/process_queue.py index af260c45..e419b0eb 100644 --- a/python/process_queue.py +++ b/python/process_queue.py @@ -91,6 +91,8 @@ def process_upload( ) -> None: key = f"{trade_type}_upload" for fund, l in groupby(p, key, "fund").items(): + if trade_type == "wire": + fund = "BOWDST" buf = StringIO() csvwriter = csv.writer(buf) csvwriter.writerow(get_headers(trade_type, fund)) @@ -144,10 +146,7 @@ def rename_keys(d, mapping): def build_line(obj, trade_type="bond", fund="SERCGMAST"): - if fund == "SERCGMAST": - obj["Client"] = "Serenitas" - else: - obj["Client"] = "LMCG" + obj["Client"] = client_name[fund] obj["State"] = "Valid" rename_cols = { "fund": "Fund", @@ -189,7 +188,9 @@ def build_line(obj, trade_type="bond", fund="SERCGMAST"): "accrued_payment": "AccruedPayment", "current_face": "CurrentFace", } - rename_cols["curr_notional" if fund == "SERCGMAST" else "notional"] = "Notional" + rename_cols[ + "curr_notional" if fund in ("SERCGMAST", "BOWDST") else "notional" + ] = "Notional" rename_keys(obj, rename_cols) if trade_type in ("bond", "swaption", "future"): obj["Transaction Indicator"] = "Buy" if obj["buysell"] else "Sell" @@ -341,6 +342,7 @@ def build_line(obj, trade_type="bond", fund="SERCGMAST"): "transaction_indicator": "TransactionIndicator", }, ) + return [obj.get(h, None) for h in get_headers(trade_type, fund)] @@ -677,9 +679,9 @@ def upload_buf( ftp.client.cwd("incoming") ftp.put(buf, dest) elif fund == "BOWDST": - sftp = SftpClient.from_creds("bony") - sftp.client.chdir("/inbound/cfe/") - sftp.put(buf, dest, False) + sftp = SftpClient.from_creds("hm_globeop") + sftp.client.chdir("incoming") + sftp.put(buf, dest) em = ExchangeMessage() recipients = ( "caagtradecapture@bnymellon.com", @@ -757,7 +759,7 @@ def build_termination( "DealId": dealid if globeopid is None else None, "GoTradeId": globeopid if globeopid else None, "Action": "Update", - "Client": "Serenitas" if fund == "SERCGMAST" else "LMCG", + "Client": client_name[fund], "SubAction": "Termination", "PartialTermination": "Y" if partial_termination else "N", "TerminationAmount": termination_amount, @@ -776,6 +778,7 @@ def build_termination( if __name__ == "__main__": + client_name = {"SERCGMAST": "Serenitas", "BOWDST": "HEDGEMARK"} parser = argparse.ArgumentParser() parser.add_argument( "-n", "--no-upload", action="store_true", help="do not upload to Globeop" |
