-- Analytical fact table: market_quotes
-- Quote snapshots for tracked symbols.
-- Partitioned by dt (date) on MinIO.
-- Path: s3://stonks-lakehouse/warehouse/market_quotes/dt={yyyy-mm-dd}/part-*.parquet
-- Requirements: 2.1, 9.4, 9.5, 10.1
-- Design ref: Section 7 (lake.market_quotes)

CREATE TABLE IF NOT EXISTS lakehouse.stonks.market_quotes (
    ticker        VARCHAR,
    bid_price     DOUBLE,
    ask_price     DOUBLE,
    bid_size      BIGINT,
    ask_size      BIGINT,
    last_price    DOUBLE,
    last_size     BIGINT,
    source        VARCHAR,
    quote_at      TIMESTAMP(6) WITH TIME ZONE,
    dt            DATE
) WITH (
    format = 'PARQUET',
    partitioned_by = ARRAY['dt'],
    external_location = 's3a://stonks-lakehouse/warehouse/market_quotes/'
);
