run_sql
Execute a single read-only SQL SELECT across all China A-share datasets to compute rankings, aggregations, percentiles, and joins directly, avoiding row paging.
Instructions
One read-only DuckDB SELECT over every dataset, each exposed as a view under its own name. Use this for ranking, aggregation, percentiles and joins across datasets — computing them here is both correct and far cheaper than paging thousands of rows back and adding them up. daily_bars_adj is a ready-made view carrying hfq_open/high/low/close and open-lake qfq_* beside the raw columns; for a bounded historical qfq window use daily_bars_qfq(start_date, end_date) so the anchor matches that window. Prefer these over joining adj_factors yourself. Single SELECT only: no writes, DDL or multiple statements. For one symbol's bars use query_bars, and for plain dataset reads query_dataset.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single DuckDB SELECT. Table names are dataset names (see describe_lake). | |
| limit | No | Max rows to return (default 200, cap 2000). Responses always report the true total and set `truncated`. |