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).
Core equity coverage: US, Japan, Hong Kong, China A-shares, and Korea. Tickers are US bare (AAPL), Japan .T (6758.T), Hong Kong .HK (00700.HK), A-shares .SH/.SZ (600519.SH), and Korea .KS/.KQ (005930.KS). financial_statements, company_snapshot, and price_volume_history span all five. Specialized tables may be narrower — call get_table_schema before treating an empty result as a finding.
Tables by domain (call get_table_schema for detail):
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 |