aboutsummaryrefslogtreecommitdiffstats
path: root/sql/quantifi.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/quantifi.sql')
-rw-r--r--sql/quantifi.sql8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/quantifi.sql b/sql/quantifi.sql
index 215e7418..4de01d47 100644
--- a/sql/quantifi.sql
+++ b/sql/quantifi.sql
@@ -323,13 +323,13 @@ CREATE TABLE swaptions (
CREATE USER MAPPING FOR quantifi_user SERVER dawndb_server OPTIONS (user 'dawn_user', password '****');
CREATE OR REPLACE FUNCTION list_unterminated_tranche(p_date DATE)
-RETURNS TABLE(tradeid text, productname TEXT, most_recent_tradedate DATE, currentnotional integer) AS $$
+RETURNS TABLE(tradeid text, productname TEXT, termination_date DATE, currentnotional integer) AS $$
BEGIN
RETURN QUERY
- SELECT t.tradeid, t.productname, m.most_recent_tradedate, t.currentnotional::integer
+ SELECT t.tradeid, t.productname, m.termination_date, t.currentnotional::integer
FROM cdxtrancheut t
JOIN (
- SELECT c.productname, MAX(c.tradedate) as most_recent_tradedate
+ SELECT c.productname, MAX(c.tradedate) as termination_date
FROM cdxtrancheut c
WHERE c.date = p_date
AND c.productname IN (
@@ -340,7 +340,7 @@ BEGIN
HAVING SUM(c2.currentnotional) = 0
)
GROUP BY c.productname
- ) m ON t.productname = m.productname AND t.tradedate = m.most_recent_tradedate
+ ) m ON t.productname = m.productname AND t.tradedate = m.termination_date
WHERE t.date = p_date;
END;
$$ LANGUAGE plpgsql;