add materialized view to keep individual contract existences
This commit is contained in:
@@ -23,6 +23,21 @@ CREATE TABLE option_contract_existences
|
|||||||
ENGINE ReplacingMergeTree()
|
ENGINE ReplacingMergeTree()
|
||||||
PRIMARY KEY (asOfDate, symbol)
|
PRIMARY KEY (asOfDate, symbol)
|
||||||
ORDER BY (asOfDate, symbol, expirationDate, strike, type);
|
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
|
CREATE TABLE option_contracts
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user