aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/risk_insight/templates/tranches.html2
-rw-r--r--python/risk_insight/views.py5
2 files changed, 4 insertions, 3 deletions
diff --git a/python/risk_insight/templates/tranches.html b/python/risk_insight/templates/tranches.html
index 608da3d0..489975a4 100644
--- a/python/risk_insight/templates/tranches.html
+++ b/python/risk_insight/templates/tranches.html
@@ -27,7 +27,7 @@
</div>
<div class="select-box2">
<select id="greek">
- <option value="Dealer Deltas">Dealer Delta</option>
+ <option value="tranchedelta">Dealer Delta</option>
<option value="delta">Model Delta</option>
<option value="forward_delta">Forward Delta</option>
<option value="gamma">Gamma</option>
diff --git a/python/risk_insight/views.py b/python/risk_insight/views.py
index a3e0c7d8..153bb63d 100644
--- a/python/risk_insight/views.py
+++ b/python/risk_insight/views.py
@@ -48,8 +48,9 @@ def get_risk_numbers():
db = get_db()
attach = get_attach_from_name(index, series)
sqlstr = (sql.SQL("SELECT to_char(date, 'YYYY/MM/DD'), array_agg({}) FROM " \
- "(SELECT date, {} FROM risk_numbers_new " \
- "WHERE index=%s AND series=%s AND tenor=%s ORDER BY date, attach) "\
+ "(SELECT date, {} FROM risk_numbers_new rn JOIN tranche_quotes " \
+ "ON tranche_quotes.id=rn.tranche_id AND rn.index=%s " \
+ "AND rn.series=%s AND rn.tenor=%s ORDER BY rn.date, rn.attach) "\
"AS a GROUP BY date ORDER BY date").
format(sql.Identifier(greek), sql.Identifier(greek)))
with db.cursor() as c: