CRYPTO MARKET DATA API
Real-time
Multi-DEX
Aggregated Prices
Access aggregated prices, funding rates, liquidation data, and risk metrics from 8+ DEXes and major CEXes. Pay per request with USDC on Base (x402) or Tempo (MPP). No subscriptions, no API keys.
FEATURES
Everything you need for crypto data
Multi-DEX Aggregation
Volume-weighted prices from Uniswap, SushiSwap, Curve, BaseSwap, Aerodrome, and 3 more DEXes.
Arbitrage Detection
Real-time cross-DEX arbitrage opportunities with profit calculations and gas estimates.
Risk Metrics
Volatility, VaR, Sharpe ratio, and sentiment analysis for informed trading decisions.
Real-time Data
30-second cache TTL, up to 500 req/min. Fresh data for high-frequency trading.
Funding Rates
Real-time and historical perpetual funding rates. Track extreme rates for trading signals.
Liquidation Tracking
Liquidation heatmaps, recent cascades, and real-time alerts for risk management.
CEX Market Data
Aggregated CEX prices, market details, and historical data from major exchanges.
Historical OHLCV
Candlestick data with 1m, 5m, 1h, 1d intervals. Up to 1 year history.
Price Alerts
Webhook notifications when price hits your target. Perfect for trading bots.
Futures Analytics
Cross-exchange open interest, long/short ratios, basis, and predicted funding from Binance, OKX, and Bybit.
ENDPOINTS AND PRICING
Pay-as-you-go with x402
No subscriptions, no API keys. Pay per request with USDC on Base. Same request within 30s is free (cached).
DEX Endpoints
| Endpoint | Price | Description |
|---|---|---|
| GET /price/:symbol | $0.01 | Real-time aggregated price from 8+ DEXes |
| GET /price/history/:symbol | $0.02 | Historical OHLCV candlestick data |
| GET /volume/:symbol | $0.02 | 24h trading volume across all DEXes |
| GET /spread/:pair | $0.02 | Bid/ask spread analysis |
| GET /arbitrage-opportunity | $0.05 | Cross-DEX arbitrage scanner |
| GET /volatility-index/:symbol | $0.03 | Risk metrics: VaR, Sharpe, volatility |
| POST /price-alert | $0.04 | Create webhook price alert |
| POST /price-alert/:id/extend | $0.02 | Extend price alert duration |
Funding Rate Endpoints
| Endpoint | Price | Description |
|---|---|---|
| GET /funding-rate/:symbol | $0.02 | Current perpetual funding rate with signal |
| GET /funding-rate/history/:symbol | $0.03 | Historical funding rate data |
| GET /funding-rate/extreme | $0.02 | Extreme funding rates scanner across markets |
Liquidation Endpoints
| Endpoint | Price | Description |
|---|---|---|
| GET /liquidation/heatmap/:symbol | $0.05 | Liquidation heatmap with cascade risk levels |
| GET /liquidation/recent | $0.03 | Recent liquidations with long/short breakdown |
| POST /liquidation/alert | $0.06 | Create liquidation cascade alert webhook |
| POST /liquidation/alert/:id/extend | $0.03 | Extend liquidation alert duration |
CEX Market Data (v1)
| Endpoint | Price | Description |
|---|---|---|
| GET /api/v1/prices | $0.005 | Batch CEX prices via Binance/CoinGecko (e.g. ?symbols=btc,eth,sol) |
| GET /api/v1/market/:id | $0.005 | Market details by CoinGecko ID (e.g. bitcoin) |
| GET /api/v1/market/:id/history | $0.01 | Historical market data from CEX sources |
Futures Analytics
| Endpoint | Price | Description |
|---|---|---|
| GET /futures/funding-compare/:symbol | $0.03 | Cross-exchange funding rate comparison (Binance, OKX, Bybit) |
| GET /futures/open-interest/:symbol | $0.03 | Aggregated open interest across 3 exchanges |
| GET /futures/long-short/:symbol | $0.02 | Top traders long/short ratio |
| GET /futures/basis/:symbol | $0.02 | Spot vs perpetual basis (carry-trade signal) |
| GET /futures/predicted-funding/:symbol | $0.02 | Predicted next funding rate |
Free Endpoints
| Endpoint | Price | Description |
|---|---|---|
| GET /health | FREE | Health check |
| GET /api/v1/status | FREE | Detailed system status |
| GET /price-alert/:id | FREE | Check price alert status by ID |
| DELETE /price-alert/:id | FREE | Cancel price alert |
| GET /price-alerts | FREE | List all active price alerts |
| GET /liquidation/alerts | FREE | List all active liquidation alerts |
| GET /liquidation/alert/:id | FREE | Check liquidation alert status |
| DELETE /liquidation/alert/:id | FREE | Cancel a liquidation alert |
| GET / | FREE | API info and available endpoints |
| GET /openapi.json | FREE | OpenAPI specification |
| GET /.well-known/x402.json | FREE | x402 payment discovery |
USDC on Base
Chain ID 8453
30s Free Cache
Same request = no charge
No API Key
Just your wallet
INTEGRATION
Get started in 5 minutes
// Install: npm install @x402/fetch viem
import { wrapFetchWithPayments } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";
import { createWalletClient, http } from "viem";
import { base } from "viem/chains";
// Setup wallet on Base
const account = privateKeyToAccount("0x...");
const walletClient = createWalletClient({
account,
chain: base,
transport: http("https://mainnet.base.org"),
});
// Create payment-enabled fetch
const fetchWithPayment = wrapFetchWithPayments(fetch, {
client: walletClient,
});
// Make request (auto-payment!)
const res = await fetchWithPayment(
"https://api.foursec.xyz/price/ETH"
);
const data = await res.json();
console.log(`ETH: $${data.price_usd}`);# Step 1: Initial request returns 402
curl -i https://api.foursec.xyz/price/ETH
# Response: 402 Payment Required
# X-PAYMENT: {"scheme":"exact-evm",...}
# Step 2: Use x402 CLI for auto-payment
npx x402-cli fetch \
https://api.foursec.xyz/price/ETH \
--key 0x_your_private_key
# Step 3: Response with data
# {"symbol":"ETH","price_usd":2450.32,...}# Install: pip install httpx web3 eth-account
import httpx
# Step 1: Get payment requirements
resp = httpx.get("https://api.foursec.xyz/price/ETH")
# Returns 402 with X-PAYMENT header
payment = resp.headers.get("x-payment")
# Step 2: Sign USDC transfer on Base
# Step 3: Retry with payment proof
# (Use JavaScript SDK for simpler flow)
# Recommended: Use the JavaScript SDK
# which handles everything automaticallyHow x402 Works
- 1
Request data
Your app calls the API endpoint
- 2
402 Payment Required
API returns payment details in X-PAYMENT header
- 3
Sign USDC transfer
SDK signs payment from your wallet on Base
- 4
Retry with proof
Client retries request with payment proof
- 5
Data returned
API verifies payment and returns data. Cost: $0.01
💡 Pro tip: The @x402/fetch SDK handles all payment logic automatically. Just call fetchWithPayment(url) and it works!
BY THE NUMBERS
Built for performance
37
API Endpoints
8+
DEX Sources
<100ms
Avg Latency
30s
Cache TTL
Ready to get started?
Start using 4SEC API today. No credit card, no signup form. Just connect your wallet and pay as you go.
✓ No API key required
✓ Pay with USDC on Base
✓ 30s free cache window