SynRae

Ask Claude

Describe the data you want. Claude generates a read-only SQL query against SynRae Postgres.

Prompting guide — tables, columns, examples

Claude does not read the live schema. It gets a short table list plus the latest as_of_date per collector, so name the table and columns yourself.

Structure of a prompt

  1. Table — the exact Postgres name from the catalog below.
  2. Slice — latest snapshot, a date range, a symbol, a list letter.
  3. Columns — what you want on screen. Skip this and Claude guesses.
  4. Sort / limit — e.g. top 20 by capital_total descending.

Say “latest snapshot” or “most recent as_of_date”, never “today”. Jobs finish after midnight or only on weekends, so the calendar date is often empty and Claude is blocked from using CURRENT_DATE.

One table per prompt unless you need a join. If you join, name both tables and both ticker columns — they are not all called symbol. Only SELECT and WITH … SELECT run. Saving a view stores the SQL from the first successful run; re-running a view does not call Claude again.

Ticker columns

Column Tables
symbol barchart_quotes, barchart_option_expiry_stats, barchart_watchlist_snapshots, barchart_combined_views, scanner_results
stock_symbol futu_capital_distribution, futu_capital_collection_outcomes, estimize_estimates, estimize_differences, quiver_congress_trades, quiver_trade_stats
ticker finviz_insider_trades

as_of_date is the collection day, not the event day. Event dates live in trade_date, expiry_date, and update_time.

Use futu_capital_collection_outcomes to audit a capital run. Its run_id, status, reason_code, source_lists, and attempts explain whether and why each expected unique stock was collected or unavailable.

Examples

Latest Futu capital distribution snapshot. Columns: stock_symbol, list_letter, as_of_hour, last_price, capital_total, capital_super_total, capital_big_total, capital_mid_total, capital_small_total. Sort by capital_total descending. Limit 30.
Most recent Finviz insider trades. Columns: ticker, owner, relationship, trade_date, transaction, value_usd. Filter transaction to Buy. Sort by ticker.
Latest Quiver congress trades from quiver_congress_trades only (do not use quiver_trade_stats). Columns: stock_symbol, source_type, name, trade_date, amount, transaction. Sort by trade_date descending.
Latest Estimize estimates for AAPL. Columns: value_source, value_type, period_label, value. Order by value_type, period_label.
Latest barchart_combined_views. Columns: symbol, name, pct_chg, vol_pct_chg, sales_q, pe_fwd. Filter pct_chg > 5. Sort by pct_chg descending.

Table catalog

futu_capital_distribution

Futu OpenD capital distribution + market snapshot. Jobs futu_capital_* weekdays at 10:01, 12:01, 14:01, 16:01. Universe: list futu (merged former A–E lists). Ticker: stock_symbol. One row per (stock_symbol, as_of_date, as_of_hour).

Column Meaning
list_letter F for the consolidated futu list (older rows may still be A–E)
last_price, price_change, volume Snapshot at pull time. price_change is last minus previous close, absolute not percent
capital_in_super/big/mid/small Inflow per size bucket
capital_out_super/big/mid/small Outflow per size bucket
capital_super_total, capital_big_total, capital_mid_total, capital_small_total in − out per bucket
capital_total Sum of the four net buckets
update_time Futu timestamp on the flow row
as_of_hour Job clock hour: 10, 12, 14, 16

Ask for the latest hour of the latest date to get one row per symbol; otherwise you get every intraday slot.

finviz_insider_trades

finviz.com/insidertrading. Job finviz_scraper daily 5:00 PM. Ticker: ticker.

Column Meaning
trade_date Date shown on Finviz (text)
owner, relationship Insider and role
transaction Buy, Sale, and similar
cost, shares, value_usd, shares_total Stored as text, not numbers
sec_form4 Form 4 link or label
as_of_date, as_of_hour, scraped_at When we scraped the page
estimize_estimates

Estimize company pages, EPS and Revenue tabs. Job estimize_scraper daily 1:00 AM. Universe: estimize list, falling back to combined. Ticker: stock_symbol.

Column Values
value_source Estimize, Wall St, Actual
value_type EPS, Revenue
period_label Site period label, e.g. a quarter or fiscal year
value Parsed float, nullable
value_raw Original cell text
estimize_differences

Computed from the two most recent estimize_estimates dates. Job estimize_difference Saturday 9:30 AM. Ticker: stock_symbol.

Column Meaning
metric_key {value_type}:{period_label}:{value_source}, e.g. EPS:Q3 2026:Estimize
delta_value Newer scrape minus older; zero deltas are not stored
row_data JSON with newer, older, newer_date, older_date
as_of_date Day the difference job ran
quiver_congress_trades

