aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sql/dawn.sql9
1 files changed, 4 insertions, 5 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 80b40522..7ad59571 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -1711,15 +1711,14 @@ RETURN QUERY
SELECT DISTINCT ON (a.dealid) a.dealid, a.security_id, c.maturity,
(CASE WHEN buysell = 't' THEN 1 ELSE -1 END) * (a.notional - coalesce(terminated_amount, 0.)),
a.option_type, a.strike, a.expiration_date, b.market_value,
- coalesce(endbooknav, base_market_value),
+ end_mkt_value,
f.ia, b.date, b.delta, b.gamma, b.vega,
b.theta, b.hy_equiv, c.index, c.series, c.tenor, d.duration, a.portfolio, c.indexfactor
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)
-LEFT JOIN valuation_reports ON NULLIF(substring(invid FROM '\D{3}[0]*(\d*)K'), '')::integer = a.globeop_id
-LEFT JOIN bowdst_val ON link_ref = a.dealid AND as_of_date=p_date
+LEFT JOIN isosel_accrued ON a.dealid=isosel_accrued.init_fix_id
LEFT JOIN (SELECT dealid, SUM(termination_amount) AS terminated_amount
FROM terminations WHERE termination_date <= p_date GROUP BY dealid) e USING (dealid)
LEFT JOIN external_marks_deriv f ON identifier=cpty_id AND f.date=p_date
@@ -3615,7 +3614,7 @@ AS SELECT tranche_risk.date,
CREATE TABLE isosel_accrued (
"status" text NULL,
tid text NULL,
- tid_fwd_date text NULL,
+ tid_fwd_date date NULL,
fund_abbrev text NULL,
trader_name text NULL,
clear_agent text NULL,
@@ -3769,7 +3768,7 @@ AS SELECT tranche_risk.date,
base_acq_relief float8 NULL,
ntv_end_accrual float8 NULL,
base_end_accrual float8 NULL,
- last_cpn_date float8 NULL,
+ last_cpn_date date NULL,
liqd_orig_date text NULL,
days_betw_orig_dates float8 NULL,
"long/short_adjustment" float8 NULL,