diff options
Diffstat (limited to 'python/report_ops/queries.py')
| -rw-r--r-- | python/report_ops/queries.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/python/report_ops/queries.py b/python/report_ops/queries.py index bc6c087a..c4955973 100644 --- a/python/report_ops/queries.py +++ b/python/report_ops/queries.py @@ -57,9 +57,8 @@ LEFT JOIN index_version_markit ivm ON security_id=redindexcode; """ IRS_QUERY = """ -SELECT isr.pv, irs.*, accounts2.name -FROM ir_swap_risk isr -LEFT JOIN irs ON id=swp_id -LEFT JOIN accounts2 USING (cash_account) -WHERE date=%s AND irs.fund=%s; +SELECT * FROM list_ir_positions(%s, %s) a +LEFT JOIN LATERAL (SELECT sum(pv) AS mtm_valuation +FROM ir_swap_risk WHERE swp_id = ANY(a.ids) AND date=a.date) +b ON true; """ |
