-- Analytical fact table: trade_signals
-- Aggregated trend signals and recommendation actions.
-- Partitioned by dt on MinIO.
-- Path: s3://stonks-lakehouse/warehouse/trade_signals/dt={yyyy-mm-dd}/part-*.parquet
-- Requirements: 6.1, 6.2, 6.4, 6.5, 7.1, 9.4, 9.5, 10.1
-- Design ref: Section 6.4, Section 6.5, Section 7 (lake.trade_signals)

CREATE TABLE IF NOT EXISTS lakehouse.stonks.trade_signals (
    signal_id             VARCHAR,
    ticker                VARCHAR,
    trend_direction       VARCHAR,
    trend_strength        DOUBLE,
    confidence            DOUBLE,
    contradiction_score   DOUBLE,
    dominant_catalysts    VARCHAR,
    material_risks        VARCHAR,
    action                VARCHAR,
    time_horizon          VARCHAR,
    recommendation_id     VARCHAR,
    generated_at          TIMESTAMP(6) WITH TIME ZONE,
    dt                    DATE
) WITH (
    format = 'PARQUET',
    partitioned_by = ARRAY['dt'],
    external_location = 's3a://stonks-lakehouse/warehouse/trade_signals/'
);
