aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/risk/tranches.py9
-rw-r--r--sql/dawn.sql1
2 files changed, 8 insertions, 2 deletions
diff --git a/python/risk/tranches.py b/python/risk/tranches.py
index c6b41c3e..d5373183 100644
--- a/python/risk/tranches.py
+++ b/python/risk/tranches.py
@@ -48,12 +48,15 @@ def get_tranche_portfolio(date, conn, by_strat=False, fund="SERCGMAST"):
def insert_tranche_portfolio(portf, conn):
cols = [
+ "date",
+ "tranche_id",
"clean_nav",
"accrued",
"duration",
"delta",
"gamma",
"theta",
+ "corr01",
"tranche_factor",
"upfront",
"running",
@@ -63,9 +66,10 @@ def insert_tranche_portfolio(portf, conn):
"index_refspread",
"index_duration",
]
- update_str = ",".join(f"{c} = EXCLUDED.{c}" for c in cols)
+ update_str = ",".join(f"{c} = EXCLUDED.{c}" for c in cols[2:])
sql_str = (
- f"INSERT INTO tranche_risk VALUES({','.join(['%s'] * 16)}) "
+ f"INSERT INTO tranche_risk({','.join(cols)}) "
+ f"VALUES({','.join(['%s'] * len(cols))}) "
" ON CONFLICT (date, tranche_id) DO UPDATE "
f"SET {update_str}"
)
@@ -91,6 +95,7 @@ def insert_tranche_portfolio(portf, conn):
trade.delta,
trade.gamma,
theta,
+ trade.corr01,
trade.tranche_factor,
trade.upfront,
trade.tranche_running,
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 43acf553..198332f4 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -957,6 +957,7 @@ CREATE TABLE tranche_risk(
delta float,
gamma float,
theta float,
+ corr01 float,
tranche_factor float,
upfront float,
running float,