Cambrian OHLCV (Token) API

By Cambrian Network solana

GET /api/v1/solana/ohlcv/token

Token OHLCV Data

Overview

Retrieve Open, High, Low, Close, and Volume (OHLCV) data for any SPL token across specified time intervals. This endpoint provides comprehensive price and trading volume metrics essential for technical analysis and trading strategy development on Solana.

Business Value

  • Technical Analysis: Access OHLCV candlestick data for comprehensive price pattern analysis and trend identification
  • Trading Strategy Development: Historical price and volume data enables backtesting and strategy optimization
  • Market Research: Volume metrics provide insights into token liquidity and market activity patterns
  • Portfolio Management: Track token performance over time with standardized financial market data formats
  • Risk Assessment: Historical volatility analysis through high/low price ranges supports risk management decisions

Endpoint Details

URL:

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

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

Query Parameters

Parameter Type Required Default Description
token_address string Yes - SPL token mint 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 (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 at the start of the interval
highPrice Nullable(Float64) Highest price reached during the interval
lowPrice Nullable(Float64) Lowest price reached during the interval
closePrice Nullable(Float64) Closing price at the end of the interval
volume Nullable(Float64) Total USD volume traded during the interval
volumeToken Nullable(Float64) Total token volume traded during the interval
unixTime Nullable(Int64) Unix timestamp for the start of the interval
interval String Time interval used for aggregation
tokenAddress String SPL token mint address

Examples

1. Hourly OHLCV Data for SOL Token

Get hourly OHLCV data for Wrapped SOL over a 24-hour period to analyze short-term price movements and trading volumes.

curl -X GET "https://api.cambrian.org/solana/ohlcv/token?token_address=So11111111111111111111111111111111111111112&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": "Nullable(Float64)"
      },
      {
        "name": "lowPrice",
        "type": "Nullable(Float64)"
      },
      {
        "name": "closePrice",
        "type": "Nullable(Float64)"
      },
      {
        "name": "volume",
        "type": "Nullable(Float64)"
      },
      {
        "name": "volumeToken",
        "type": "Nullable(Float64)"
      },
      {
        "name": "unixTime",
        "type": "Nullable(Int64)"
      },
      {
        "name": "interval",
        "type": "String"
      },
      {
        "name": "tokenAddress",
        "type": "String"
      }
    ],
    "data": [
      [
        190.02896429484457,
        191.46123775723134,
        189.93454611861705,
        190.14084507042253,
        18336881.84702409,
        96152.88098244628,
        1735689600,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        191.1272048166425,
        191.47069941197873,
        190.65040801684015,
        190.89813708021254,
        14820073.972368002,
        77582.02503583477,
        1735693200,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        190.7510665087174,
        191.15446510806973,
        190.41341361640804,
        191.14176965009318,
        15147530.53400096,
        79424.70777417776,
        1735696800,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        190.77370333885284,
        190.83896467848294,
        190.08646348496325,
        190.44006524274295,
        10935944.62225898,
        57407.6305247706,
        1735700400,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        189.41637,
        189.800143706478,
        189.2359063825013,
        189.4499725170332,
        13504379.410405014,
        71266.28414577786,
        1735704000,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        189.86046156817085,
        190.09403051275774,
        189.590976,
        189.80453305785124,
        12826478.285232937,
        67567.45013128487,
        1735707600,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        189.7160209783157,
        189.82147361798832,
        189.3138999329921,
        189.79999999999998,
        11567187.100701973,
        61032.001700627974,
        1735711200,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        189.8693038721531,
        189.908447,
        189.49643291819925,
        189.84637033006047,
        11115165.199889978,
        58604.48739789844,
        1735714800,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        189.62699129495397,
        190.16950354851585,
        189.318549197926,
        189.43089278372233,
        14157638.143593896,
        74613.4871102127,
        1735718400,
        "1h",
        "So11111111111111111111111111111111111111112"
      ],
      [
        188.61736502544898,
        188.8860650288014,
        188.03831735111763,
        188.80736664274005,
        16185241.416632997,
        85906.51899640434,
        1735722000,
        "1h",
        "So11111111111111111111111111111111111111112"
      ]
    ],
    "rows": 24
  }
]

