diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 3341675c..cbbb4087 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -726,6 +726,7 @@ CREATE OR REPLACE FUNCTION list_swaption_positions_and_risks(IN p_date date) duration double precision) AS $$ BEGIN RETURN QUERY +-- TODO: fix the case of multiple index versions SELECT DISTINCT ON (a.dealid) a.dealid, a.security_id, c.maturity, (CASE WHEN buysell = 't' THEN 1 ELSE -1 END) * a.notional, a.option_type, a.strike, a.expiration_date, b.market_value, @@ -735,7 +736,7 @@ SELECT DISTINCT ON (a.dealid) a.dealid, a.security_id, c.maturity, FROM swaptions a LEFT JOIN (SELECT * FROM swaption_marks where date <= p_date) b USING (dealid) LEFT JOIN index_desc c ON a.security_id=redindexcode AND a.maturity=c.maturity -LEFT JOIN (SELECT * FROM index_quotes WHERE date=p_date) d USING (index, series, tenor, version) +LEFT JOIN (SELECT * FROM index_quotes WHERE date=p_date) d USING (index, series, tenor) LEFT JOIN valuation_reports ON invid = a.globeop_id WHERE (termination_date IS NULL OR termination_date > p_date) AND a.expiration_date > p_date AND trade_date <= p_date |
