Skip to main content

Price API (Free)

The Price API provides 5 endpoints for fetching cryptocurrency prices and market data. These endpoints are free and do not require authentication -- you can call them without setting an access token.

tip

These methods work immediately after creating the engine client. No setAccessToken call is needed.

Methods

MethodParametersReturnsDescription
getCryptoPrices(symbols)symbols: string[]ApiResponse<TokenPrice[]>Returns current prices for multiple tokens in a single request.
getCryptoPrice(symbol)symbol: stringApiResponse<TokenPrice>Returns the current price for a single token.
getCryptoCandles(symbol, interval?, limit?)symbol: string, interval?: CandleInterval, limit?: numberApiResponse<CryptoCandle[]>Returns OHLCV candlestick data for a token.
getTopCryptos(limit?)limit?: numberApiResponse<TokenPrice[]>Returns top cryptocurrencies ranked by market cap.
getCryptoMarketOverview()--ApiResponse<MarketOverview>Returns aggregate market statistics.

Types

TokenPrice

interface TokenPrice {
symbol: string;
name: string;
/** Current price in USD. */
priceUsd: string;
/** 1-hour price change percentage. */
change1h: number;
/** 24-hour price change percentage. */
change24h: number;
/** 7-day price change percentage. */
change7d: number;
/** 24-hour trading volume in USD. */
volume24h: string;
/** Market capitalisation in USD. */
marketCap: string;
/** Market cap rank. */
rank?: number;
/** Token logo URL. */
logoUrl?: string;
/** Last updated timestamp. */
updatedAt: string;
}

CandleInterval

type CandleInterval =
| '1m'
| '5m'
| '15m'
| '30m'
| '1h'
| '4h'
| '1d'
| '1w';

CryptoCandle

interface CryptoCandle {
/** Candle open timestamp (ISO 8601). */
timestamp: string;
/** Open price. */
open: string;
/** High price. */
high: string;
/** Low price. */
low: string;
/** Close price. */
close: string;
/** Trading volume during the candle period. */
volume: string;
}

MarketOverview

interface MarketOverview {
/** Total crypto market capitalisation in USD. */
totalMarketCap: string;
/** 24-hour total trading volume. */
totalVolume24h: string;
/** Bitcoin dominance percentage. */
btcDominance: number;
/** Ethereum dominance percentage. */
ethDominance: number;
/** Number of tracked cryptocurrencies. */
totalCryptos: number;
/** Number of active exchanges. */
totalExchanges: number;
/** Market-wide 24h change percentage. */
marketChange24h: number;
/** Last updated timestamp. */
updatedAt: string;
}

Examples

Get Multiple Token Prices

const engine = createOneEngineClient({
clientId: 'your-client-id',
secretKey: 'your-secret-key',
});

// No setAccessToken needed for price endpoints

const res = await engine.getCryptoPrices(['BTC', 'ETH', 'SOL', 'USDC']);

if (res.success && res.data) {
for (const token of res.data) {
console.log(`${token.symbol}: $${token.priceUsd} (${token.change24h > 0 ? '+' : ''}${token.change24h.toFixed(2)}%)`);
}
}

Get a Single Token Price

const res = await engine.getCryptoPrice('ETH');

if (res.success && res.data) {
const t = res.data;
console.log(`ETH: $${t.priceUsd}`);
console.log(` 1h: ${t.change1h.toFixed(2)}%`);
console.log(` 24h: ${t.change24h.toFixed(2)}%`);
console.log(` 7d: ${t.change7d.toFixed(2)}%`);
console.log(` Market cap: $${t.marketCap}`);
}

Fetch Candlestick Data

const res = await engine.getCryptoCandles('BTC', '1h', 24);

if (res.success && res.data) {
for (const c of res.data) {
console.log(`${c.timestamp} | O:${c.open} H:${c.high} L:${c.low} C:${c.close} V:${c.volume}`);
}
}

Top Cryptocurrencies

const res = await engine.getTopCryptos(10);

if (res.success && res.data) {
for (const t of res.data) {
console.log(`#${t.rank} ${t.symbol} - $${t.priceUsd} | MCap: $${t.marketCap}`);
}
}

Market Overview

const res = await engine.getCryptoMarketOverview();

if (res.success && res.data) {
const m = res.data;
console.log(`Total market cap: $${m.totalMarketCap}`);
console.log(`24h volume: $${m.totalVolume24h}`);
console.log(`BTC dominance: ${m.btcDominance.toFixed(1)}%`);
console.log(`ETH dominance: ${m.ethDominance.toFixed(1)}%`);
console.log(`Market 24h change: ${m.marketChange24h > 0 ? '+' : ''}${m.marketChange24h.toFixed(2)}%`);
}

Rate Limits

Price API endpoints are free but subject to rate limits:

TierRequests per Minute
Free (no auth)30
Authenticated120
Pro plan600

If you exceed the rate limit, the API returns an error with "rate_limited". Implement exponential back-off or cache results client-side to stay within limits.

Next Steps

  • Swap API -- execute token swaps using live price data.
  • AI Trading API -- AI agents use real-time pricing for trade decisions.