The full result contained 24 hourly rows; only the first 10 are shown above. The response shows hourly OHLCV data for Wrapped SOL with prices around $190 USD and significant trading volume exceeding $10M USD per hour. Each data row represents one hour of trading activity with opening, high, low, and closing prices plus volume metrics.

2. Daily OHLCV Data Analysis

Retrieve daily OHLCV data for a full week to support longer-term trend analysis with reduced data granularity.

curl -X GET "https://api.cambrian.org/solana/ohlcv/token?token_address=So11111111111111111111111111111111111111112&after_time=1735689600&before_time=1736294400&interval=1d" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response:

[
  {
    "columns": [
      {
        "name": "openPrice",
        "type": "Nullable(Float64)"
      },
      {
        "name": "highPrice",
        "type": "Nullable(Float64)"
      },
      {
        "name": "lowPrice",
        "type": "Nullable(Float64)"
      },
      {
        "name": "closePrice",
        "type": "Nullable(Float64)"
      },
      {
        "name": "volume",
        "type": "Nullable(Float64)"
      },
      {
        "name": "volumeToken",
        "type": "Nullable(Float64)"
      },
      {
        "name": "unixTime",
        "type": "Nullable(Int64)"
      },
      {
        "name": "interval",
        "type": "String"
      },
      {
        "name": "tokenAddress",
        "type": "String"
      }
    ],
    "data": [
      [
        189.65782030428116,
        191.19771269291377,
        189.58437185046847,
        190.00000000000003,
        282545393.3481766,
        1484786.4934918114,
        1735689600,
        "1d",
        "So11111111111111111111111111111111111111112"
      ],
      [
        205.95993992290852,
        208.07949378793484,
        205.8853442021006,
        207.90320000000003,
        402311189.4337393,
        1943426.4228084276,
        1735776000,
        "1d",
        "So11111111111111111111111111111111111111112"
      ],
      [
        208.02620046741387,
        216.34037107799142,
        206.73117908701826,
        215.6642832245662,
        93295132.31347863,
        447081.33486659755,
        1735862400,
        "1d",
        "So11111111111111111111111111111111111111112"
      ],
      [
        216.93213236976655,
        216.99026674175798,
        215.39225422045678,
        216.6632428457716,
        29157258.552583814,
        134891.08379508962,
        1735948800,
        "1d",
        "So11111111111111111111111111111111111111112"
      ],
      [
        212.832906441929,
        214.16558989838015,
        212.73748647845593,
        213.4164972681658,
        225194163.00528666,
        1054759.4801058057,
        1736035200,
        "1d",
        "So11111111111111111111111111111111111111112"
      ],
      [
        213.3476856835307,
        218.33239419940801,
        213.07537303596683,
        218.1433434538596,
        141540307.9812308,
        657090.9383419061,
        1736121600,
        "1d",
        "So11111111111111111111111111111111111111112"
      ],
      [
        212.0663999414671,
        216.39604367789576,
        204.34945631796026,
        204.58701227454648,
        60940467.61426936,
        289884.51315699256,
        1736208000,
        "1d",
        "So11111111111111111111111111111111111111112"
      ],
      [
        202.13072878400698,
        202.13072878400698,
        202.13072878400698,
        202.13072878400698,
        3.300586,
        0.016328967,
        1736294400,
        "1d",
        "So11111111111111111111111111111111111111112"
      ]
    ],
    "rows": 8
  }
]

This daily aggregation shows 8 days of price action for Wrapped SOL, including a notable rally from roughly $190 to over $215 mid-week, followed by a pullback. Daily granularity is well suited for swing trading and position analysis.

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/solana/ohlcv/token"
);
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/token")
        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–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/pool - Retrieve OHLCV data for individual pool contracts enabling pair-specific price analysis and liquidity venue performance tracking
  • /solana/tokens - Returns a paginated list of known tokens for the Solana chain
  • /solana/tokens/holder-distribution-over-time - Returns the distribution of token holders over a certain block range, at a certain interval, grouped by USD value tiers
  • /solana/tokens/security - Provides comprehensive security analysis for a token on Solana, including ownership concentration, holder distribution, and transaction metrics