/v1/evm/pools/ohlc?limit=N is hard-capped at 100. limit=540 returns 403 forbidden. The cap is undocumented in the OpenAPI schema, which advertises integer with no maximum.
- The endpoint returns up to 4-8x duplicate rows per
datetime. Routinely observed: “100 rows returned, only 13-25 distinct datetimes.”
Combined effect. A request for 100 daily bars can yield as few as 13 unique days. Not enough for a 1M chart, let alone 3M.
Workaround applied. Discovered (via experimentation, since it is undocumented) that ?page=N is supported. The build now fans out 4 parallel page fetches and dedupes across pages by datetime, spanning approximately 100 unique days. Functional, but 4x the request count for the same logical query.
Reproduction.
curl "https://token-api.thegraph.com/v1/evm/pools/ohlc?network=mainnet&pool=0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640&interval=1d&limit=100" \
-H "Authorization: Bearer$TOKEN" | jq '.data | length, ([.[].datetime] | unique | length)'
# 100, 25
Proposed changes.
- Server-side dedup: pick the canonical bar per
(pool, datetime) tuple, return one row per datetime. Cuts request count by 4x.
- Raise the limit cap to 1000 for chart-friendly windows. Document it in OpenAPI.
- Document
?page=N in OpenAPI and the API reference.
- Hourly OHLC currently caches the latest incomplete bar’s
close so it does not update between hour boundaries even when swaps happen. This forced the Lodestar build to skip Token API for live spot pricing entirely (Uniswap V3 subgraph’s derivedETH is used instead). Either reduce the cache TTL on the current incomplete bar, or expose an explicit latest_swap_price field.
Effort estimate. Small for dedup, cap, and documentation. The cache TTL is a config change.
/v1/evm/pools/ohlc?limit=Nis hard-capped at 100.limit=540returns403 forbidden. The cap is undocumented in the OpenAPI schema, which advertisesintegerwith no maximum.datetime. Routinely observed: “100 rows returned, only 13-25 distinct datetimes.”Combined effect. A request for 100 daily bars can yield as few as 13 unique days. Not enough for a 1M chart, let alone 3M.
Workaround applied. Discovered (via experimentation, since it is undocumented) that
?page=Nis supported. The build now fans out 4 parallel page fetches and dedupes across pages by datetime, spanning approximately 100 unique days. Functional, but 4x the request count for the same logical query.Reproduction.
Proposed changes.
(pool, datetime)tuple, return one row per datetime. Cuts request count by 4x.?page=Nin OpenAPI and the API reference.closeso it does not update between hour boundaries even when swaps happen. This forced the Lodestar build to skip Token API for live spot pricing entirely (Uniswap V3 subgraph’sderivedETHis used instead). Either reduce the cache TTL on the current incomplete bar, or expose an explicitlatest_swap_pricefield.Effort estimate. Small for dedup, cap, and documentation. The cache TTL is a config change.