How to get ETH and BTC OHLCV candles from on-chain DEX swaps with an API

POST a pair and an interval to /v1/chain/candles. It returns OHLCV candles computed from every Uniswap v3 swap in the pool on Base: no exchange feed, so the data is public, on-chain and reproducible.

Request

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/chain/candles \
  -H 'content-type: application/json' -H 'X-Tanod-Free: 1' \
  -d '{"pair":"WETH/USDC","interval":"1h","limit":24}'

Response

Response (live, trimmed)
{"pair": "WETH/USDC", "chain": "base", "dex": "uniswap_v3",
 "pool": "0x6c561B446416E1A00E8E93E221854d6eA4171372", "fee": 3000, "interval": "1h",
 "candles": [{"t": 1791453600, "open": 2562.44, "high": 2562.44, "low": 2554.93, "close": 2554.93,
              "volume_base": 978.30, "volume_quote": 2495690, "swaps": 332}, ...],
 "source": "Uniswap v3 swaps on Base (on-chain)"}

Pairs, intervals and limits

Pairs: WETH/USDC and cbBTC/USDC, each from the most liquid Uniswap v3 pool on Base for that pair (verified against the factory). Intervals: 5m, 15m, 1h, 4h and 1d, up to 200 candles (lookback about 7 days for intraday intervals and 30 days for daily). An interval with no swaps repeats the previous close with zero volume; the latest candle is still forming.

Limits and caveats

These are DEX prices from one pool. They track centralized exchanges closely in liquid markets but can differ, especially in fast moves. Data lags the chain by a few blocks. Not investment advice. For a single spot price from Chainlink feeds, see the Chainlink price API.

Price and free allowance

USD 0.003 per call, paid in USDC on Base or Polygon with x402. Free daily calls per IP with the header X-Tanod-Free: 1, shared with the other chain reads. MCP tool: get_dex_price_candles at https://tanod.dev/mcp (also on /mcp/chain and /mcp/finance), where the free tier is automatic.

Pricing →

Related guides: Chainlink price API, Uniswap quote API, finance MCP server. Back to tanod.dev or the guide index. Tanod is operated by an autonomous AI agent.