Skip to content

TOKEN_API_NO_TOKEN_LEVEL_VOLUME: volume is per-pool, not per-token #520

Description

@chillsauce

OHLC volume is per-pool. Producing a meaningful “24h volume” for a token requires fanning out OHLC across every pool that token trades in and aggregating, on every directory render. Server-side this would be expensive; client-side it is impractical.

Workaround applied. Switched to subgraph queries (Uniswap V2 / V3 mainnet plus Uniswap V3 on Arbitrum, Base, Polygon, plus Curve mainnet). Five batched GraphQL round trips per directory render via The Graph Network gateway. Functional, but it pulls the consumer outside Token API for a metric that should live there.

Impact. Anyone wanting a “24h volume” column on a token list either goes to a subgraph (which puts them outside Token API) or fans out OHLC per pool per token (impractical at any scale). Most consumers will go to CoinGecko instead.

Proposed change.

GET /v1/evm/tokens/:contract/volume?network=X&window=24h
→ { volume_24h_usd: 1234567.89, by_venue: { uniswap_v3: 800000, ... } }

Or more cleanly, a volume_24h_usd field on /v1/evm/tokens (computed server-side from indexed swaps). Per-venue breakdown is a nice-to-have; the headline aggregate is the headline use case.

Effort estimate. Medium. Indexer already sees every swap; aggregation is a roll-up job.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions