aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/risk/tranches.py10
-rw-r--r--sql/dawn.sql5
2 files changed, 11 insertions, 4 deletions
diff --git a/python/risk/tranches.py b/python/risk/tranches.py
index 22291170..f4391f99 100644
--- a/python/risk/tranches.py
+++ b/python/risk/tranches.py
@@ -11,8 +11,9 @@ def get_tranche_portfolio(date, conn, by_strat=False, fund="SERCGMAST"):
sql_string = ("SELECT folder, id from cds "
"WHERE orig_attach IS NOT NULL "
"AND (termination_date IS NULL OR termination_date > %s) "
- "AND maturity > %s AND fund = %s ORDER BY trade_date")
- params = (date, date, fund)
+ "AND maturity > %s AND trade_date <= %s "
+ "AND fund = %s ORDER BY trade_date")
+ params = (date, date, date, fund)
with conn.cursor() as c:
c.execute(sql_string, params)
trade_ids = [tuple(e) for e in c]
@@ -49,10 +50,13 @@ def insert_tranche_portfolio(portf, conn):
trade_id,
trade.clean_pv,
-trade._accrued * trade.notional,
- trade.theta(method="TLP"),
trade.duration,
trade.delta,
+ trade.gamma,
+ trade.theta(method="TLP"),
trade.upfront,
+ trade.rho[0],
+ trade.rho[1],
trade.tranche_running,
100 - float(trade._index.pv()) * 100,
trade._index._snacspread(trade._index.coupon(),
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 30a95e96..f60c8ed9 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -909,11 +909,14 @@ CREATE TABLE tranche_risk(
tranche_id integer REFERENCES cds(id),
clean_nav float,
accrued float,
- theta float,
duration float,
delta float,
+ gamma float,
+ theta float,
upfront float,
running float,
+ corr_attach float,
+ corr_detach float,
index_refprice float,
index_refspread float,
index_duration float,