aboutsummaryrefslogtreecommitdiffstats
path: root/sql/serenitasdb.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/serenitasdb.sql')
-rw-r--r--sql/serenitasdb.sql13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/serenitasdb.sql b/sql/serenitasdb.sql
index 4566d61e..8c073703 100644
--- a/sql/serenitasdb.sql
+++ b/sql/serenitasdb.sql
@@ -801,3 +801,16 @@ CREATE TABLE swaption_vol_cube(
cube bytea NOT NULL,
source vol_source,
UNIQUE (date, vol_source))
+
+CREATE OR REPLACE VIEW public.on_the_run AS
+ SELECT DISTINCT ON (index_quotes.date, index_quotes.index) index_quotes.date,
+ index_quotes.index,
+ index_quotes.series,
+ index_quotes.version,
+ index_quotes.duration,
+ index_quotes.theta,
+ index_quotes.closeprice,
+ index_quotes.closespread
+ FROM index_quotes
+ WHERE index_quotes.tenor = '5yr'::tenor
+ ORDER BY index_quotes.date, index_quotes.index, index_quotes.series DESC, index_quotes.version;