Skip to content

Coin OHLC candles

$0.003 per callUSDC via x402GET /api/coin-ohlc

OHLC candles for a coin: days 1 (30-min candles), 7 or 14 (4-hour), 30 / 90 / 180 / 365 (daily), in any vs currency. Send GET /api/coin-ohlc with the required field coin and pay $0.003 per call over x402 or MPP (there is no free tier). It returns a JSON object with source, fetchedAt, cached, coin, currency and 6 more.

Returns aligned {time, open, high, low, close} bars plus the window's high/low/first/last and % change. The candle sibling of crypto-history, which returns close-only points: use OHLC for technical indicators, range/volatility work and charting. Cached in-process for 60 seconds. Data provided by CoinGecko (https://www.coingecko.com/en/api).

Category: Crypto & onchain dataTags: crypto ohlc candles chart technical-analysis volatility timeseries

Try in playground →

Parameters

NameTypeRequiredDescription
coinstringyesCoin id (bitcoin, ethereum, ...). Also accepted as symbol, id, ticker, asset.
daysnumberno1, 7, 14, 30, 90, 180 or 365 (default 7).
currencystringnovs currency (default usd).

Example request

curl -i "https://agent402.tools/api/coin-ohlc?coin=bitcoin&days=7&currency=usd"

Without payment this returns HTTP 402 Payment Required with the exact price for coin-ohlc; any x402 v2 or MPP client pays it and retries.

Watch a call get paid

RequestGET /api/coin-ohlc
402$0.003 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "source": "coingecko",
  "fetchedAt": "2026-08-22T13:20:00.000Z",
  "cached": false,
  "coin": "bitcoin",
  "currency": "usd",
  "days": 7,
  "count": 42,
  "granularity": "4h",
  "summary": {
    "first": 66120.4,
    "last": 68210,
    "high": 69850,
    "low": 64995.9,
    "changePct": 3.16
  },
  "bars": [
    {
      "time": "2026-08-15T16:00:00.000Z",
      "open": 66120.4,
      "high": 66500.1,
      "low": 65900,
      "close": 66210.3
    }
  ],
  "credit": "Data provided by CoinGecko (https://www.coingecko.com/en/api)."
}
FieldTypeAlways presentIn the example
sourcestringyescoingecko
fetchedAtstringyes2026-08-22T13:20:00.000Z
cachedbooleanyesfalse
coinstringyesbitcoin
currencystringyesusd
daysnumberyes7
countnumberyes42
granularitystringyes4h
summaryobjectyes5 fields: first, last, high, low, changePct
barsarray of objectsyes1 item in the example
creditstringyesData provided by CoinGecko (https://www.coingecko.com/en/api).

From an MCP client

catalog.call {
  "slug": "coin-ohlc",
  "params": {
    "coin": "bitcoin",
    "days": 7,
    "currency": "usd"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for coin-ohlc; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.14.0.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.003" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/coin-ohlc?coin=bitcoin&days=7&currency=usd");

Related tools

Token price history (USD)

$0.001POST /api/token-price-history

Historical USD price series for a token, by ticker symbol (ETH, BTC, SOL, ...) or by ERC-20 contract + network.

Coin market chart for a time window

$0.008GET /api/coin-market-chart-range

Price, market cap and volume series for a coin over an ARBITRARY time window: `from`/`to` as unix seconds or ISO dates.

Crypto technical indicators

$0.002POST /api/crypto-indicators

Technical indicators for one perpetual computed deterministically from Hyperliquid candles: RSI(14), MACD(12,26,9).

Perp candles (OHLCV)

$0.001POST /api/perp-klines

OHLCV candles for one perpetual at intervals from 1m to 1M (1m 3m 5m 15m 30m 1h 2h 4h 8h 12h 1d 3d 1w 1M), newest last.

Token diligence (coin list)

from $0.01POST /api/token-diligence

One market diligence read for up to 20 coins in one call: per coin the profile and market snapshot (price, market cap.

Crypto price history

$0.015GET /api/crypto-history

Crypto price chart series over a window of days: bars[] of {time, price, marketCap, volume} for charts and backtests.