Cambrian OHLCV (Pool) API

By Cambrian Network evm

GET /evm/ohlcv/pool

OHLCV (Pool)

Overview

Retrieve OHLCV (Open, High, Low, Close, Volume) candles for a specific EVM liquidity pool. This endpoint returns time-bucketed price and volume data for a pool address over a given time range, at a selectable interval.

Business Value

  • Pool-Level Price Charting: Builds candlestick charts for any EVM pool, for trading dashboards and analytics tools.
  • Historical Backtesting: Provides historical OHLCV data across configurable intervals (1m to 1w) for strategy backtesting.
  • Cross-Chain Coverage: Supports multiple EVM chains (Ethereum, Base) for unified tooling across networks.
  • Liquidity Venue Analysis: Lets liquidity providers and traders evaluate price behavior and volume at the pool level rather than the aggregated token level.
  • Flexible Time Windows: after_time/before_time plus limit/offset parameters allow precise pagination through large historical ranges.

Endpoint Details

URL:

https://api.cambrian.org/evm/ohlcv/pool

Method: GET
Authentication: Required via X-API-Key header

Query Parameters

Parameter Type Required Default Description
chain_id integer No 8453 EVM chain ID. Enum: 1, 8453, 42161, 4663, 56
pool_address string Yes - Pool contract address. Pattern: ^0x[a-fA-F0-9]{40}$
after_time integer Yes - Unix timestamp (seconds) to start the range from. Min: 1420070400, Max: 4102444799
before_time integer Yes - Unix timestamp (seconds) to end the range at. Min: 1420070400, Max: 4102444799
interval string Yes - Candle interval. Enum: 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w
limit integer No 100 Limit the number of results. Min: 1, Max: 10000
offset integer No 0 Offset the results, allows you to skip a number of rows before starting to return rows. Min: 0, Max: 100000000

Response Field Descriptions

Response Field Type Description
chainId UInt16 EVM chain ID the pool resides on
openPrice Float64 Opening price of the base token (in quote token terms) for the candle
highPrice Float64 Highest price reached during the candle
lowPrice Float64 Lowest price reached during the candle
closePrice Float64 Closing price of the base token for the candle
volumeQuota Float64 Trading volume denominated in the quote token
volumeBase Float64 Trading volume denominated in the base token
unixTime UInt32 Unix timestamp (seconds) marking the start of the candle
interval String Candle interval represented by this row (e.g., "1h")
poolAddress String Address of the liquidity pool
baseTokenAddress String Contract address of the base token
quotaTokenAddress String Contract address of the quote token

Examples

1. Hourly OHLCV for a Base Pool

Retrieve hourly candles for a specific Base-chain pool over a one-day window.

curl -X GET "https://api.cambrian.org/evm/ohlcv/pool?pool_address=0xd0b53d9277642d899df5c87a3966a349a798f224&after_time=1735689600&before_time=1735776000&interval=1h&limit=10" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response:

[
  {
    "columns": [
      {
        "name": "chainId",
        "type": "UInt16"
      },
      {
        "name": "openPrice",
        "type": "Float64"
      },
      {
        "name": "highPrice",
        "type": "Float64"
      },
      {
        "name": "lowPrice",
        "type": "Float64"
      },
      {
        "name": "closePrice",
        "type": "Float64"
      },
      {
        "name": "volumeQuota",
        "type": "Float64"
      },
      {
        "name": "volumeBase",
        "type": "Float64"
      },
      {
        "name": "unixTime",
        "type": "UInt32"
      },
      {
        "name": "interval",
        "type": "String"
      },
      {
        "name": "poolAddress",
        "type": "String"
      },
      {
        "name": "baseTokenAddress",
        "type": "String"
      },
      {
        "name": "quotaTokenAddress",
        "type": "String"
      }
    ],
    "data": [
      [
        8453,
        3332.536307156436,
        3356.864493690894,
        3330.896735816566,
        3356.8608777632935,
        1990766.878916,
        594.8392645526991,
        1735689600,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3357.473179573992,
        3357.550091962905,
        3337.424110414588,
        3339.533467710805,
        1650981.709878,
        493.1693402178727,
        1735693200,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3339.532826202043,
        3358.867492406441,
        3339.4744581150603,
        3355.714290742269,
        1729515.701951,
        516.454785930015,
        1735696800,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3355.698774075467,
        3356.4771778671166,
        3344.4549618092274,
        3348.7211366619586,
        2033678.502485,
        607.0407670672997,
        1735700400,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3348.7086453582774,
        3348.8793100892594,
        3333.841960763265,
        3333.841960763265,
        1090907.217021,
        326.4831221781552,
        1735704000,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3333.8417831716524,
        3343.156180262368,
        3333.0711466711878,
        3339.3912642645228,
        976972.975829,
        292.6259215289187,
        1735707600,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3339.389353592374,
        3339.389353592374,
        3331.5613890295062,
        3337.7457930659093,
        1424881.582232,
        427.17181905093065,
        1735711200,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3337.7455069970047,
        3340.6082467582855,
        3330.770804077128,
        3339.6617026522213,
        1156837.837102,
        346.71666073041666,
        1735714800,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3339.656046036028,
        3340.209078332358,
        3326.2648529284925,
        3330.5264635863623,
        1023690.345486,
        307.1070182405019,
        1735718400,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ],
      [
        8453,
        3330.5263615101203,
        3333.0880224646694,
        3310.1199057205945,
        3326.7988331217657,
        1705807.010866,
        513.9519201841006,
        1735722000,
        "1h",
        "0xd0b53d9277642d899df5c87a3966a349a798f224",
        "0x4200000000000000000000000000000000000006",
        "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
      ]
    ],
    "rows": 10
  }
]

Result collections are limited to 10 items. This example returns 10 hourly candles for the WETH/USDC pool on Base (chain ID 8453), each with open/high/low/close prices and base/quote volumes.

x402 Payment Option

This endpoint supports pay-per-use access via the x402 payment protocol (v2): pay $0.05 USDC per request using blockchain micropayments. No API key required.

Quick Start (TypeScript)

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

const signer = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const client = new x402Client();
client.register("eip155:*", new ExactEvmScheme(signer));

const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const response = await fetchWithPayment(
  "https://x402.cambrian.org/evm/ohlcv/pool"
);
const data = await response.json();

Quick Start (Python)

pip install "x402[httpx]"
import asyncio, os
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

async def main():
    client = x402Client()
    account = Account.from_key(os.getenv("EVM_PRIVATE_KEY"))
    register_exact_evm_client(client, EthAccountSigner(account))

    async with x402HttpxClient(client) as http:
        response = await http.get("https://x402.cambrian.org/evm/ohlcv/pool")
        print(response.json())

asyncio.run(main())

Payment Flow

  1. Send a normal request to the endpoint (no API key needed)
  2. Server returns 402 Payment Required with payment details
  3. The x402 SDK automatically signs a payment authorization with your wallet
  4. The SDK resubmits the request with the signed payment
  5. Server verifies payment and returns the API response

The x402 SDK handles steps 2 through 5 automatically.

Network: Base (chain ID 8453) | Currency: USDC | Price: $0.05 per request