clickhouse: commit exit-leg/reconstruction/maras DDLs + UV/violet DDLs (M1 vendor reconcile, upstream-first)
This commit is contained in:
23
prod/clickhouse/violet/30_violet_economics.sql
Normal file
23
prod/clickhouse/violet/30_violet_economics.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- VIOLET PASS9: economics/observability — exactly-one-row-per-event sink.
|
||||
-- Columns match EconomicsRow field set (asserted by test_violet_economics_sink).
|
||||
-- ReplacingMergeTree keyed on (session_id, event_seq) so a re-emit collapses to
|
||||
-- ONE row — the PINK duplicate-emission debt, paid down.
|
||||
-- wait_for_async_insert=1 on the economics write path (set in the sink).
|
||||
-- Apply via apply_violet_ddl.py (one statement per HTTP POST).
|
||||
|
||||
CREATE TABLE IF NOT EXISTS dolphin_violet.violet_economics
|
||||
(
|
||||
`session_id` String,
|
||||
`event_seq` UInt64,
|
||||
`asset` LowCardinality(String),
|
||||
`realized_pnl` Float64,
|
||||
`fee` Float64,
|
||||
`capital_after` Float64,
|
||||
`pnl_source` LowCardinality(String),
|
||||
`capital_source` LowCardinality(String),
|
||||
`ts` DateTime64(3, 'UTC'),
|
||||
`mono_ns` UInt64
|
||||
)
|
||||
ENGINE = ReplacingMergeTree
|
||||
ORDER BY (session_id, event_seq, ts)
|
||||
TTL toDate(ts) + toIntervalDay(180);
|
||||
19
prod/clickhouse/violet/31_violet_decision_divergence.sql
Normal file
19
prod/clickhouse/violet/31_violet_decision_divergence.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- VIOLET PASS9: per-factor VIOLET-vs-BLUE decision divergence monitor (v2).
|
||||
-- One row per (asset, factor, event_seq). Extends the V1 feed-divergence
|
||||
-- idea to the factor plane (boost/beta/mc_scale/esof/ob/dc/posture etc.).
|
||||
-- Columns match DecisionDivergenceRow field set (asserted by test).
|
||||
-- Apply via apply_violet_ddl.py (one statement per HTTP POST).
|
||||
|
||||
CREATE TABLE IF NOT EXISTS dolphin_violet.violet_decision_divergence
|
||||
(
|
||||
`ts` DateTime64(3, 'UTC'),
|
||||
`asset` LowCardinality(String),
|
||||
`factor` LowCardinality(String),
|
||||
`violet_value` Float64,
|
||||
`blue_value` Float64,
|
||||
`abs_err` Float64,
|
||||
`event_seq` UInt64
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY (asset, factor, ts)
|
||||
TTL toDate(ts) + toIntervalDay(180);
|
||||
Reference in New Issue
Block a user