diff options
| -rw-r--r-- | sql/dawn.sql | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 4da7a9f0..3332b305 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -3173,28 +3173,32 @@ CREATE TABLE equities ( CONSTRAINT equities_account_code_fkey FOREIGN KEY (account_code) REFERENCES accounts(code) ); -CREATE TABLE equity_options ( - id serial4 NOT NULL, - dealid varchar(28) NULL GENERATED ALWAYS AS ((('EQOPT'::text || id::text))) STORED, +CREATE TYPE exercise_type AS ENUM ('European', 'American'); + +CREATE TYPE equity_option_strat AS ENUM ('VOLRV'); + +CREATE TABLE equity_options2 ( + id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + dealid varchar(28) NULL GENERATED ALWAYS AS ((('EQOPT_'::text || id::text))) STORED, + fund fund NOT NULL, lastupdate timestamp NULL DEFAULT now(), - "action" action NOT NULL, - folder future_strat NOT NULL, + 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, trade_date date NOT NULL, settle_date date NOT NULL, + expiration_date date NOT NULL, buysell bool NOT NULL, - bbg_ticker varchar(32) NOT NULL, - quantity float8 NOT NULL, + notional float NOT NULL, + bbg_ticker text NOT NULL, option_type equity_option_type NOT NULL, - price float8 NOT NULL, - commission float8 NULL, - security_desc varchar(32) NOT NULL, + strike float NOT NULL, + exercise_type exercise_type NOT NULL, + price float NOT NULL, "currency" currency NOT NULL, - exchange varchar(3) NOT NULL, - "fund" fund NOT NULL DEFAULT 'SERCGMAST'::fund, - 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 accounts(code) + clearing_facility text NULL ); CREATE TABLE bond_tickets ( |
