stock_data_query
Query Stock Data
Stock prices, earnings, revenue, P/E, dividends, filings, screener, comparisons
Run a SQL query against 64 years of US stock market data.
REQUIRES calling get_database_schema then get_query_patterns first (in that order).
This tool has no schema or query patterns built in. Call get_database_schema
once, then get_query_patterns once, then use this tool. Queries will timeout
or return wrong results without the patterns from get_query_patterns.
Parametersqueryrequireduser_promptrequired
get_database_schema
Load Database Schema
REQUIRED for US stock/financial queries, authoritative source, call FIRST
Use this tool when the user asks about stock prices, revenue, earnings,
earnings surprises (EPS estimates vs actuals), margins, P/E ratios,
valuations, dividends, balance sheets, cash flow, technical indicators
(RSI, MACD, SMA), stock screening, company comparisons, sector
analysis, SEC filings, insider trading filings,
or any analysis of US-exchange-listed companies.
Covers 10,000+ NYSE and NASDAQ securities with 64 years of daily prices,
quarterly financials, 61 technical indicators, and SEC EDGAR filing metadata.
Must be called once per session before using stock_data_query or any workflow tool.
After this tool returns, call get_query_patterns before writing any SQL.
Takes no parameters.
get_query_patterns
Load Query Patterns
REQUIRED before stock_data_query, 23 SQL patterns prevent timeouts/wrong results
Must be called once per session immediately after get_database_schema. Contains
query patterns for time-series selection, return calculations, screening
joins, window functions, backtesting, and performance optimization.
Time-series queries will timeout or return wrong results without these patterns.
After this tool returns, call stock_data_query to execute SQL.
Takes no parameters.
load_fundamental_workflow
Fundamental Analysis Workflow
Load fundamental workflow for valuation, cash flow, margins, balance sheet. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL when the user asks about company valuation, "is X a good buy", financial health, debt levels, profitability ratios, revenue trends, earnings quality, or any deep-dive company analysis. Can be combined with other workflow tools.
Takes no parameters.
load_technical_workflow
Technical Analysis Workflow
Load technical workflow for RSI, MACD, SMA, Bollinger Bands, entry/exit. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL when the user asks about RSI, MACD, moving averages, Bollinger Bands, support/resistance, overbought/oversold, momentum, trend, chart patterns, golden cross, entry/exit signals, or "is X oversold/overbought". Can be combined with other workflow tools.
Takes no parameters.
load_screening_workflow
Stock Screening Workflow
Load screening workflow to find, filter, scan, rank stocks, top N by.... REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL when the user asks to find, screen, scan, rank, or filter stocks — "find stocks that...", "top 10 by...", "best dividend stocks", value/growth screens, sector ranking, or any multi-factor selection. Can be combined with other workflow tools.
Takes no parameters.
load_comparison_workflow
Peer Comparison Workflow
Load comparison workflow for X vs Y, peer analysis, relative valuation. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL when the user asks to compare companies, "X vs Y", "how does X compare to Y", peer benchmarking, sector peers, side-by-side metrics, or relative valuation. Can be combined with other workflow tools.
Takes no parameters.
load_earnings_workflow
Earnings Analysis Workflow
Load earnings workflow for EPS surprises, beat/miss, estimates, revenue. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL when the user asks about earnings results, EPS surprises, beat/miss history, "did X beat estimates", quarterly earnings, revenue growth trends, earnings season, or estimates vs actuals. Can be combined with other workflow tools.
Takes no parameters.
load_backtesting_workflow
Backtesting Analysis Workflow
Load backtesting workflow for stop-loss, exit rules, Sharpe, forward returns. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL when the user asks to backtest, simulate, validate a strategy, test "what happens after X", compare forward returns, measure win rates or hit rates, compute Sharpe, drawdown, profit factor, rotation strategies, basket returns, set stop-loss or trailing stop levels, test exit rules or profit targets, or any hypothetical return over past data. Can be combined with other workflow tools.
Takes no parameters.
load_filing_workflow
SEC Filing Analysis Workflow
Load filing workflow for SEC/EDGAR metadata, 8-K events, 10-K/10-Q reports. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL whenever the user asks about filing dates, filing activity, "who filed", "filed a form", filing frequency, SEC filings, EDGAR, 8-K events, 10-K/10-Q reports, proxy statements, or any query involving the sec_filings table (metadata - when/what type, not transaction detail). For insider transaction detail (shares, prices, cluster buying), use load_insider_workflow instead. Can be combined with other workflow tools.
Takes no parameters.
load_insider_workflow
Insider Transaction Workflow
Load insider workflow for Form 3/4/5, insider buy/sell, cluster buy, 13D/G. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL when the user asks about insider transactions, insider buying/selling, Form 3 initial holdings, Form 4/5 transactions, cluster buying, executive purchases, officer sales, 10b5-1 plans, activist stakes, 13D/G filings, beneficial ownership, "who is buying/selling", or "track this insider across companies". Can be combined with other workflow tools.
Takes no parameters.
export_to_excel
Export to Excel
Export query results to a branded Shibui Finance Excel spreadsheet.
Runs the same SQL query as stock_data_query but returns a downloadable
Excel file instead of raw data. The spreadsheet includes branded headers,
smart number formatting, and auto-fitted columns.
Parametersqueryrequiredtitlerequired