Cambrian OHLCV (Pool) API

By Cambrian Network solana

GET /api/v1/solana/ohlcv/pool

OHLCV (Pool)

Overview

Retrieve OHLCV (Open, High, Low, Close, Volume) data for a specific Solana pool contract to support pair-specific price analysis and liquidity venue performance tracking. This endpoint returns time-bucketed price and volume data for a single pool over a specified time range and interval.

Business Value

  • Pool-Specific Analytics: Track price movements and trading activity for specific liquidity pools to understand venue performance
  • Liquidity Provider Insights: Monitor OHLCV metrics for pools where you provide liquidity to optimize returns and assess risk
  • Venue Comparison: Compare trading patterns across different pools for the same token pair to identify optimal trading venues
  • Historical Price Analysis: Access granular time-series price data with customizable intervals for technical analysis and backtesting
  • Volume Tracking: Monitor both base and quote token volumes to understand trading intensity and market depth dynamics

Endpoint Details

URL:

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

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

Query Parameters

Parameter Type Required Default Description
pool_address string Yes - Pool/pair contract address (base58 format)
after_time integer Yes - Unix timestamp - start time for data range
before_time integer Yes - Unix timestamp - end time for data range
interval string Yes - Time interval for OHLCV data aggregation. Enum: 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w

Response Field Descriptions

Response Field Type Description
openPrice Nullable(Float64) Opening price for the interval
highPrice Float64 Highest price during the interval
lowPrice Float64 Lowest price during the interval
closePrice Nullable(Float64) Closing price for the interval
volumeQuote Float64 Trading volume denominated in the quote token
volumeBase Float64 Trading volume denominated in the base token
unixTime Nullable(Int64) Unix timestamp marking the start of the interval
interval String Time interval for this data point (e.g. "1h")
poolAddress String Pool/pair contract address (base58 format)
baseTokenAddress Nullable(String) Contract address of the base token in the pair
quoteTokenAddress Nullable(String) Contract address of the quote token in the pair

Examples

1. Retrieve hourly OHLCV data for a Solana pool

This example fetches hourly OHLCV data for a specific pool over a one-day window, useful for short-term price and volume analysis of a single liquidity venue.

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

Response:

[
  {
    "columns": [
      {
        "name": "openPrice",
        "type": "Nullable(Float64)"
      },
      {
        "name": "highPrice",
        "type": "Float64"
      },
      {
        "name": "lowPrice",
        "type": "Float64"
      },
      {
        "name": "closePrice",
        "type": "Nullable(Float64)"
      },
      {
        "name": "volumeQuote",
        "type": "Float64"
      },
      {
        "name": "volumeBase",
        "type": "Float64"
      },
      {
        "name": "unixTime",
        "type": "Nullable(Int64)"
      },
      {
        "name": "interval",
        "type": "String"
      },
      {
        "name": "poolAddress",
        "type": "String"
      },
      {
        "name": "baseTokenAddress",
        "type": "Nullable(String)"
      },
      {
        "name": "quoteTokenAddress",
        "type": "Nullable(String)"
      }
    ],
    "data": [
      [
        188.91000369631612,
        192.27155639417393,
        188.75311778120638,
        192.03411242234174,
        406283.84986,
        2129.8661412570023,
        1735689600,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        192.03412720298522,
        192.1959156621166,
        189.9735973570173,
        190.18832858249917,
        451140.73497299966,
        2362.969263186,
        1735693200,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        190.18832802245518,
        191.5766668691956,
        190.04950427631093,
        191.1935695373037,
        879581.7627479993,
        4612.637865910996,
        1735696800,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        191.04063318392232,
        191.0406341282193,
        189.61195276700667,
        190.12644541964147,
        604837.0177970004,
        3176.215211069999,
        1735700400,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        189.9739863001899,
        189.97400341153914,
        188.98306775870205,
        189.0641139332444,
        644987.2130740001,
        3404.7818689140017,
        1735704000,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        188.98834548025786,
        190.126997275962,
        188.98834548025786,
        189.7479113043496,
        779107.6320560005,
        4106.191289562003,
        1735707600,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        189.59440160023175,
        189.9043887377066,
        188.98853949074328,
        189.84927258573907,
        888871.904823,
        4691.795723701002,
        1735711200,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        189.89839027144353,
        189.97447643932955,
        189.28804959162153,
        189.5945163320466,
        544177.454244,
        2870.2106599879985,
        1735714800,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        189.5945169093682,
        190.27919913160966,
        188.90660183483112,
        188.98887404540355,
        1024084.2185279999,
        5403.363581164996,
        1735718400,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ],
      [
        189.1401892478719,
        189.36765803490573,
        187.6222526066206,
        188.90947709868874,
        845770.9815419995,
        4489.710143661002,
        1735722000,
        "1h",
        "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        "So11111111111111111111111111111111111111112",
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      ]
    ],
    "rows": 24
  }
]

Note: result collections are limited to 10 items. The response shows hourly OHLCV data for the pool 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6 (a SOL/USDC pair, identified by baseTokenAddress and quoteTokenAddress). The rows field shows 24 total intervals were available over the requested 24-hour window.

x402 Payment Option

This endpoint supports pay-per-use access via the x402 payment protocol (v2), which lets you 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/solana/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/solana/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


Related Endpoints

  • /solana/ohlcv/base-quote - Retrieve granular OHLCV data with separate base and quote token volumes for detailed trading analysis between any two SPL tokens.
  • /solana/ohlcv/token - Retrieve Open, High, Low, Close, and Volume data for any SPL token.
  • /solana/pool-transactions - Retrieve a paginated list of trades/transactions for a specified Solana pool address including swaps, add liquidity, and remove liquidity events.
  • /solana/token-pool-search - Find pools containing a specific token and retrieve comprehensive trading statistics including 24h volume, trade counts, and buy/sell ratios.
  • /solana/orca/pool - Retrieves detailed metrics and information for a specific Solana pool (identified by its program ID/address) using the pre-calculated orca_pool_details_view.