run_sql
PostgreSQL SELECT over financial / market / alt-data tables — returns structured rows.
Hard rules (query fails otherwise):
SELECT only, no CTE (
WITH ... AS) — use subqueries.Period columns are TEXT, not dates —
period_endis 'YYYY-MM'. Compare as strings (period_end >= '2024-01'); a::datecast on it fails.Filter structured tables by ticker (
WHERE ticker IN ('AAPL','MSFT'); screening: addticker NOT LIKE '%-%'to drop preferred stock).
Tables by domain (get_table_schema gives columns + coverage note):
Market: price_volume_history (OHLCV history; MUST filter ticker + time_frame), index_price, equity_extended_rt (pre/after/overnight quotes)
Fundamentals: financial_statements (GAAP income/balance/cashflow), company_snapshot (ratios, per-share, growth)
Earnings: earning_call_summary, earning_call_calendar
Analyst: analyst_ratings, analyst_ratings_consensus
Ownership: insider_and_institution_activities
8-K events: executive_change, company_deal_events, debt_issuance, securities_offering
Executives: executive_profile, executive_compensation
Alt-data: macro / industry / trade / AI-supply-chain — call list_tables(categories=[...])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | PostgreSQL SELECT query |