-- Analytical fact table: pnl_daily
-- Partitioned by dt on MinIO

CREATE TABLE IF NOT EXISTS lakehouse.stonks.pnl_daily (
    ticker            VARCHAR,
    realized_pnl      DOUBLE,
    unrealized_pnl    DOUBLE,
    total_pnl         DOUBLE,
    broker_account    VARCHAR,
    dt                DATE
) WITH (
    format = 'PARQUET',
    partitioned_by = ARRAY['dt'],
    external_location = 's3a://stonks-lakehouse/warehouse/pnl_daily/'
);
