Real-time
Multi-DEX
Aggregated Prices

Access aggregated prices, arbitrage opportunities, and risk metrics from 8+ DEXes. Pay per request with USDC on Base via x402 protocol.

LIVE DEMO
GET /price/ETH
{
  "symbol": "ETH",
  "price_usd": 2450.32,
  "change_24h": "+2.45%",
  "sources": 3,
  "spread": "0.07%",
  "volume_24h": "$12.5M"
}
Cost: $0.01 USDCLatency: <100msCache: 30s TTL

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, 100 req/min rate limit. Fresh data for high-frequency trading.

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.

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).

EndpointPriceDescription
GET /price/:symbol$0.01Real-time aggregated price from 8+ DEXes
GET /volume/:symbol$0.0224h trading volume across all DEXes
GET /spread/:pair$0.02Bid/ask spread analysis
GET /price/history/:symbol$0.02Historical OHLCV candlestick data
GET /volatility-index/:symbol$0.03Risk metrics — VaR, Sharpe, volatility
POST /price-alert$0.04Create webhook price alert
GET /arbitrage-opportunity$0.05Cross-DEX arbitrage scanner
GET /api/v1/prices?symbols=btc,eth$0.005CEX prices from Binance/CoinGecko
GET /api/v1/market/:id$0.005Market details
GET /api/v1/market/:id/history$0.01Historical market data
GET /api/v1/statusFREEDetailed system status
GET /price-alert/:idFREECheck alert status
DELETE /price-alert/:idFREECancel alert
GET /healthFREEHealth check
GET /FREEAPI info & available endpoints
💳

USDC on Base

Chain ID 8453

30s Free Cache

Same request = no charge

🔑

No API Key

Just your wallet

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 automatically

How x402 Works

  1. 1

    Request data

    Your app calls the API endpoint

  2. 2

    402 Payment Required

    API returns payment details in X-PAYMENT header

  3. 3

    Sign USDC transfer

    SDK signs payment from your wallet on Base

  4. 4

    Retry with proof

    Client retries request with payment proof

  5. 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!

Built for performance

15

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