diff options
| -rw-r--r-- | sql/dawn.sql | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index eb417b93..37898e64 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -163,7 +163,7 @@ CREATE TABLE bonds(id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY, allocated boolean NOT NULL DEFAULT false, stale bool NOT NULL DEFAULT true, emailed bool NULL DEFAULT false, - bbg_ticket_id text NULL REFERENCES public.bond_tickets(bbg_ticket_id) ON DELETE SET NULL, + bbg_ticket_id text NULL REFERENCES bond_tickets(bbg_ticket_id) ON DELETE SET NULL, CONSTRAINT bonds_check CHECK (((cusip IS NOT NULL) OR (isin IS NOT NULL))); @@ -2631,7 +2631,7 @@ CREATE TABLE beta_crt( PRIMARY KEY (date, strategy) ); -CREATE OR REPLACE VIEW public.payment_settlements +CREATE OR REPLACE VIEW payment_settlements AS SELECT trades.settle_date, trades.fund, cps.name, @@ -2710,7 +2710,7 @@ AS SELECT trades.settle_date, -CREATE TABLE public.equities ( +CREATE TABLE equities ( id serial4 NOT NULL, dealid varchar(28) NULL GENERATED ALWAYS AS ((('EQ'::text || id::text))) STORED, lastupdate timestamp NULL DEFAULT now(), @@ -2730,10 +2730,10 @@ CREATE TABLE public.equities ( account_code text NOT NULL DEFAULT 'IB'::text, CONSTRAINT equities_dealid_key UNIQUE (dealid), CONSTRAINT equities_pkey PRIMARY KEY (id), - CONSTRAINT equities_account_code_fkey FOREIGN KEY (account_code) REFERENCES public.accounts(code) + CONSTRAINT equities_account_code_fkey FOREIGN KEY (account_code) REFERENCES accounts(code) ); -CREATE TABLE public.equity_options ( +CREATE TABLE equity_options ( id serial4 NOT NULL, dealid varchar(28) NULL GENERATED ALWAYS AS ((('EQOPT'::text || id::text))) STORED, lastupdate timestamp NULL DEFAULT now(), @@ -2754,10 +2754,10 @@ CREATE TABLE public.equity_options ( account_code text NOT NULL DEFAULT 'IB'::text, CONSTRAINT equity_options_dealid_key UNIQUE (dealid), CONSTRAINT equity_options_pkey PRIMARY KEY (id), - CONSTRAINT equity_options_account_code_fkey FOREIGN KEY (account_code) REFERENCES public.accounts(code) + CONSTRAINT equity_options_account_code_fkey FOREIGN KEY (account_code) REFERENCES accounts(code) ); -CREATE TABLE public.bond_tickets ( +CREATE TABLE bond_tickets ( bbg_ticket_id text NOT NULL, "Match" text NULL, "Side" text NULL, @@ -2781,9 +2781,9 @@ CREATE TABLE public.bond_tickets ( "Curr Face" text NULL, CONSTRAINT bond_tickets_pk PRIMARY KEY (bbg_ticket_id) ); -CREATE INDEX ix_bond_tickets_index ON public.bond_tickets USING btree (bbg_ticket_id); +CREATE INDEX ix_bond_tickets_index ON bond_tickets USING btree (bbg_ticket_id); -CREATE TABLE public.cds_tickets ( +CREATE TABLE cds_tickets ( bbg_ticket_id text NOT NULL, "Match" text NULL, "Side" text NULL, @@ -2809,18 +2809,18 @@ CREATE TABLE public.cds_tickets ( CONSTRAINT cds_tickets_pk PRIMARY KEY (bbg_ticket_id, "Account", "Client FCM") ); -CREATE TABLE public.cds_submission ( +CREATE TABLE cds_submission ( id int4 NOT NULL GENERATED ALWAYS AS IDENTITY, tradeid int4 NOT NULL, "action" action NOT NULL, submit_date timestamptz NOT NULL DEFAULT now(), "status" status NOT NULL DEFAULT 'Pending'::status, CONSTRAINT cds_submission_pkey PRIMARY KEY (id), - CONSTRAINT cds_submission_allocation_id_fkey FOREIGN KEY (tradeid) REFERENCES public.cds(id) ON DELETE CASCADE + CONSTRAINT cds_submission_allocation_id_fkey FOREIGN KEY (tradeid) REFERENCES cds(id) ON DELETE CASCADE ); -CREATE TABLE public.mtm_submissions ( +CREATE TABLE mtm_submissions ( ticketid text NOT NULL, executed date NULL, dealid text NOT NULL, @@ -2831,18 +2831,18 @@ CREATE TABLE public.mtm_submissions ( CONSTRAINT mtm_submissions_pk PRIMARY KEY (ticketid, dealid) ); -CREATE TABLE public.quantifi_bond_proxy ( +CREATE TABLE quantifi_bond_proxy ( product_name text NOT NULL, trade_date date NOT NULL, "asset_class" text NOT NULL, - "fund" public."fund" NOT NULL, + "fund" "fund" NOT NULL, notional float8 NULL, terminated bool NULL DEFAULT false, CONSTRAINT quantifi_bond_proxy_pk PRIMARY KEY (product_name, trade_date, asset_class, fund) ); -CREATE OR REPLACE FUNCTION public.list_compressed_quantifi(start_from date) +CREATE OR REPLACE FUNCTION list_compressed_quantifi(start_from date) RETURNS TABLE(index text, tradeid text, fund fund, clean_folder text, portfolio portfolio, security_id varchar(12), notional double precision, fcm text) LANGUAGE plpgsql AS $function$ @@ -2860,7 +2860,7 @@ end; $function$ ; -CREATE TABLE public.fx_tickets ( +CREATE TABLE fx_tickets ( bbg_ticket_id text NOT NULL, "Message Type" text NULL, "Deal Type" text NULL, @@ -3149,15 +3149,15 @@ CREATE TABLE trs ( ); -CREATE TABLE public.strat_cash_realloc ( +CREATE TABLE strat_cash_realloc ( id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, dealid text NULL GENERATED ALWAYS AS ('STRATCSH'::text || id::text) STORED, - "portfolio" public."portfolio" NULL, - folder public."strategy_dirty" NOT NULL, + "portfolio" "portfolio" NULL, + folder "strategy_dirty" NOT NULL, trade_date date NOT NULL, amount float8 NOT NULL, - "currency" public."currency" NOT NULL, - "fund" public."fund" NOT NULL DEFAULT 'BOWDST'::fund, + "currency" "currency" NOT NULL, + "fund" "fund" NOT NULL DEFAULT 'BOWDST'::fund, cash_account text NOT NULL, CONSTRAINT strat_cash_realloc_un UNIQUE (folder, trade_date, amount, currency, fund, cash_account) ); @@ -3177,11 +3177,11 @@ CREATE TYPE "serenitas_product" AS ENUM( 'tranche', 'cdx_swaption', 'ir_swaption', 'irs', 'trs' ) -CREATE TABLE public.citco_tranche ( +CREATE TABLE citco_tranche ( id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY, dealid text NULL GENERATED ALWAYS AS ('CDS_'::text || id::text) STORED, - instrument_type public.instrument_type NOT NULL DEFAULT 'CDS'::instrument_type, - underlying_id_source public.id_source NOT NULL DEFAULT 'RED'::id_source, + instrument_type instrument_type NOT NULL DEFAULT 'CDS'::instrument_type, + underlying_id_source id_source NOT NULL DEFAULT 'RED'::id_source, underlying_security_id text NOT NULL, birth_date date NULL, death_date date NULL, @@ -3195,7 +3195,7 @@ CREATE TABLE public.citco_tranche ( -CREATE TABLE public.citco_swaption ( +CREATE TABLE citco_swaption ( id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY, dealid varchar(28) NULL GENERATED ALWAYS AS (((( CASE @@ -3203,8 +3203,8 @@ CREATE TABLE public.citco_swaption ( WHEN instrument_type = 'BNDO'::instrument_type THEN 'BNDO'::text ELSE NULL::text END) || id::text))) STORED, - instrument_type public.instrument_type NOT NULL, - underlying_id_source public.id_source NOT NULL, + instrument_type instrument_type NOT NULL, + underlying_id_source id_source NOT NULL, underlying_security_id text NOT NULL, birth_date date NOT NULL, death_date date NOT NULL, @@ -3217,7 +3217,7 @@ CREATE TABLE public.citco_swaption ( CONSTRAINT citco_swaption_un UNIQUE (instrument_type, underlying_security_id, strike, expiration, callput) ); -CREATE TABLE public.citco_irs ( +CREATE TABLE citco_irs ( id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, dealid text NULL GENERATED ALWAYS AS ('IRS'::text || id::text) STORED, instrument_type "instrument_type" NOT NULL default 'IRS', @@ -3226,59 +3226,59 @@ CREATE TABLE public.citco_irs ( active bool NOT NULL default True, payreceive bool NOT NULL, fixed_rate float8 NOT NULL, - fixed_daycount public."day_count" NOT NULL, - fixed_payment_freq public."frequency" NOT NULL, - fixed_bdc public."bus_day_convention" NOT NULL, + fixed_daycount "day_count" NOT NULL, + fixed_payment_freq "frequency" NOT NULL, + fixed_bdc "bus_day_convention" NOT NULL, notional float8 NOT NULL, - float_index public."cash_rate" NOT NULL, - float_daycount public."day_count" NOT NULL, - float_payment_freq public."frequency" NOT NULL, - float_bdc public."bus_day_convention" NOT NULL, + float_index "cash_rate" NOT NULL, + float_daycount "day_count" NOT NULL, + float_payment_freq "frequency" NOT NULL, + float_bdc "bus_day_convention" NOT NULL, float_arrears bool NOT NULL, - "currency" public."currency" NOT NULL, - float_fixing_freq public."frequency" NOT NULL, - pay_interest_calc_method public."interest_calc_method" NOT NULL, + "currency" "currency" NOT NULL, + float_fixing_freq "frequency" NOT NULL, + pay_interest_calc_method "interest_calc_method" NOT NULL, commited bool NOT NULL default False, ); -CREATE TABLE public.citco_trs ( +CREATE TABLE citco_trs ( id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, dealid text NULL GENERATED ALWAYS AS ('TRS'::text || id::text) STORED, instrument_type "instrument_type" NOT NULL default 'TRS', birth_date date NOT NULL, death_date date NOT NULL, active bool NOT NULL default True, - funding_index public."cash_rate" NOT NULL DEFAULT 'SOFRRATE'::cash_rate, + funding_index "cash_rate" NOT NULL DEFAULT 'SOFRRATE'::cash_rate, buysell bool NOT NULL, underlying_security varchar(32) NOT NULL, price numeric(9, 5) NOT NULL, accrued float8 NOT NULL, - funding_freq public."frequency" NOT NULL, - funding_daycount public."day_count" NULL, - funding_payment_roll_convention public."bus_day_convention" NOT NULL, + funding_freq "frequency" NOT NULL, + funding_daycount "day_count" NULL, + funding_payment_roll_convention "bus_day_convention" NOT NULL, funding_arrears bool NOT NULL, - asset_freq public."frequency" NOT NULL, - asset_daycount public."day_count" NULL, - asset_payment_roll_convention public."bus_day_convention" NOT NULL, + asset_freq "frequency" NOT NULL, + asset_daycount "day_count" NULL, + asset_payment_roll_convention "bus_day_convention" NOT NULL, initial_margin_percentage float8 NOT NULL, notional float8 NOT NULL, - "currency" public."currency" NOT NULL DEFAULT 'USD'::currency, - "interest_calc_method" public."interest_calc_method" NOT NULL, - compound_avg_frequency public."frequency" NOT NULL, - fixing_frequency public."frequency" NOT NULL, + "currency" "currency" NOT NULL DEFAULT 'USD'::currency, + "interest_calc_method" "interest_calc_method" NOT NULL, + compound_avg_frequency "frequency" NOT NULL, + fixing_frequency "frequency" NOT NULL, commited bool NOT NULL default False ); -CREATE TABLE public.citco_mapping ( +CREATE TABLE citco_mapping ( "enum" text NOT NULL, "mapping" text NOT NULL, CONSTRAINT citco_mapping_un UNIQUE (enum, mapping) ); -CREATE TABLE public.qf_bespokes ( +CREATE TABLE qf_bespokes ( "date" date NOT NULL, "row" int8 NOT NULL, tradeid text NULL, @@ -3296,7 +3296,7 @@ CREATE TABLE public.qf_bespokes ( CONSTRAINT qf_bespokes_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_bondbetas ( +CREATE TABLE qf_bondbetas ( "date" date NOT NULL, "row" int8 NOT NULL, productname text NULL, @@ -3306,7 +3306,7 @@ CREATE TABLE public.qf_bondbetas ( CONSTRAINT qf_bondbetas_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_bonds ( +CREATE TABLE qf_bonds ( "date" date NOT NULL, "row" int8 NOT NULL, productname text NULL, @@ -3326,7 +3326,7 @@ CREATE TABLE public.qf_bonds ( CONSTRAINT qf_bonds_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_cdx ( +CREATE TABLE qf_cdx ( "date" date NOT NULL, "row" int8 NOT NULL, productname text NULL, @@ -3346,7 +3346,7 @@ CREATE TABLE public.qf_cdx ( CONSTRAINT qf_cdx_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_cdxoption ( +CREATE TABLE qf_cdxoption ( "date" date NOT NULL, "row" int8 NOT NULL, productname text NULL, @@ -3369,7 +3369,7 @@ CREATE TABLE public.qf_cdxoption ( CONSTRAINT qf_cdxoption_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_cdxqf ( +CREATE TABLE qf_cdxqf ( "date" date NOT NULL, "row" int8 NOT NULL, tradeid text NULL, @@ -3393,7 +3393,7 @@ CREATE TABLE public.qf_cdxqf ( CONSTRAINT qf_cdxqf_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_cdxtranche ( +CREATE TABLE qf_cdxtranche ( "date" date NOT NULL, "row" int8 NOT NULL, productname text NULL, @@ -3415,7 +3415,7 @@ CREATE TABLE public.qf_cdxtranche ( CONSTRAINT qf_cdxtranche_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_fxforwards ( +CREATE TABLE qf_fxforwards ( "date" date NOT NULL, "row" int8 NOT NULL, tradeid text NULL, @@ -3429,7 +3429,7 @@ CREATE TABLE public.qf_fxforwards ( CONSTRAINT qf_fxforwards_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_hvardata ( +CREATE TABLE qf_hvardata ( "date" date NOT NULL, "row" text NOT NULL, tradeid text NULL, @@ -3441,7 +3441,7 @@ CREATE TABLE public.qf_hvardata ( CONSTRAINT qf_hvardata_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_hvardatacdxoptions ( +CREATE TABLE qf_hvardatacdxoptions ( "date" date NOT NULL, "row" int8 NOT NULL, tradeid text NULL, @@ -3453,7 +3453,7 @@ CREATE TABLE public.qf_hvardatacdxoptions ( CONSTRAINT qf_hvardatacdxoptions_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_indicatives ( +CREATE TABLE qf_indicatives ( "date" date NOT NULL, "row" int8 NOT NULL, productname text NULL, @@ -3468,7 +3468,7 @@ CREATE TABLE public.qf_indicatives ( CONSTRAINT qf_indicatives_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_jtd ( +CREATE TABLE qf_jtd ( "date" date NOT NULL, "row" int8 NOT NULL, referenceentity_longname text NULL, @@ -3480,7 +3480,7 @@ CREATE TABLE public.qf_jtd ( CONSTRAINT qf_jtd_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_pnlexplainbytrade ( +CREATE TABLE qf_pnlexplainbytrade ( "date" date NOT NULL, "row" int8 NOT NULL, tradeid text NULL, @@ -3529,7 +3529,7 @@ CREATE TABLE public.qf_pnlexplainbytrade ( CONSTRAINT qf_pnlexplainbytrade_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_proxies ( +CREATE TABLE qf_proxies ( "date" date NOT NULL, "row" int8 NOT NULL, tradeid text NULL, @@ -3544,7 +3544,7 @@ CREATE TABLE public.qf_proxies ( CONSTRAINT qf_proxies_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_ratefutures ( +CREATE TABLE qf_ratefutures ( "date" date NOT NULL, "row" text NOT NULL, bookingentity_name text NULL, @@ -3557,7 +3557,7 @@ CREATE TABLE public.qf_ratefutures ( CONSTRAINT qf_ratefutures_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_sensitivities ( +CREATE TABLE qf_sensitivities ( "date" date NOT NULL, "row" int8 NOT NULL, tradeid text NULL, @@ -3584,7 +3584,7 @@ CREATE TABLE public.qf_sensitivities ( CONSTRAINT qf_sensitivities_pk PRIMARY KEY (date, "row") ); -CREATE TABLE public.qf_swaptions ( +CREATE TABLE qf_swaptions ( "date" date NOT NULL, "row" int8 NOT NULL, tradeid text NULL, |
