How to get ETH and BTC OHLCV candles from on-chain DEX swaps with an API
Updated 2026-11-10
Use when an agent needs ETH or BTC price history as OHLCV candles for charting or backtesting.
From an MCP client, add https://tanod.dev/mcp and call get_dex_price_candles; its free daily calls are applied automatically, no key or signup.
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 -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
{"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, Polygon, Solana, BNB Chain or Arbitrum 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).
Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/chain?via=crypto-ohlcv-candles-api as a custom connector (steps), then ask in plain words, for example "Show me hourly ETH price candles for the last 24 hours." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.
Related guides: Chainlink price API, Uniswap quote API, finance MCP server. Back to tanod.dev or the guide index.