diff options
| -rw-r--r-- | sql/dawn.sql | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 44bfe349..4e76d6b6 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -3179,28 +3179,35 @@ CREATE TYPE exercise_type AS ENUM ('European', 'American'); CREATE TYPE equity_option_strat AS ENUM ('VOLRV'); -CREATE TABLE equity_options ( - id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, +CREATE TABLE equityoptions ( + id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY, dealid varchar(28) NULL GENERATED ALWAYS AS ((('EQOPT_'::text || id::text))) STORED, - fund fund NOT NULL, + "fund" "fund" NOT NULL, lastupdate timestamp NULL DEFAULT now(), - action action NOT NULL, - portfolio portfolio NOT NULL, - folder text NOT NULL, - cash_account text NOT NULL REFERENCES accounts2(cash_account) ON UPDATE CASCADE, - cp_code text NOT NULL REFERENCES counterparties(code) ON UPDATE CASCADE, + "action" "action" NOT NULL, + "portfolio" "portfolio" NOT NULL, + folder text NOT NULL, + cash_account text NOT NULL, + cp_code text NOT NULL, trade_date date NOT NULL, settle_date date NOT NULL, - expiration_date date NOT NULL, + expiration_date date NOT NULL, buysell bool NOT NULL, - quantity float NOT NULL, - bbg_ticker text NOT NULL, + quantity float8 NOT NULL, + identifier text NOT NULL, putcall bool NOT NULL, - strike float NOT NULL, - exercise_type exercise_type NOT NULL, - price float NOT NULL, - "currency" currency NOT NULL, - clearing_facility text NULL + strike float8 NOT NULL, + exercise_type exercise_type NOT NULL, + price float8 NOT NULL, + "currency" "currency" NOT NULL, + clearing_facility text NULL, + "settlement_type" "settlement_type" NOT NULL, + initial_margin_percentage float8 NULL, + cpty_id text NULL, + figi text NULL, + CONSTRAINT equity_options2_pkey PRIMARY KEY (id), + CONSTRAINT equity_options2_cash_account_fkey FOREIGN KEY (cash_account) REFERENCES public.accounts2(cash_account) ON UPDATE CASCADE, + CONSTRAINT equity_options2_cp_code_fkey FOREIGN KEY (cp_code) REFERENCES public.counterparties(code) ON UPDATE CASCADE ); CREATE TABLE bond_tickets ( |
