Cambrian Trade Statistics API

By Cambrian Network solana

GET /api/v1/solana/trade-statistics

Trade Statistics

Get instant trade analytics and performance metrics for any SPL tokens. View buy/sell volume breakdowns, trade counts, and USD values across customizable timeframes (1h to 30d). Perfect for portfolio tracking, performance dashboards, and quick market 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://opabinia.cambrian.network/api/v1/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
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 timeframe (1h, 4h, 12h, 24h, 7d)
buyCount UInt64 Total number of buy transactions
sellCount UInt64 Total number of sell transactions
totalTradeCount UInt64 Combined buy and sell transaction count
volumeBuy Float64 Total volume of buy transactions in native token units
volumeSell Float64 Total volume of sell transactions in native token units
totalVolume Float64 Combined buy and sell volume in native token units
volumeBuyUSD Float64 USD value of buy volume
volumeSellUSD Float64 USD value of sell volume
totalVolumeUSD Float64 Combined USD value of all trades
buyToSellRatio Nullable(Float64) Ratio of buy volume to sell volume (null if no sells)

Examples

1. Get 24h Trade Statistics for SOL

Get comprehensive 24-hour trading statistics for Wrapped SOL token.

curl -X GET "https://opabinia.cambrian.network/api/v1/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",
        7636466,
        9926594,
        17563060,
        32832279.64900277,
        32804646.889137466,
        65636926.53814024,
        4157538072.631192,
        4154038947.6109357,
        8311577020.242128,
        1.0008
      ]
    ],
    "rows": 1
  }
]

The response shows SOL had over 17.5M trades in 24h with $8.3B total volume. The buy-to-sell ratio of 1.0008 indicates nearly balanced buying and selling pressure.

2. Get Hourly Trade Statistics for Multiple Tokens

Query multiple tokens with a shorter timeframe to track rapid market movements.

curl -X GET "https://opabinia.cambrian.network/api/v1/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": [
      [
        "So11111111111111111111111111111111111111112",
        "1h",
        318186,
        413609,
        731795,
        1368016.3537511664,
        1367456.1912378024,
        2735472.545988969,
        173301675.26516503,
        173230082.1928905,
        346531757.4580555,
        1.0004
      ],
      [
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "1h",
        125643,
        128975,
        254618,
        45782341.234567,
        46123789.876543,
        91906131.111110,
        45782341.234567,
        46123789.876543,
        91906131.111110,
        0.9926
      ]
    ],
    "rows": 2
  }
]

The response shows hourly statistics for both SOL and USDC, allowing comparison of trading activity between major tokens.

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/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://deep42.cambrian.network/api/v1/solana/trade-statistics")
        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

  • /api/v1/solana/tokens/holders - Returns a list of accounts currently holding a specific Solana token
  • /api/v1/solana/tokens/holders-over-time - Returns token holder snapshots at specified block intervals
  • /api/v1/solana/ohlcv/token - Retrieve Open, High, Low, Close, and Volume data for any SPL token
  • /api/v1/solana/orca/pools/fee-metrics - Get core metrics like fees, volume, TVL, and Fee APR for Orca pools
  • /api/v1/solana/orca/pools/historical-data - Retrieve historical daily fee and volume data for Orca pools