aboutsummaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/dawn.sql8
1 files changed, 3 insertions, 5 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 3a62c3a0..a84355ed 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -3558,10 +3558,9 @@ CREATE TABLE citco_stax (
CONSTRAINT citco_stax_pk PRIMARY KEY (period_end_date, "row")
);
-CREATE OR REPLACE VIEW tranche_risk_selene
+CREATE OR REPLACE VIEW tranche_risk_isosel
AS SELECT tranche_risk.date,
tranche_risk.tranche_id AS trade_id,
- b.identifier,
cds.security_desc,
index_version.index,
index_version.series,
@@ -3591,16 +3590,15 @@ AS SELECT tranche_risk.date,
tranche_risk.hy_equiv,
cds.initial_margin_percentage
FROM tranche_risk
- LEFT JOIN LATERAL ( SELECT identifier FROM citco_submission cs WHERE serenitas_id = concat('SCCDS', tranche_risk.tranche_id) ORDER BY submit_date DESC LIMIT 1) b ON true
LEFT JOIN cds ON tranche_risk.tranche_id = cds.id
FULL JOIN ( SELECT
- citco_stax.fix_id ,
+ citco_stax.trader_notes ,
citco_stax.period_end_date,
0 AS admin_accrued,
sum(base_market_value) AS admin_clean_nav,
sum(-quantity) AS admin_notional
FROM citco_stax WHERE close_trade_date IS NULL
- GROUP BY citco_stax.fix_id, citco_stax.period_end_date) a ON NULLIF("substring"(a.fix_id, 'SCCDS(\d*)'::text), ''::text)::integer = tranche_risk.tranche_id AND a.period_end_date = tranche_risk.date
+ GROUP BY citco_stax.trader_notes, citco_stax.period_end_date) a ON a.trader_notes= concat('SCCDS', tranche_risk.tranche_id) AND a.period_end_date = tranche_risk.date
LEFT JOIN index_version ON cds.security_id::text = index_version.redindexcode
LEFT JOIN external_marks_deriv ON cds.cpty_id = external_marks_deriv.identifier AND external_marks_deriv.date = tranche_risk.date
WHERE cds.fund = 'ISOSEL'::fund