aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/cds_rebook.py4
-rw-r--r--python/populate_tranche_cashflows.py2
-rw-r--r--python/report_ops/sma.py2
-rw-r--r--python/risk/tranches.py4
4 files changed, 5 insertions, 7 deletions
diff --git a/python/cds_rebook.py b/python/cds_rebook.py
index 47d76b1d..a85032a8 100644
--- a/python/cds_rebook.py
+++ b/python/cds_rebook.py
@@ -161,9 +161,7 @@ def rebook(conn, trade_date, company_id, seniority, fcm, fund="SERCGMAST"):
"account_code": fcm,
}
trade_new = copy(trade_old)
- trade_new["protection"] = (
- "Seller" if trade_old["protection"] == "Buyer" else "Buyer"
- )
+ trade_new["protection"] = "Sell" if trade_old["protection"] == "Buy" else "Buy"
trade_new["upfront"] = -adj - index_old.pv
trade_new["security_id"] = r.redindexcode
sql_str = f"INSERT INTO cds({','.join(trade_new.keys())}) VALUES %s"
diff --git a/python/populate_tranche_cashflows.py b/python/populate_tranche_cashflows.py
index 6638c002..67730f1d 100644
--- a/python/populate_tranche_cashflows.py
+++ b/python/populate_tranche_cashflows.py
@@ -34,7 +34,7 @@ def insert_tranche_cashflows(
(tranche_ids,),
)
for r in c:
- direction = 1.0 if r.protection == "Buyer" else -1.0
+ direction = 1.0 if r.protection == "Buy" else -1.0
notional = r.notional / (r.orig_detach - r.orig_attach)
if r.orig_detach == 100:
accrued = (
diff --git a/python/report_ops/sma.py b/python/report_ops/sma.py
index 764c4a00..22b8d651 100644
--- a/python/report_ops/sma.py
+++ b/python/report_ops/sma.py
@@ -313,7 +313,7 @@ class TranchePosition(PositionReport, asset_class="tranche"):
},
)
d["primebroker"] = "Bilateral"
- d["buysell"] = d["protection"] == "Buyer"
+ d["buysell"] = d["protection"] == "Buy"
return cls.from_dict(**d)
diff --git a/python/risk/tranches.py b/python/risk/tranches.py
index ae22a735..4647ce0c 100644
--- a/python/risk/tranches.py
+++ b/python/risk/tranches.py
@@ -59,7 +59,7 @@ def insert_tranche_pnl_explain(portf, conn):
prev_day_risk = {rec.tranche_id: rec for rec in c}
c.execute(
"SELECT cds.id, cds.upfront, cds_delta.upfront AS delta_upfront, "
- "cds_delta.notional * (CASE WHEN cds_delta.protection='Buyer' THEN -1.0 ELSE 1.0 END) AS notional, "
+ "cds_delta.notional * (CASE WHEN cds_delta.protection='Buy' THEN -1.0 ELSE 1.0 END) AS notional, "
"cds.currency::text FROM cds "
" LEFT JOIN cds AS cds_delta ON cds_delta.id=cds.delta_id "
"WHERE cds.trade_date=%s",
@@ -68,7 +68,7 @@ def insert_tranche_pnl_explain(portf, conn):
daily_trades = {rec.id: rec for rec in c}
c.execute(
"SELECT terminations.dealid, termination_amount, termination_fee, terminations.currency::text, "
- "cds.notional * delta_alloc * (CASE WHEN cds.protection='Buyer' THEN -1.0 ELSE 1.0 END) AS notional, "
+ "cds.notional * delta_alloc * (CASE WHEN cds.protection='Buy' THEN -1.0 ELSE 1.0 END) AS notional, "
"cds.upfront * delta_alloc AS delta_upfront "
"FROM terminations LEFT JOIN cds ON cds.id=terminations.delta_id "
"WHERE deal_type='CDS' AND termination_date=%s",