Skip to main content

Trading Filters and Operators Reference

Every where clause on a Trading cube is built from a small, regular set of leaf filter types. This page is the reference for which operators exist, which branches each cube exposes, and the handful of places where a filter returns something other than what it looks like.

Operator sets by leaf type

There is no single operator vocabulary — it depends on the column's type.

Leaf typeOperatorsValue
OLAP_Stringis not in notIn like notLike likeCaseInsensitive notLikeCaseInsensitive includes notIncludes includesCaseInsensitive notIncludesCaseInsensitive startsWith startsWithCaseInsensitive endsWithString
OLAP_Floateq ne ge le gt ltno in / notInFloat
OLAP_Integereq ne in notIn ge le gt ltInt
OLAP_BigIntegereq ne in notIn ge le gt ltString of decimal digits
OLAP_DateTimeis not in notIn since till after before, plus _relative variantsDateTime
OLAP_Datethe same setYYYY-MM-DD string
Booleannone — pass a bare true / falseBoolean

The three biggest surprises here: OLAP_Float has no in, OLAP_BigInteger takes its value as a string, and boolean fields take a bare value rather than an operator object.

Relative time

_relative variants (since_relative, before_relative, …) take seconds_ago, minutes_ago, hours_ago, days_ago, weeks_ago, months_ago, years_ago, and a round: { count, offset, in } for snapping to a boundary.

Relative windows move between runs

A relative window advances every second, so two identical requests cover different data. When comparing results or testing determinism, use explicit since / till.

any is the only boolean combinator

where: { any: [ { ... }, { ... } ] } # OR

There is no all, or, and or not. Sibling keys at any level are AND-ed together — including a sibling of any. And any cannot nest: its element type is the cube filter minus its own any field.

Which branches each cube exposes

BranchTradesPairsTokensCurrencies
Block · Price · Supply · any
Currency
Interval · Volume
Token
Ranking
Market · Pool · QuoteCurrency · QuoteToken
Amounts · AmountsInUsd · PriceInUsd · Side · Trader · TransactionHeader · Pair
Where-clauses are not interchangeable between cubes

Pair is unknown on Pairs (use top-level Token / QuoteToken / Market / Pool); Interval is unknown on Trades; Market / Pool / QuoteToken are unknown on Tokens. Copying a clause from one cube to another is the most common cause of Argument "where" has invalid value.

The network filter differs too: Pair.Market.Network on Trades, Market.Network on Pairs, Token.Network on Tokens.

Price exists on all four but has different shapes: on Trades it is a bare OLAP_Float (the trade price); on the other three it is an object with Ohlc.*, Average.* and IsQuotedInUsd.

Currency is not Token

Token is the per-network contract instance. Currency is the cross-chain asset, so one predicate spans every chain the asset trades on.

The practical consequence catches people out: a wrapped token's Currency is the underlying native asset. For WSOL, Currency is { Id: "bid:solana", Symbol: "SOL" } — so Currency: { Symbol: { is: "WSOL" } } matches nothing, while Token: { Symbol: { is: "WSOL" } } works. Native assets carry Currency.Id = "bid:<chain>", whereas QuoteCurrency.Id uses a plain slug ("usdc"), not the bid: form.

Filtering to a single DEX or protocol

On Trading.Trades, filter the market rather than the token:

where: { Pair: { Market: { ProtocolFamily: { is: "..." } } } }

Market.Protocol, Market.Program and Market.Name work the same way. Values are case-sensitive and use each protocol's own canonical spelling.

Traps

TrapWhat happensDo instead
Bare { count } on Trades filtered by Pair.Token.Address or Pair.Pool.AddressReturns a wildly inflated count — an order of magnitude high. Adding any dimension or a second aggregate returns the correct figure.Filter on Token.Id instead, or always project a dimension alongside count
Checksummed EVM addressReturns 0 rows, no errorAddresses are stored lowercase; is / in are exact-match
Wrong Network spellingReturns 0 rows, no errorCase-sensitive display names — Polygon is "Matic", BSC is "Binance Smart Chain"
Token.TokenId / Token.DidFilterable but empty on rows, so any predicate matches nothingUse Token.Id (bid:<chain>:<address>) or Token.Address
Bare address in Token.IdReturns 0 rows silentlyToken.Id is chain-qualified; use Token.Address for a raw address
Interval.VolumeBased / TargetVolumeParse fine, match nothingSee Volume-Based Aggregation

Discovering the full leaf set

The leaf paths per cube number in the dozens and change as fields are added. Introspect rather than working from a static list:

{ __type(name: "Trading_Trade_Filter") {
inputFields { name type { name kind ofType { name kind ofType { name } } } } } }

Swap in Trading_Pair_Filter, Trading_Token_Filter or Trading_Currency_Filter.