-- Add intraday market data source (hourly bars via Polygon range endpoint).
-- The scheduler expands this into per-ticker jobs every 15 minutes.

INSERT INTO sources (source_type, source_name, config, active, company_id)
SELECT
    'market_api',
    'Polygon Intraday Hourly',
    '{"endpoint": "intraday_bars", "provider": "polygon", "timespan": "hour", "multiplier": 1, "adjusted": true, "polling_interval_seconds": 900}'::jsonb,
    true,
    NULL
WHERE NOT EXISTS (
    SELECT 1 FROM sources
    WHERE source_type = 'market_api'
      AND config->>'endpoint' = 'intraday_bars'
);
