Cambrian OHLCV (Token) API
GET /api/v1/solana/ohlcv/token
OHLCV Token Data
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.
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://opabinia.cambrian.network/api/v1/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 | Float64 | Opening price at the start of the interval |
| highPrice | Float64 | Highest price reached during the interval |
| lowPrice | Float64 | Lowest price reached during the interval |
| closePrice | Float64 | Closing price at the end of the interval |
| volume | Float64 | Total USD volume traded during the interval |
| volumeToken | Float64 | Total token volume traded during the interval |
| unixTime | 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 price movements and trading volumes.
curl -X GET "https://opabinia.cambrian.network/api/v1/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.4770836346861,
189.93100587634544,
190.14084507042253,
18433233.29374507,
96657.4169866213,
1735689600,
"1h",
"So11111111111111111111111111111111111111112"
],
[
191.1272048166425,
191.4632854945828,
190.65107522301233,
190.89813708021254,
14723596.821315018,
77077.18165775396,
1735693200,
"1h",
"So11111111111111111111111111111111111111112"
],
[
190.7510665087174,
191.16297183433701,
190.41934981386405,
191.14176965009318,
15075651.224110948,
79044.96818876867,
1735696800,
"1h",
"So11111111111111111111111111111111111111112"
],
[
190.77370333885284,
190.84202939230298,
190.0833987111111,
190.83916061077238,
11043385.92644398,
57972.059895550534,
1735700400,
"1h",
"So11111111111111111111111111111111111111112"
],
[
189.41637,
189.79612854834988,
189.23203463610514,
189.4499725170332,
13547883.640036006,
71497.11679280906,
1735704000,
"1h",
"So11111111111111111111111111111111111111112"
]
],
"rows": 5
// ... additional rows omitted for brevity
}
The response shows hourly OHLCV data for Wrapped SOL with prices around $190 USD and significant trading volume over $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 longer-term trend analysis and reduced data granularity.
curl -X GET "https://opabinia.cambrian.network/api/v1/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": [
[
190.02896429484457,
194.46551005885414,
188.04152073739706,
193.7272438533426,
400000000.0,
2000000.0,
1735689600,
"1d",
"So11111111111111111111111111111111111111112"
]
],
"rows": 1
}
This daily aggregation shows the token's full price range and total volume over the entire day, providing a broader view of market activity suitable 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://deep42.cambrian.network/api/v1/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://deep42.cambrian.network/api/v1/solana/ohlcv/token")
print(response.json())
asyncio.run(main())
Payment Flow
- Send a normal request to the endpoint (no API key needed)
- Server returns
402 Payment Requiredwith payment details - The x402 SDK automatically signs a payment authorization with your wallet
- The SDK resubmits the request with the signed payment
- 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
/api/v1/solana/ohlcv/base-quote- Retrieve granular OHLCV data with separate base and quote token volumes for detailed trading analysis between any two SPL tokens/api/v1/solana/ohlcv/pool- Retrieve OHLCV data for individual pool contracts enabling pair-specific price analysis and liquidity venue performance tracking/api/v1/solana/tokens- Returns a paginated list of known tokens for the Solana chain/api/v1/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