Price Data · 10,000+ Tokens · Real-Time

Crypto Price Oracle API
for AI Agents

Accurate, real-time crypto prices from 50+ DEX and CEX sources. Give your AI agent the market data it needs to trade, manage risk, and evaluate positions — with zero rate limits on the free tier.

View API Docs Get Free API Key
10k+
Tokens
50+
Price Sources
<50ms
Avg Latency
2yr
History Depth
275
Perp Markets

Why AI Agents Need a Reliable Price Oracle

Autonomous AI agents operating in crypto markets depend on accurate, low-latency price data as a foundational primitive. Whether an agent is executing a trading strategy, monitoring collateral health in a DeFi protocol, or deciding whether to sell an NFT, every financial decision starts with price.

The challenge is that crypto prices fragment across hundreds of venues — centralized exchanges, AMMs, order-book DEXes, and perpetual markets all quote different prices at any given moment. A naive agent that reads only one source will be systematically exploited by stale quotes, front-running, and wash trades.

Purple Flea's price oracle aggregates feeds from 50+ DEX and CEX sources, applies outlier filtering, and exposes clean endpoints purpose-built for agent consumption. You get the aggregated mid-price, confidence intervals, and volume-weighted averages — not raw exchange ticks that require additional processing.

Price Feed Features

Spot Price (Real-Time)

Volume-weighted average price across all active venues. Updated every 250ms. Includes bid/ask spread and 24h change.

TWAP Feeds

Time-weighted average price over configurable windows (5m, 15m, 1h, 4h, 24h). Manipulation-resistant. Chainlink-compatible response format.

📈

OHLCV Candles

Full candlestick data at 1m, 5m, 15m, 1h, 4h, and 1d intervals. Up to 2 years of historical depth for backtesting and trend analysis.

📄

Historical Data

Query price history with start/end timestamps. Returns JSON arrays suitable for direct ingestion into agent context windows.

🔗

Chainlink-Compatible Format

Response schema mirrors Chainlink AggregatorV3Interface. Drop-in compatible with agents already built for Chainlink oracles.

📤

Batch Queries

Fetch up to 100 token prices in a single request. Eliminate N+1 query patterns in portfolio-evaluation agents.

Supported Assets and Markets

Purple Flea's price oracle covers a comprehensive universe of crypto assets, from the largest blue chips to long-tail ERC-20 tokens with low liquidity:

API Endpoints

Endpoint Method Description
/price/{token} GET Real-time spot price for a single token (symbol or contract address)
/price/batch GET Fetch up to 100 token prices in one call. Pass tokens as comma-separated query param.
/price/history GET Historical price data. Params: token, from (unix), to (unix), interval
/price/twap GET TWAP over a specified window. Returns Chainlink-compatible price + timestamp.
/price/ohlcv GET OHLCV candlestick data. Params: token, interval (1m/5m/1h/1d), limit
/price/perp/{market} GET Perpetual market mark price, index price, and funding rate

Code Examples

Fetch ETH Spot Price

javascript Fetch ETH spot price
const PURPLE_FLEA_KEY = 'pf_your_api_key_here';

async function getEthPrice() {
  const res = await fetch(
    'https://purpleflea.com/api/price/ETH',
    { headers: { 'Authorization': `Bearer ${PURPLE_FLEA_KEY}` } }
  );
  const { price, timestamp, source_count } = await res.json();

  console.log(`ETH: $${price} (aggregated from ${source_count} sources)`);
  // ETH: $2847.23 (aggregated from 47 sources)

  return price;
}

Batch-Fetch Portfolio Prices

javascript Evaluate entire portfolio in one request
async function valuatePortfolio(holdings) {
  // holdings = { ETH: 2.5, BTC: 0.1, USDC: 5000, ARB: 1000 }
  const tokens = Object.keys(holdings).join(',');
  const res = await fetch(
    `https://purpleflea.com/api/price/batch?tokens=${tokens}`,
    { headers: { 'Authorization': `Bearer ${PURPLE_FLEA_KEY}` } }
  );
  const { prices } = await res.json();

  let totalUsd = 0;
  for (const [token, amount] of Object.entries(holdings)) {
    totalUsd += amount * prices[token];
  }

  return { totalUsd, prices };
}

7-Day OHLCV for Technical Analysis

javascript Fetch 1-hour candles for the last 7 days
async function getWeeklyOHLCV(token) {
  const res = await fetch(
    `https://purpleflea.com/api/price/ohlcv?token=${token}&interval=1h&limit=168`,
    { headers: { 'Authorization': `Bearer ${PURPLE_FLEA_KEY}` } }
  );
  const { candles } = await res.json();
  // candles = [{ t, o, h, l, c, v }, ...]

  const high7d = Math.max(...candles.map(c => c.h));
  const low7d  = Math.min(...candles.map(c => c.l));
  console.log(`${token} 7d range: $${low7d} – $${high7d}`);

  return candles;
}

Agent Use Cases

📈

Portfolio Valuation

Agents periodically poll batch price endpoint to compute real-time portfolio NAV and trigger rebalancing decisions.

🟠

Take-Profit / Stop-Loss

Subscribe to price updates and automatically execute exit orders when threshold prices are crossed.

Arbitrage Detection

Compare spot prices across multiple assets in a single batch call to detect cross-asset or cross-venue arbitrage opportunities.

🛠

Risk-Adjusted Sizing

Use TWAP and volatility data to compute Kelly-criterion position sizes or VaR-based risk budgets before entry.

📋

Collateral Monitoring

DeFi agents watch collateral-to-debt ratios using real-time prices and trigger protective actions before liquidation.

🔭

Trend Analysis

Pull OHLCV candles into agent context to compute moving averages, RSI, and Bollinger Bands for directional bias.

Rate Limits and Pricing

Free
$0 / month
  • 100 requests / minute
  • Spot price endpoint
  • Batch up to 10 tokens
  • 7-day OHLCV history
  • No credit card required
Enterprise
Custom
  • Unlimited requests
  • Dedicated infrastructure
  • Custom aggregation logic
  • Priority support
  • On-premise deployment

Related APIs and Tools

The price oracle is one component of Purple Flea's full financial infrastructure suite for AI agents.