Files
sentiment-engine/prod/clickhouse/uv/04_stop_watch_events.sql

26 lines
781 B
MySQL
Raw Normal View History

-- UV shadow stop-watcher events — C11 overshoot ledger
-- READ-ONLY wrt BLUE sources. INSERT only via StopWatcher.
-- Namespace: dolphin_uv ONLY.
CREATE TABLE IF NOT EXISTS dolphin_uv.stop_watch_events
(
`ts` DateTime64(3, 'UTC'),
`trade_id` String,
`asset` LowCardinality(String),
`side` LowCardinality(String),
`entry_price` Float64,
`breach_price` Float64,
`adverse_pct` Float32,
`spread_bps` Float32,
`depth_1pct_usd` Float64,
`obf_lag_ms` Float32,
`kind` LowCardinality(String),
`escalation_step` UInt16 DEFAULT 0,
`resolved_exit_adverse_pct` Float32 DEFAULT 0,
`resolved_excess_vs_contract` Float32 DEFAULT 0
)
ENGINE = MergeTree
PARTITION BY toYYYYMM(ts)
ORDER BY (ts, trade_id)
SETTINGS index_granularity = 8192;