Token Volume API
- How to fetch volume data for any token
- Analyzing buy/sell ratios and volume trends
- Calculate volume deltas and momentum
- Convert lamports to SOL for better readability
Introduction
The Token Volume API enables you to retrieve and analyze trading volume data for any token. You can track buy/sell patterns, analyze volume trends across multiple timeframes, and monitor trading activity. All volume values are denominated in SOL and formatted in lamports (1 SOL = 1,000,000,000 lamports).
- Valid API key (visit https://app.callstatic.com for tier information)
- Rate limits and data access vary by subscription tier
Authentication
All requests require a Bearer token in UUID format:
Authorization: Bearer your-api-key-here
Base URL
https://api.callstaticrpc.com/pumpfun/v1
Data Structure
The API returns volume data with multiple time windows:
- Response Structure
{
"success": true,
"data": {
"token": "BbB3bB7bB2bB9bB4bB8bB1bBb5bB2bB6bB3bB9bB4bB",
"name": "Sample Token",
"symbol": "STKN",
// Short-term volumes
"buy_volume_1m": "1000000000", // 1 SOL in buys last minute
"buy_volume_5m": "5000000000",
"buy_volume_15m": "15000000000",
"buy_volume_30m": "30000000000",
// Medium-term volumes
"buy_volume_1h": "60000000000",
"buy_volume_4h": "240000000000",
// Long-term volumes
"buy_volume_24h": "1440000000000",
"buy_volume_1w": "10080000000000",
// Sell volumes follow same pattern
"sell_volume_1m": "900000000",
"sell_volume_5m": "4500000000",
"sell_volume_15m": "13500000000",
"sell_volume_30m": "27000000000",
"sell_volume_1h": "54000000000",
"sell_volume_4h": "216000000000",
"sell_volume_24h": "1296000000000",
"sell_volume_1w": "9072000000000",
// Last trade timestamps
"last_buy_timestamp": 1679529600000,
"last_sell_timestamp": 1679529600000
}
}
Implementation
Here's how to implement volume analysis in your application:
- TypeScript
- Python
import axios from 'axios';
interface TokenVolume {
token: string;
name: string;
symbol: string;
buy_volume_1m: string;
buy_volume_5m: string;
buy_volume_15m: string;
buy_volume_30m: string;
buy_volume_1h: string;
buy_volume_4h: string;
buy_volume_24h: string;
buy_volume_1w: string;
sell_volume_1m: string;
sell_volume_5m: string;
sell_volume_15m: string;
sell_volume_30m: string;
sell_volume_1h: string;
sell_volume_4h: string;
sell_volume_24h: string;
sell_volume_1w: string;
last_buy_timestamp: number;
last_sell_timestamp: number;
}
class VolumeAnalyzer {
private readonly LAMPORTS_PER_SOL = 1_000_000_000;
// Convert lamports string to SOL number
private lamportsToSol(lamports: string): number {
return parseInt(lamports) / this.LAMPORTS_PER_SOL;
}
// Calculate buy/sell ratio for a timeframe
calculateBuySellRatio(volume: TokenVolume, timeframe: string): number {
const buyKey = `buy_volume_${timeframe}` as keyof TokenVolume;
const sellKey = `sell_volume_${timeframe}` as keyof TokenVolume;
const buyVolume = this.lamportsToSol(volume[buyKey] as string);
const sellVolume = this.lamportsToSol(volume[sellKey] as string);
return sellVolume === 0 ? buyVolume : buyVolume / sellVolume;
}
// Calculate volume deltas between timeframes
calculateVolumeTrend(volume: TokenVolume): {
shortTerm: number; // 5m vs 1h
mediumTerm: number; // 1h vs 4h
longTerm: number; // 4h vs 24h
} {
return {
shortTerm: this.lamportsToSol(volume.buy_volume_5m) / 12 -
this.lamportsToSol(volume.buy_volume_1h) / 12,
mediumTerm: this.lamportsToSol(volume.buy_volume_1h) / 4 -
this.lamportsToSol(volume.buy_volume_4h) / 4,
longTerm: this.lamportsToSol(volume.buy_volume_4h) / 6 -
this.lamportsToSol(volume.buy_volume_24h) / 6
};
}
// Analyze overall volume momentum
analyzeVolumeMomentum(volume: TokenVolume): {
momentum: 'increasing' | 'decreasing' | 'stable';
strength: number;
} {
const trends = this.calculateVolumeTrend(volume);
const avgTrend = (trends.shortTerm + trends.mediumTerm + trends.longTerm) / 3;
return {
momentum: avgTrend > 0.1 ? 'increasing' :
avgTrend < -0.1 ? 'decreasing' : 'stable',
strength: Math.abs(avgTrend)
};
}
// Get time since last trade
getTimeSinceLastTrade(volume: TokenVolume): {
lastBuy: number;
lastSell: number;
} {
const now = Date.now();
return {
lastBuy: now - volume.last_buy_timestamp,
lastSell: now - volume.last_sell_timestamp
};
}
}
from typing import Dict, Any
from dataclasses import dataclass
import time
@dataclass
class VolumeTrend:
short_term: float # 5m vs 1h
medium_term: float # 1h vs 4h
long_term: float # 4h vs 24h
@dataclass
class VolumeMomentum:
momentum: str # 'increasing' | 'decreasing' | 'stable'
strength: float
class VolumeAnalyzer:
LAMPORTS_PER_SOL = 1_000_000_000
def lamports_to_sol(self, lamports: str) -> float:
return int(lamports) / self.LAMPORTS_PER_SOL
def calculate_buy_sell_ratio(
self,
volume: Dict[str, Any],
timeframe: str
) -> float:
buy_volume = self.lamports_to_sol(volume[f'buy_volume_{timeframe}'])
sell_volume = self.lamports_to_sol(volume[f'sell_volume_{timeframe}'])
return buy_volume if sell_volume == 0 else buy_volume / sell_volume
def calculate_volume_trend(self, volume: Dict[str, Any]) -> VolumeTrend:
return VolumeTrend(
short_term=(
self.lamports_to_sol(volume['buy_volume_5m']) / 12 -
self.lamports_to_sol(volume['buy_volume_1h']) / 12
),
medium_term=(
self.lamports_to_sol(volume['buy_volume_1h']) / 4 -
self.lamports_to_sol(volume['buy_volume_4h']) / 4
),
long_term=(
self.lamports_to_sol(volume['buy_volume_4h']) / 6 -
self.lamports_to_sol(volume['buy_volume_24h']) / 6
)
)
def analyze_volume_momentum(self, volume: Dict[str, Any]) -> VolumeMomentum:
trends = self.calculate_volume_trend(volume)
avg_trend = (
trends.short_term +
trends.medium_term +
trends.long_term
) / 3
return VolumeMomentum(
momentum='increasing' if avg_trend > 0.1 else
'decreasing' if avg_trend < -0.1 else 'stable',
strength=abs(avg_trend)
)
def get_time_since_last_trade(
self,
volume: Dict[str, Any]
) -> Dict[str, int]:
now = int(time.time() * 1000)
return {
'last_buy': now - volume['last_buy_timestamp'],
'last_sell': now - volume['last_sell_timestamp']
}
Analysis Techniques
1. Volume Ratios
Compare buy and sell volumes to identify trading patterns:
- Buy/Sell ratio > 1: More buying pressure
- Buy/Sell ratio < 1: More selling pressure
- Track ratios across timeframes to spot trends
2. Volume Deltas
Calculate volume changes between timeframes:
- Short-term: 5m vs 1h (normalized)
- Medium-term: 1h vs 4h (normalized)
- Long-term: 4h vs 24h (normalized)
3. Volume Momentum
Analyze volume trends to determine market momentum:
- Increasing: Higher recent volume
- Decreasing: Lower recent volume
- Stable: Consistent volume
4. Trade Timing
Monitor time since last trades:
- Recent trades indicate active trading
- Long gaps may indicate low liquidity
- Compare buy vs sell timing patterns
Error Handling
The API returns standard HTTP status codes:
Status Code | Description |
---|---|
200 | Successful response |
400 | Bad request |
401 | Unauthorized - Invalid or missing bearer token |
500 | Internal server error |
For real-time volume updates, check out our WebSocket Streams API documentation.
For additional support:
- Email us at [email protected]
- Visit our Support Portal