Skip to main content
There are two ways to filter data in ChainStream GraphQL:
  1. Selector shortcuts — top-level arguments like tokenAddress that provide a convenient shorthand for common filters
  2. where argument — a nested filter object that supports the full range of operators and arbitrary dimension filtering
Best Practice: Always add a time filter. For DWD (detail) Cubes like DEXTrades, Transfers, and BalanceUpdates, queries without a Block.Time filter may scan very large table partitions. Always include where: {Block: {Time: {after: "..."}}} to limit the scan range and avoid potential memory limits on the OLAP engine.
You can combine both in the same query.

Selector Shortcuts

Selectors are convenience arguments on Cube fields that map to common where filter patterns. They accept the same filter input types as where fields (e.g., StringFilter with is, in, like, etc.), not plain strings. These two queries are equivalent:
Selectors support all filter operators — not just exact match. For example, tokenAddress: {in: ["ADDR_1", "ADDR_2"]} matches multiple tokens, and date: {after: "2025-01-01T00:00:00Z"} filters by time.

The where Argument

The where argument accepts a nested input object that mirrors the Cube’s dimension hierarchy. Each leaf field maps to a filter primitive with typed operators.

Structure

Example — Filter DEXTrades where block time is after a date AND buy amount is greater than 1000:
When multiple fields are specified at the same level in where, they are combined with AND logic.

Filter Primitive Types

Every leaf dimension maps to one of these filter input types:

StringFilter

For text fields like addresses, hashes, protocol names.

IntFilter / FloatFilter

For numeric fields like amounts, prices, counts.

DateTimeFilter

For timestamp fields. Values are ISO 8601 strings.
after/before are exclusive (strict inequality). since/till are inclusive. between takes a two-element array and is inclusive on both ends.

BoolFilter

For boolean fields.

OR Logic with any

By default, all conditions in where are combined with AND. To express OR logic, use the any array field — each element is a full filter object, and records matching any of them are returned.
any can be combined with other top-level where fields. The any conditions are OR’d together, then AND’d with any sibling conditions.

Default Filters

Some Cubes apply default filters automatically. You can override them by explicitly setting the filter in your where clause. To include suspect trades, explicitly set the filter:
Or remove the filter entirely by not specifying IsSuspect in where — the default false still applies. To query all trades regardless of suspect status, use OR:

Combining Selectors and where

Selectors and where filters are combined with AND. This lets you use selectors for the primary entity and where for additional refinement:
This query fetches the 50 most recent USDC trades on Solana where the buy amount exceeds 100, ordered by time descending.

Next Steps

Ordering & Pagination

Sort results and page through data with orderBy and limit.

Metrics & Aggregation

Aggregate filtered data with count, sum, avg, min, max, uniq.