For the complete documentation index, see llms.txt. This page is also available as Markdown.

Querying Market SQL

How a Market SQL request works — choosing a dataset, writing the query, and choosing how results are returned.

A Market SQL request describes three things:

  1. the dataset to query,

  2. the SQL statement to run,

  3. and the format the results should be returned in.

This page explains those three choices. For the endpoint, parameters, limits, and the full table catalog, see the API Reference.

1. The dataset

The database parameter selects the dataset. Your API key must have an active trial or subscription for that dataset.

Dataset
Database name
Tables

solana

21

polymarket

3

hyperliquid

4

robinhood

25

The database parameter sets the default database for the request, so tables are referenced by name without a prefix: FROM pumpswap_all_swaps, not FROM solana.pumpswap_all_swaps.

2. The query

The request body is a single, read-only SQL statement written in ClickHouse SQL. You can filter with WHERE, aggregate with GROUP BY, sort, limit, and join tables within the same dataset.

SELECT block_time, direction, base_token, quote_token
FROM pumpswap_all_swaps
LIMIT 5;

Because filtering, aggregation, and joins run server-side, you receive only the rows your question needs rather than downloading raw records and processing them locally.

Execution limits

Every query runs within the execution limit of your access plan:

Plan
Concurrent queries
Execution limit

Free trial

1

10 seconds

24-hour trial

1

10 seconds

Monthly

Higher query limits

60 seconds

Custom

Custom query capacity

Custom

3. The result format

The default_format parameter sets how rows are returned. All examples in this documentation use JSONEachRow, which returns one JSON object per line:

A FORMAT clause at the end of the SQL statement takes precedence over default_format. The official ClickHouse clients set the format for you: @clickhouse/client through its format option, and clickhouse-connect through methods such as query_df.

Research, not live delivery

Next steps

  • API Reference — endpoint, authentication, parameters, and every table

  • Getting Started — activating a dataset and running a first query

  • Dashboard — browse datasets and tables before you query

Last updated

Was this helpful?