Skip to content

docs: fix Solana aggregate queries that filter on USD-denominated fields - #244

Merged
buddies2705 merged 2 commits into
mainfrom
docs/solana-aggregate-filter-fixes
Aug 18, 2026
Merged

docs: fix Solana aggregate queries that filter on USD-denominated fields#244
buddies2705 merged 2 commits into
mainfrom
docs/solana-aggregate-filter-fixes

Conversation

@buddies2705

Copy link
Copy Markdown
Contributor

Problem

On Solana, DEXTradeByTokens with dataset: archive or combined is served from pre-aggregated tables that carry no USD-denominated columns. Filtering on them fails with a hard GraphQL error:

no table can query DEXTradeByToken (map[aggregates:yes dataset:combined ...])
database schema not defined for archive cube DEXTradeByToken solana[mainnet-beta.solana.com]

Eight documented examples did this, so they did not run at all — including the flagship OHLC example on the Historical Solana Data page.

Verified behaviour

Tested live against streaming.bitquery.io/graphql (fixed historical window, each filter compared against its own no-filter baseline):

Filter realtime archive / combined
Trade.Amount, Trade.Side.Amount works works
Trade.Price, Trade.Account.Address works works
Trade.Side.Type, Trade.Dex, Block.Time works works
Trade.PriceAsymmetry works error
Trade.Side.AmountInUSD, Trade.AmountInUSD works error
Trade.PriceInUSD works error

USD fields work fine as output measures on aggregates — sum(of: Trade_Side_AmountInUSD) and quantile(of: Trade_PriceInUSD) both return correct values. Only where: filters are affected.

Causally confirmed: deleting only the Side.AmountInUSD line from an otherwise unchanged failing query makes it return data.

Changes

8 query fixes — 7 filter removals plus one substitution (Side.AmountInUSD {gt "10"}Side.Amount {gt "0.05"}, the native-unit equivalent, used only where a single quote currency is pinned). All 8 now execute successfully.

Documentation — a filter-limitation table on the Solana historical aggregate page, a matching Q&A on the combined-dataset page, and the previously undocumented default dataset (realtime) on the dataset options page. The existing warning only covered the Trade Side Account projection; nothing documented the filter restriction.

Three IDE links repointed — the linked saved queries were owned by other accounts and still carried the broken filters, so the "run it here" links errored even with the markdown fixed. Corrected copies now exist under the docs account.

Deliberately unchanged

  • Transaction: {Result: {Success: true}} (21 queries) — verified working; it is a documented default filter and is ignored on every dataset, realtime included.
  • Trade.Account filters (4 queries) — verified working on aggregates.
  • 28 Solana queries with no dataset: argument — the default behaves as realtime, where all filters work.

Known limitation

The originals owned by other accounts still carry the broken filters and remain in the public Query Library; a one-line fix by their owners would retire the duplicates.

Verification

All 8 edited queries executed against the live API and returned data. Full-tree rescan: 42 Solana aggregate query blocks, 0 residual broken filters.

🤖 Generated with Claude Code

Gaurav Agarwal and others added 2 commits August 18, 2026 14:01
Solana DEXTradeByTokens on dataset: archive/combined is served from
pre-aggregated tables that carry no USD-denominated columns. Filtering on
PriceAsymmetry, Side.AmountInUSD, AmountInUSD or PriceInUSD fails with a hard
GraphQL error ("no table can query DEXTradeByToken" / "database schema not
defined for archive cube"), so eight documented examples did not run at all.

Verified live against streaming.bitquery.io/graphql:
- USD filters and PriceAsymmetry error on archive/combined, work on realtime
- native equivalents (Trade.Amount, Trade.Side.Amount, Trade.Price) work
- USD *measures* (sum(of: Trade_Side_AmountInUSD), quantile(of: Trade_PriceInUSD))
  work fine on aggregates -- only filters are affected

Removed the unsupported filters from the 8 broken examples, substituting the
native Side.Amount equivalent where a single quote currency is pinned. All 8
now execute successfully. Added a filter-limitation table to the Solana
historical aggregate page, a matching Q&A on the combined dataset page, and
documented the default dataset on the options page.

Tier 2 (Trade.Account filters) and Tier 3 (Transaction.Result.Success) were
audited and left unchanged -- both verified working.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The three "run it here" links pointed at IDE saved queries owned by other
accounts that still carried the unsupported filters, so the linked query
errored even though the markdown was fixed. Corrected copies now exist under
the docs account:

  historical-ohlc-for-solana_3      -> Historical-OHLC-for-Solana-archive
  ath-with-price-delta_1            -> ATH-with-price-delta-Solana
  ATH-of-multiple-tokens-using-...  -> ATH-of-multiple-tokens-quantile-Solana

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@buddies2705
buddies2705 merged commit 25eddd6 into main Aug 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant