Cambrian OHLCV (Base/Quote) API
GET /api/v1/solana/ohlcv/base-quote
OHLCV (Base/Quote)
Retrieve granular OHLCV data with separate base and quote token volumes for detailed trading analysis between any two SPL tokens. Provides the most detailed view of trading relationships with individual token flow tracking for advanced analytics.
Business Value
- Granular Trading Analysis - Get separate volume metrics for both base and quote tokens to understand directional flow in trading pairs
- Advanced Analytics Support - Enable sophisticated trading strategy development with detailed OHLCV breakdowns by token direction
- Cross-Pool Aggregation - Analyze trading activity across multiple liquidity pools and providers for comprehensive market insights
- Time-Series Analysis - Support backtesting and trend analysis with configurable time intervals from 1 minute to 1 week
- Trading Performance Metrics - Access trade counts, pool participation, and provider diversity metrics alongside traditional OHLCV data
Endpoint Details
URL:
https://opabinia.cambrian.network/api/v1/solana/ohlcv/base-quote
Method: GET
Authentication: Required via X-API-Key header
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| base_address | string | Yes | - | Base token mint address (base58 format) |
| quote_address | string | Yes | - | Quote 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 during the interval |
| lowPrice | Float64 | Lowest price during the interval |
| closePrice | Float64 | Closing price at the end of the interval |
| volume | Float64 | Total trading volume in quote token units |
| volumeBase | Float64 | Total trading volume in base token units |
| unixTime | Int64 | Unix timestamp for the start of the interval |
| interval | String | Time interval used for aggregation |
| baseTokenAddress | String | Base token mint address |
| quoteTokenAddress | String | Quote token mint address |
| tradeCount | UInt64 | Number of trades executed during the interval |
| poolCount | UInt64 | Number of unique pools involved in trading |
| providerCount | UInt64 | Number of unique liquidity providers active |
Examples
1. SOL/USDC Hourly OHLCV Data
Get hourly OHLCV data for SOL/USDC trading pair over a 24-hour period with separate base and quote volume tracking.
curl -X GET "https://opabinia.cambrian.network/api/v1/solana/ohlcv/base-quote?base_address=So11111111111111111111111111111111111111112"e_address=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&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": "volumeBase",
"type": "Nullable(Float64)"
},
{
"name": "unixTime",
"type": "Nullable(Int64)"
},
{
"name": "interval",
"type": "String"
},
{
"name": "baseTokenAddress",
"type": "String"
},
{
"name": "quoteTokenAddress",
"type": "String"
},
{
"name": "tradeCount",
"type": "UInt64"
},
{
"name": "poolCount",
"type": "UInt64"
},
{
"name": "providerCount",
"type": "UInt64"
}
],
"data": [
[
189.6625243484793,
191.69857924475576,
189.5202432057958,
190.14084507042253,
21373337.092335183,
112148.033237472,
1735689600,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
32368,
37,
4
],
[
191.1272048166425,
191.66096942602314,
190.3173767247185,
190.31799131389295,
17415791.688727885,
91193.60784225282,
1735693200,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
28180,
35,
3
],
[
190.3021719786612,
191.2722346250416,
190.2729295348099,
191.23528817785046,
17730068.499396868,
92985.81582149817,
1735696800,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
23720,
33,
3
],
[
190.77370333885284,
190.8548409375,
189.98045546973677,
190.0193058619293,
12394358.789496953,
65096.715926526536,
1735700400,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
20950,
33,
3
],
[
189.41637,
189.81258900574196,
189.07711256849353,
189.0830825089519,
15054496.909352956,
79475.68581634284,
1735704000,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
24097,
35,
3
]
],
"rows": 5
// ... additional rows omitted for brevity
}
The response shows hourly OHLCV data for SOL/USDC with separate volume tracking. The data includes 24 hours of trading activity with price movements from $189-$194, high trading volumes exceeding 21M USDC equivalent, and consistent activity across 30+ pools with multiple liquidity providers.
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/base-quote"
);
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/base-quote")
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