Cambrian Trade Statistics API
GET /api/v1/solana/trade-statistics
Trade Statistics
Overview
Retrieve instant trade analytics and performance metrics for one or more Solana SPL tokens. The endpoint returns buy/sell volume breakdowns, trade counts, and USD values over a configurable timeframe, along with a buy-to-sell ratio for quick market sentiment analysis.
Business Value
- Real-Time Analytics: Get instant trade statistics for any Solana token with up-to-date buy/sell volume data
- Market Insights: Access comprehensive metrics including trade counts, volume ratios, and USD values for informed decision-making
- Portfolio Tracking: Monitor performance across multiple tokens with customizable timeframes from 1 hour to 30 days
- Trading Intelligence: Leverage buy-to-sell ratios and volume breakdowns to understand market sentiment and trading patterns
- Dashboard Integration: Perfect for building performance dashboards and market analysis tools with structured data
Endpoint Details
URL:
https://api.cambrian.org/solana/trade-statistics
Method: GET
Authentication: Required via X-API-Key header
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| token_addresses | String | Yes | - | Comma-separated token addresses (e.g., So11111111111111111111111111111111111111112) |
| timeframe | String | Yes | - | Time interval: 1h, 4h, 12h, 24h, 7d |
Response Field Descriptions
| Response Field | Type | Description |
|---|---|---|
| tokenAddress | String | The SPL token mint address |
| timeframe | String | The requested time interval for the statistics |
| buyCount | UInt64 | Number of buy trades in the timeframe |
| sellCount | UInt64 | Number of sell trades in the timeframe |
| totalTradeCount | UInt64 | Total number of trades (buys + sells) in the timeframe |
| volumeBuy | Float64 | Buy volume denominated in the token's native units |
| volumeSell | Float64 | Sell volume denominated in the token's native units |
| totalVolume | Float64 | Total trade volume (buy + sell) in the token's native units |
| volumeBuyUSD | Float64 | Buy volume converted to USD |
| volumeSellUSD | Float64 | Sell volume converted to USD |
| totalVolumeUSD | Float64 | Total trade volume (buy + sell) converted to USD |
| buyToSellRatio | Nullable(Float64) | Ratio of buy volume to sell volume; values above 1 indicate net buying pressure |
Examples
1. Single Token Trade Statistics (24h)
Retrieve 24-hour trade statistics for Wrapped SOL to assess recent trading activity.
curl -X GET "https://api.cambrian.org/solana/trade-statistics?token_addresses=So11111111111111111111111111111111111111112&timeframe=24h" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"
Response:
[
{
"columns": [
{ "name": "tokenAddress", "type": "String" },
{ "name": "timeframe", "type": "String" },
{ "name": "buyCount", "type": "UInt64" },
{ "name": "sellCount", "type": "UInt64" },
{ "name": "totalTradeCount", "type": "UInt64" },
{ "name": "volumeBuy", "type": "Float64" },
{ "name": "volumeSell", "type": "Float64" },
{ "name": "totalVolume", "type": "Float64" },
{ "name": "volumeBuyUSD", "type": "Float64" },
{ "name": "volumeSellUSD", "type": "Float64" },
{ "name": "totalVolumeUSD", "type": "Float64" },
{ "name": "buyToSellRatio", "type": "Nullable(Float64)" }
],
"data": [
[
"So11111111111111111111111111111111111111112",
"24h",
9461678,
14059850,
23521528,
39080876.11428526,
39379760.06464342,
78460636.17892867,
2895566611.65415,
2917711416.8239617,
5813278028.478111,
0.9924
]
],
"rows": 1
}
]
Wrapped SOL saw roughly 23.5M total trades in the last 24 hours. The buyToSellRatio of 0.9924 shows sell volume slightly exceeded buy volume (~$5.8B total volume in USD).
2. Multi-Token Trade Statistics (1h)
Compare short-term trading activity between Wrapped SOL and USDC in a single request.
curl -X GET "https://api.cambrian.org/solana/trade-statistics?token_addresses=So11111111111111111111111111111111111111112,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&timeframe=1h" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"
Response:
[
{
"columns": [
{ "name": "tokenAddress", "type": "String" },
{ "name": "timeframe", "type": "String" },
{ "name": "buyCount", "type": "UInt64" },
{ "name": "sellCount", "type": "UInt64" },
{ "name": "totalTradeCount", "type": "UInt64" },
{ "name": "volumeBuy", "type": "Float64" },
{ "name": "volumeSell", "type": "Float64" },
{ "name": "totalVolume", "type": "Float64" },
{ "name": "volumeBuyUSD", "type": "Float64" },
{ "name": "volumeSellUSD", "type": "Float64" },
{ "name": "totalVolumeUSD", "type": "Float64" },
{ "name": "buyToSellRatio", "type": "Nullable(Float64)" }
],
"data": [
[
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"1h",
10002,
10583,
20585,
3874949.065586,
3855149.96228,
7730099.027866,
3874949.065586,
3855149.96228,
7730099.027866,
1.0051
],
[
"So11111111111111111111111111111111111111112",
"1h",
403707,
623668,
1027375,
1469929.681518283,
1486747.432879488,
2956677.1143977707,
108845430.57028665,
110090752.30992499,
218936182.88021165,
0.9887
]
],
"rows": 2
}
]
In the last hour, USDC (buyToSellRatio 1.0051) saw slightly more buy volume than sell volume, while Wrapped SOL (buyToSellRatio 0.9887) saw slightly more sell volume. Both results came back from a single request.
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/trade-statistics"
);
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/trade-statistics")
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/token-details- Retrieves comprehensive details about a Solana token, including price history, trade statistics, holder information, and other key metrics/solana/token-details-multi- Retrieve comprehensive details for multiple Solana tokens simultaneously/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/traders/leaderboard- Leaderboard of the top traders by trade count, buy/sell/total volume for any SPL token across major Solana DEXs/solana/token-transactions- Retrieve a paginated list of trades/transactions for a specified Solana token address across all DEXes