NexusTrade guides

Query market data in Python

Run bounded read-only market-data SQL and stream durable results with the NexusTrade lake extra.

Install the lake extra

Use a registered API key with lake scope. Install nexustrade[lake] for the DuckDB and pandas analysis helpers. The base SDK is standard-library-only; these analysis dependencies are optional.

shell
pip install 'nexustrade[lake]'

Run the query and read its results

Use the logical lake schema, bound parameters, explicit row limits and a bounded date range for substantial queries. The example below comes from the published SDK contract. Results are durable Parquet parts rather than an implicit unbounded array.

python
import nexustrade as nt

result = nt.lake.sql(
    "SELECT ticker, date, closingPrice FROM lake.daily_ohlc WHERE ticker = ?",
    ["AAPL"],
    max_rows=10_000,
)
frame = result.to_pandas()             # memory-bounded
for batch in result.iter_batches():    # or stream within your own budget
    ...

Save the query and result manifest

The DataFrame should contain ticker, date and closingPrice columns. Inspect its row count and dates before analysis. An empty frame means no returned matches; it does not prove the price is zero or the company has no history. If authentication fails, check that the runtime key has lake scope. Record the query operation and manifest alongside exported results. Check schema and result-part checksums before reuse. Snapshot freshness and public availability depend on the dataset, not merely the time a query finished.

A SQL operation is read-only but running a query can consume compute. It does not place orders, deploy a portfolio, or publish your workspace.

Continue exploring