Cambrian OHLCV (Base/Quote) API
GET /api/v1/solana/ohlcv/base-quote
OHLCV (Base/Quote)
Overview
Retrieve granular OHLCV data with separate base and quote token volumes for detailed trading analysis between any two SPL tokens. This is the most detailed view available of a trading relationship, with individual token flow tracked on each side for advanced analytics. Use it when you need to see how volume splits between the base and quote sides of a trading pair.
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://api.cambrian.org/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. One of: 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 | Nullable(Float64) | Highest price during the interval |
| lowPrice | Nullable(Float64) | Lowest price during the interval |
| closePrice | Nullable(Float64) | Closing price for the interval |
| volume | Nullable(Float64) | Total trading volume for the interval |
| volumeBase | Nullable(Float64) | Trading volume denominated in the base token for the interval |
| unixTime | Nullable(Int64) | Unix timestamp marking the start of the interval |
| interval | String | Time interval used for aggregation (e.g. 1h) |
| baseTokenAddress | String | Base token mint address (base58 format) |
| quoteTokenAddress | String | Quote token mint address (base58 format) |
| tradeCount | UInt64 | Number of trades recorded during the interval |
| poolCount | UInt64 | Number of distinct pools contributing to the interval's data |
| providerCount | UInt64 | Number of distinct liquidity providers/venues contributing to the interval's data |
Examples
1. Retrieve hourly OHLCV data for a SOL/USDC pair
This example fetches hourly OHLCV data for the SOL/USDC pair over a specified time range. Each interval includes separate base and quote volume metrics.
curl -X GET "https://api.cambrian.org/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.695717169467,
189.51810429757174,
190.14084507042253,
21410089.416325193,
112342.39220576087,
1735689600,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
32391,
37,
4
],
[
191.1272048166425,
191.6285651350636,
190.3136686537508,
190.89813708021254,
17247066.059550855,
90314.1759343398,
1735693200,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
27985,
35,
3
],
[
190.3021719786612,
191.26610199990643,
190.26828564932876,
191.14794361550693,
17686310.04413288,
92758.91703103311,
1735696800,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
23762,
32,
3
],
[
190.77370333885284,
190.84877516598925,
189.97734164925717,
190.02427516753872,
12383865.196407959,
65042.30334346957,
1735700400,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
20926,
33,
3
],
[
189.41637,
189.81096002077487,
189.07539859510078,
189.0830825089519,
15068663.568698956,
79550.80894114784,
1735704000,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
24144,
35,
3
],
[
189.9223938441478,
190.0489466975094,
189.26210239321418,
189.74888458101702,
14201329.27261292,
74850.07611125475,
1735707600,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
23280,
27,
4
],
[
189.7160209783157,
189.7794947553121,
189.193703,
189.74209811906147,
12991105.70199395,
68572.05439734722,
1735711200,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
21721,
24,
3
],
[
189.78531011158185,
189.7948884840379,
189.37686735413732,
189.64019776006458,
11790684.978162955,
62188.13235922013,
1735714800,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
21449,
19,
3
],
[
189.6654225921158,
190.175179400185,
189.0953685809023,
189.11411684309033,
16512894.902367944,
87089.9436624573,
1735718400,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
25899,
32,
3
],
[
189.02400110133593,
189.10101838931757,
187.8698621608887,
188.92087759356696,
19406301.78602204,
103046.51770799233,
1735722000,
"1h",
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
29708,
35,
3
]
],
"rows": 24
}
]
Result collections are limited to 10 items. Each row represents one hourly interval and includes separate volume (quote-denominated) and volumeBase (base-denominated) figures, plus trade, pool, and provider counts for the SOL/USDC pair.
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/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://x402.cambrian.org/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 through 5 automatically.
Network: Base (chain ID 8453) | Currency: USDC | Price: $0.05 per request
Related Endpoints
- /solana/ohlcv/pool - Retrieve OHLCV data for individual pool contracts for pair-specific price analysis and liquidity venue performance tracking.
- /solana/ohlcv/token - Retrieve Open, High, Low, Close, and Volume data for any SPL token.
- /solana/price-volume/multi - Retrieve current USD price, timeframe volume, and percentage changes for any SPL token.
- /solana/trade-statistics - Get instant trade analytics and performance metrics for any SPL tokens.
- /solana/token-pool-search - Find pools containing a specific token and retrieve comprehensive trading statistics.