aboutsummaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/dawn.sql10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 4c74cc93..2c0ec646 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -278,6 +278,8 @@ CREATE TABLE cds(id serial primary key,
cpty_id text,
globeop_id int,
full_globeop_id text GENERATED ALWAYS AS ('CDS'||lpad(cast(globeop_id as text), 6, '0')|| 'K00SCLMA') STORED,
+ stale bool default true,
+ traded_level numeric(9, 5) NULL,
CONSTRAINT tranche_check CHECK ((
swap_type IN ('CD_INDEX_TRANCHE', 'BESPOKE') AND
(orig_attach IS NOT NULL AND orig_detach IS NOT NULL AND clearing_facility IS NULL))
@@ -299,7 +301,7 @@ UPDATE
maturity,
trade_date,
upfront_settle_date,
- "ref",
+ traded_level,
notional,
protection ON
cds FOR EACH ROW EXECUTE FUNCTION notify_id();
@@ -2334,9 +2336,9 @@ SELECT cds.id,
'Buyer'::protection
END AS protection,
termination_fee AS upfront,
- ref
+ terminations.traded_level
FROM terminations RIGHT JOIN cds USING (dealid)
-left JOIN counterparties on termination_cp=code
+LEFT JOIN counterparties on termination_cp=code
WHERE termination_date is NOT NULL
UNION ALL (
SELECT id,
@@ -2356,7 +2358,7 @@ SELECT id,
detach,
protection,
upfront,
- ref
+ traded_level
FROM cds JOIN counterparties ON cp_code = code) ORDER BY trade_date DESC, folder;
CREATE TABLE curve_risk(