-- Analytical fact table: trade_orders -- Order submission records for paper and live trading. -- Partitioned by dt on MinIO. -- Path: s3://stonks-lakehouse/warehouse/trade_orders/dt={yyyy-mm-dd}/part-*.parquet -- Requirements: 8.3, 9.4, 9.5, 10.1, 10.3 -- Design ref: Section 7 (lake.trade_orders) CREATE TABLE IF NOT EXISTS lakehouse.stonks.trade_orders ( order_id VARCHAR, recommendation_id VARCHAR, ticker VARCHAR, side VARCHAR, order_type VARCHAR, quantity DOUBLE, limit_price DOUBLE, status VARCHAR, execution_mode VARCHAR, broker_account VARCHAR, submitted_at TIMESTAMP(6) WITH TIME ZONE, dt DATE ) WITH ( format = 'PARQUET', partitioned_by = ARRAY['dt'], external_location = 's3a://stonks-lakehouse/warehouse/trade_orders/' );