aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/mtm_upload.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/python/mtm_upload.py b/python/mtm_upload.py
index 928fe76f..9a6783c2 100644
--- a/python/mtm_upload.py
+++ b/python/mtm_upload.py
@@ -116,14 +116,15 @@ HEADERS = {
def tranche_trades(conn):
trades = []
- obj = CDSDeal.from_tradeid(3472).to_markit()
- trades.append(obj)
+ for tradeid in (3517, 3516):
+ obj = CDSDeal.from_tradeid(tradeid).to_markit()
+ trades.append(obj)
return trades
def swaption_trades(conn):
trades = []
- for tradeid in (260, 261):
+ for tradeid in (262, 263):
obj = SwaptionDeal.from_tradeid(tradeid).to_markit()
trades.append(obj)
return trades
@@ -133,8 +134,8 @@ def tranche_term_trades(conn):
with conn.cursor() as c:
trades = []
c.execute(
- "SELECT * FROM terminations where termination_date > %s and dealid LIKE %s",
- (datetime.date(2021, 12, 15), "SCCDS%"),
+ "SELECT terminations.*, cds.fund, cds.cp_code FROM terminations left join cds using (dealid) where termination_date >= %s and dealid LIKE %s",
+ (datetime.date(2022, 3, 1), "SCCDS%"),
)
for row in c:
obj = row._asdict()
@@ -147,6 +148,9 @@ def tranche_term_trades(conn):
"termination_fee": "Initial Payment",
"termination_date": "Trade Date",
"fee_payment_date": "Settle Date",
+ "fund": "Account Abbreviation",
+ "termination_cp": "Broker Id",
+ "cp_code": "Remaining Party",
},
)
if obj["Initial Payment"] >= 0:
@@ -154,12 +158,10 @@ def tranche_term_trades(conn):
else:
obj["Initial Payment"] = abs(obj["Initial Payment"])
obj["Transaction Code"] = "Pay"
+ obj["Currency Code"] = "USD"
obj["Product Type"] = "TRN"
obj["Entity Matrix"] = "Publisher"
obj["Definitions Type"] = "ISDA2003Credit"
- obj["Account Abbreviation"] = "Serenitas-test1"
- obj["Broker Id"] = "0000571T"
- obj["Remaining Party"] = "0000571T"
obj["Trade ID"] = obj["Swap ID"] + "-" + str(obj["id"])
obj["Transaction Type"] = "Partial Assignment"
obj["Effective Date"] = obj["Trade Date"] + datetime.timedelta(days=1)
@@ -185,7 +187,7 @@ def process_upload(trades, asset_type, upload):
def upload_trades(conn):
- process_upload(swaption_trades(conn), "swaption", upload=False)
+ process_upload(tranche_term_trades(conn), "tranche", upload=False)
if __name__ == "__main__":