aboutsummaryrefslogtreecommitdiffstats
path: root/python/risk_insight/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/risk_insight/views.py')
-rw-r--r--python/risk_insight/views.py5
1 files changed, 3 insertions, 2 deletions
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: