diff --git a/server/tables.sql b/server/tables.sql index c9fc63f..7d641cd 100644 --- a/server/tables.sql +++ b/server/tables.sql @@ -23,6 +23,21 @@ CREATE TABLE option_contract_existences ENGINE ReplacingMergeTree() PRIMARY KEY (asOfDate, symbol) ORDER BY (asOfDate, symbol, expirationDate, strike, type); +CREATE MATERIALIZED VIEW option_contract_existences_mv TO option_contract_existences +AS +SELECT + toDate(tsStart) as asOfDate, + symbol, + expirationDate, + strike, + type +FROM option_contract_aggregates +GROUP BY + asOfDate, + symbol, + expirationDate, + strike, + type; CREATE TABLE option_contracts (