aboutsummaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/serenitasdb.sql28
1 files changed, 27 insertions, 1 deletions
diff --git a/sql/serenitasdb.sql b/sql/serenitasdb.sql
index 2716cba6..6c8bfdd8 100644
--- a/sql/serenitasdb.sql
+++ b/sql/serenitasdb.sql
@@ -81,6 +81,7 @@ CREATE TABLE quotes (
);
CREATE TABLE tranche_quotes (
+ id serial PRIMARY KEY,
QuoteDate timestamptz,
Index index_type,
Series smallint,
@@ -102,9 +103,11 @@ CREATE TABLE tranche_quotes (
CorrAtDetachment real,
Basis real,
QuoteSource varchar(4),
- PRIMARY KEY(QuoteDate, Index, Series, Version, Tenor, Attach, Detach, QuoteSource, trancherunningmid)
);
+CREATE INDEX tranche_quotes_idx ON
+tranche_quotes(index, series, DATE(quotedate AT TIME ZONE 'localtime'), tenor, attach ASC)
+
GRANT ALL ON quotes TO serenitas_user;
GRANT ALL ON tranche_quotes TO serenitas_user;
@@ -476,6 +479,29 @@ CREATE TABLE risk_numbers(
el float[],
PRIMARY KEY(date, index, series, tenor));
+CREATE TABLE risk_numbers_new(
+ id serial PRIMARY KEY,
+ tranche_id integer REFERENCES tranche_quotes(id),
+ date date,
+ index index_type,
+ series integer,
+ tenor tenor,
+ index_price float,
+ index_basis float,
+ "index_EL" float,
+ index_duration float,
+ index_theta float,
+ attach smallint,
+ detach smallint,
+ corr_at_detach float,
+ delta float,
+ forward_delta float,
+ gamma float,
+ theta float,
+ corr01 float,
+ duration float,
+ "EL" float);
+
GRANT ALL ON risk_numbers to serenitas_user;