diff options
Diffstat (limited to 'sql')
| -rw-r--r-- | sql/dawn.sql | 6 | ||||
| -rw-r--r-- | sql/serenitasdb.sql | 22 |
2 files changed, 27 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index eb6b60cd..8535d659 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -309,6 +309,8 @@ CREATE TABLE cds(id serial primary key, stale bool default true, traded_level numeric(9, 5) NULL, exercised_from text REFERENCES swaptions(dealid), + delta_id integer REFERENCES cds(id), + delta_alloc float, 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)) @@ -495,6 +497,8 @@ CREATE TABLE swaptions(id serial PRIMARY KEY, cpty_id text, globeop_id int, full_globeop_id text GENERATED ALWAYS AS ('SWO'||lpad(cast(globeop_id as text), 6, '0')|| 'K00SCLMA') STORED, + delta_id int REFERENCES cds(id), + delta_alloc float ); CREATE TRIGGER swaptions_dealid BEFORE INSERT ON swaptions @@ -517,7 +521,7 @@ CREATE OR REPLACE FUNCTION update_account() RETURNS TRIGGER AS $$ BEGIN -SELECT cash_account INTO STRICT NEW.cash_account FROM accounts2 LEFT JOIN account_counterparty ON accounts2.id=account_id WHERE trade_type=TG_ARGV[0] AND fund=NEW.fund AND account_counterparty.cp_code=NEW.cp_code; +SELECT cash_account INTO STRICT NEW.cash_account FROM accounts2 LEFT JOIN account_counterparty ON accounts2.id=account_id WHERE trade_type=TG_ARGV[0] AND fund=NEW.fund AND account_counterparty.cp_code=NEW.cp_code AND active; RETURN NEW; END $$ LANGUAGE plpgsql; diff --git a/sql/serenitasdb.sql b/sql/serenitasdb.sql index f740c30b..5db7674e 100644 --- a/sql/serenitasdb.sql +++ b/sql/serenitasdb.sql @@ -1233,3 +1233,25 @@ CREATE TABLE rates( CREATE TABLE dtcc_corrections(
dissemination_id bigint,
correction bytea)
+
+CREATE TYPE quote_firmness AS ENUM('FIRM', 'INDICATIVE');
+
+CREATE TABLE markit_singlename_quotes (
+ quoteid int8 primary key,
+ redcode text,
+ ticker text,
+ maturity date,
+ tenor text,
+ runningcoupon int,
+ bidconventionalspread float,
+ bidupfront float,
+ bidsize float,
+ askconventionalspread float,
+ askupfront float,
+ asksize float,
+ firmness quote_firmness,
+ msg_id text,
+ quotedate timestamptz NULL,
+ quotesource text,
+ confidence int
+ );
\ No newline at end of file |