Quiver Quant historical API. Job quiver_api Saturday 12:00 PM. Universe: iusg_iusv. Ticker: stock_symbol. Use this table for individual trades and do not ask for a UNION with quiver_trade_stats.

Column Meaning
source_type congresstrading, housetrading, senatetrading
name Politician
trade_date When they traded
amount Text, often a range
transaction Purchase, Sale, and similar
as_of_date Saturday scrape day
quiver_trade_stats

Aggregates from the same Quiver pull. Ticker: stock_symbol. One row per (stock_symbol, as_of_date, last_x_days) with windows 365, 180, 90, 60, 30 — name the window you want or you get five rows per symbol.

Column Meaning
sales_count, sales_total Trades whose transaction contains Sale
purchase_count, purchase_total Trades equal to Purchase
big_spenders Comma-separated names with amount over 250000
barchart_quotes

BarChart OnDemand getQuote. Job barchart_api weekdays 8:15 PM. Universe: biden + trump lists. Ticker: symbol.

Column Meaning
last_price, volume Quote at pull time
price_delta, change_pct Versus the previous stored quote day, which is not always calendar yesterday
barchart_option_expiry_stats

BarChart OnDemand equity options rolled up per expiry. Same job and universe as quotes. Ticker: symbol. One row per (as_of_date, symbol, expiry_date).

Column Meaning
put_volume, call_volume, volume_put_call_ratio Volume by side
put_open_interest, call_open_interest, open_interest_put_call_ratio Open interest by side
barchart_watchlist_snapshots

Selenium scrape of BarChart pages. Job barchart_watchlist daily 9:00 PM. Ticker: symbol, nullable. Raw scraped columns sit in row_data (JSONB) — say “use row_data JSON” if you need fields beyond the ones below.

view_name Page
watchlist_174327 Saved watchlist, also feeds barchart_combined_views
oi_increase_stocks Options open interest increase, stocks
oi_increase_etf Options open interest increase, ETFs
most_active_stocks Most active options, stocks
most_active_etfs Most active options, ETFs
barchart_combined_views

Flattened watchlist_174327 rows from the same watchlist job. Ticker: symbol. Prefer this over barchart_watchlist_snapshots for the main watchlist.

Column BarChart field
name Name
pct_chg %Chg
vol_pct_chg Vol %Chg
sales_q … sales_q3 Sales %(q) through %(q-3)
net_income_q, net_income_q1 Net Income %(q), %(q-1)
pe_fwd P/E fwd
row_data Full original row
scanner_results

barchart_combined_views filtered by filter_lists. Job custom_stock_scanner 11:59 PM. Ticker: symbol. Columns match combined views plus filter_name, which is “all” when no filter lists exist.

trading_economics_indicators

tradingeconomics.com US indicators. Job trading_economics daily 12:00 AM. Keyed by indicator, not a ticker.

Column Meaning
last_value, previous_value, highest, lowest Stored as text
unit, updated_label Site unit and updated cell
category Overview, GDP, Labour, Prices, Money, Trade, Government, Business, Consumer, Housing, Energy, Health
trading_economics_changes

Rows from the same job whose last_value moved against the previous scrape date. Columns: indicator, last_value, previous_value (the site’s previous on the new scrape, not always the old last), row_data.

symbol_lists

Ticker files under data/symbol_lists synced into Postgres. symbols is a text array.

name Used by
biden, trump BarChart quotes and options
combined Combined list; Estimize fallback
futu Futu capital pulls (consolidated; list_letter F)
iusg_iusv Quiver
finviz Finviz list
estimize Estimize scrape
te_green Trading Economics indicator names, not tickers
job_runs, saved_views, and others

job_runs logs every collector run: job_name, started_at, finished_at, status, error, rows_written — handy for checking whether a source has data yet. saved_views holds name, natural_language, sql_text, created_at. futu_removed_symbols, filter_lists, and symbol_list_changes exist in Postgres but are missing from Claude’s short schema, so name them explicitly if you query them.

Prompts that fail

  • “Today” or “this morning” without “latest as_of_date”, and for Futu the latest as_of_hour.
  • “Insider buys” without naming finviz_insider_trades and ticker.
  • Joins without the join key spelled out, e.g. quiver_congress_trades.stock_symbol = futu_capital_distribution.stock_symbol.
  • Mixing Quiver trades and Quiver stats in one query.
  • Sorting amount, value_usd, cost, or Trading Economics values numerically. They are text and often contain ranges or symbols.
  • Asking for “medium” Futu flow instead of capital_mid_total and capital_small_total.