aboutsummaryrefslogtreecommitdiffstats
path: root/sql/dawn.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/dawn.sql')
-rw-r--r--sql/dawn.sql4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 14aed6fe..3aeb00c2 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -1818,7 +1818,7 @@ for t in (df.itertuples(index=False)):
$$ LANGUAGE plpython3u;
CREATE OR REPLACE VIEW tranche_risk_serenitas AS
-SELECT tranche_risk.date, tranche_id as trade_id, security_desc, index, series, maturity, orig_attach,
+SELECT tranche_risk.date, tranche_id as trade_id, b.globeop_id, security_desc, index, series, maturity, orig_attach,
orig_detach, tranche_risk.notional,
globeop_notional,
clean_nav * coalesce(fx, 1.) as serenitas_clean_nav,
@@ -1831,7 +1831,7 @@ SELECT tranche_risk.date, tranche_id as trade_id, security_desc, index, series,
index_refprice, index_refspread, index_duration, initial_margin_percentage
FROM tranche_risk
LEFT JOIN LATERAL
-(SELECT full_globeop_id FROM id_mapping WHERE id_mapping.serenitas_id=tranche_id AND date <= tranche_risk.date ORDER by date desc LIMIT 1) b ON true
+(SELECT full_globeop_id, globeop_id FROM id_mapping WHERE id_mapping.serenitas_id=tranche_id AND date <= tranche_risk.date ORDER by date desc LIMIT 1) b ON true
LEFT JOIN cds ON (tranche_id=id)
RIGHT JOIN (SELECT invid, periodenddate,
sum(endbookunrealincome) AS globeop_accrued,