aboutsummaryrefslogtreecommitdiffstats
path: root/sql/dawn.sql
blob: d17e6627559daf65f6a3f69d09598d576af9a92b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- -*- mode: sql; sql-product: postgres; -*-
CREATE TYPE bonds_strat AS ENUM('M_STR_MAV', 'M_STR_SMEZZ', 'CSO_TRANCH',
       'M_CLO_BB20', 'M_CLO_AAA', 'M_CLO_BBB', 'M_MTG_IO', 'M_MTG_THRU',
       'M_MTG_GOOD', 'M_MTG_B4PR', 'M_MTG_RW');

CREATE TYPE asset_class AS ENUM('CSO', 'Subprime', 'CLO', 'Tranches', 'Futures', 'Cash', 'FX', 'Cleared');

CREATE TABLE counterparties(code text primary key,
       name text,
       location text,
       dtc_number integer,
       sales_contact text,
       email1 text,
       phone text,
       valuation_contact1 text,
       valuation_email1 text,
       valuation_contact2 text,
       valuation_email2 text,
       valuation_contact3 text,
       valuation_email3 text,
       notes text);

CREATE INDEX ON counterparties(name);

CREATE TABLE bonds(id serial primary key,
       trade_date date,
       settle_date date,
       cusip varchar(9),
       isin varchar(12),
       description text,
       notional float,
       price float,
       counterparty text references counterparties(code),
       strategy bonds_start,
       account text
       acc_int float,
       asset_class );