-- dolphin_violet DDL — consolidated from the LIVE dolphin_pink schema
-- (post-ALTER: includes maras_tp + provenance columns). Generated 2026-06-12.
-- Apply via apply_violet_ddl.py (one statement per HTTP POST).

CREATE TABLE IF NOT EXISTS dolphin_violet.sc_bucket_gauge_shadow
(
    `ts` DateTime64(6, 'UTC'),
    `ts_day` Date MATERIALIZED toDate(ts),
    `strategy` LowCardinality(String),
    `trade_id` String,
    `asset` LowCardinality(String),
    `bucket_id` UInt8,
    `scan_number` UInt32,
    `bar_idx` UInt32,
    `sc` Float32,
    `current_mult` Float32,
    `recommended_size_mult` Float32,
    `recommended_tp_mult` Float32,
    `recommended_hold_mult` Float32,
    `recommended_sc_cut` Float32,
    `current_label` LowCardinality(String),
    `recommended_label` LowCardinality(String),
    `confidence` Float32,
    `model_score` Float32,
    `current_score` Float32,
    `vel_div` Float32,
    `exf_signal` Float32,
    `exf_funding` Float32,
    `exf_dvol` Float32,
    `exf_fear_greed` Float32,
    `exf_taker` Float32,
    `obf_spread_bps` Float32,
    `obf_depth_1pct_usd` Float32,
    `obf_depth_quality` Float32,
    `obf_fill_probability` Float32,
    `obf_imbalance` Float32,
    `obf_agreement_pct` Float32,
    `obf_regime_signal` Float32,
    `recent_trade_count` UInt16,
    `recent_win_rate` Float32,
    `recent_avg_pnl_pct` Float32,
    `recent_loss_streak` UInt16,
    `context_json` String,
    `outcome_json` String
)
ENGINE = MergeTree
ORDER BY (ts_day, strategy, asset, ts)
TTL ts_day + toIntervalDay(120)
SETTINGS index_granularity = 8192;
