-- 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.status_snapshots
(
    `ts` DateTime64(3, 'UTC'),
    `capital` Float64,
    `roi_pct` Float32,
    `dd_pct` Float32,
    `trades_executed` UInt16,
    `posture` LowCardinality(String),
    `rm` Float32,
    `vel_div` Float32,
    `vol_ok` UInt8,
    `phase` LowCardinality(String),
    `mhs_status` LowCardinality(String),
    `boost` Float32,
    `cat5` Float32,
    `conviction_multiplier` Float32 DEFAULT 0,
    `exchange_leverage` UInt8 DEFAULT 0,
    `exchange_leverage_mode` LowCardinality(String) DEFAULT '',
    `leverage_mapping_rule` LowCardinality(String) DEFAULT '',
    `account_capital` Float64 DEFAULT 0,
    `portfolio_capital` Float64 DEFAULT 0,
    `current_open_notional` Float64 DEFAULT 0,
    `current_account_leverage` Float32 DEFAULT 0,
    `remaining_notional_capacity` Float64 DEFAULT 0,
    `max_account_leverage` Float32 DEFAULT 0,
    `ledger_authority` LowCardinality(String) DEFAULT '',
    `capital_source` LowCardinality(String) DEFAULT '',
    `account_event_seq` UInt64 DEFAULT 0
)
ENGINE = MergeTree
ORDER BY ts
TTL toDateTime(ts) + toIntervalDay(180)
SETTINGS index_granularity = 8192;
