-- 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.fee_settled_events
(
    `ts` DateTime64(6, 'UTC'),
    `trade_id` String DEFAULT '',
    `fee` Float64 DEFAULT 0,
    `fee_asset` LowCardinality(String) DEFAULT 'USDT',
    `fee_source` LowCardinality(String) DEFAULT 'WS_SETTLED',
    `is_maker` UInt8 DEFAULT 0,
    `exchange_ts` Int64 DEFAULT 0,
    `realized_pnl_delta` Float64 DEFAULT 0,
    `runtime_namespace` LowCardinality(String) DEFAULT '',
    `strategy` LowCardinality(String) DEFAULT ''
)
ENGINE = MergeTree
PARTITION BY toYYYYMM(ts)
ORDER BY (trade_id, ts)
SETTINGS index_granularity = 8192;
