DEV Community

Moon Soon
Moon Soon

Posted on • Originally published at swapapi.dev

5 Ways to Monitor Token Prices Across 46 EVM Chains

Accurate token price data across multiple EVM chains is the foundation of every DeFi application, trading bot, and portfolio tracker. With the DeFi market exceeding $238 billion in TVL and over 390 EVM-compatible networks listed on ChainList, developers need reliable methods to track prices across chains without maintaining dozens of separate integrations. This guide covers five practical approaches to monitor token prices across EVM networks -- from on-chain oracles to DEX-based price discovery -- with working code examples you can run today.

Each method has distinct trade-offs in latency, chain coverage, cost, and accuracy. The right choice depends on whether you need millisecond-level CEX prices, decentralized oracle feeds, or real-time DEX execution prices reflecting actual on-chain liquidity.

1. On-Chain Price Oracles with Chainlink Data Feeds

Chainlink price feeds are the most widely adopted oracle solution in DeFi, securing over $65 billion in total value and serving 80% of DeFi protocols that require external price data. Each feed is a smart contract that returns a latest price, updated by a decentralized network of node operators when prices deviate beyond a threshold (typically 0.5-1%).

The key advantage is trustlessness -- your smart contract reads the price directly on-chain without any HTTP calls or API keys. The trade-off is limited pair coverage: Chainlink supports roughly 1,000 price feeds across major chains, which covers blue-chip tokens but leaves long-tail assets uncovered.

Supported chains: Ethereum, Arbitrum, Polygon, BSC, Base, Optimism, Avalanche, and ~15 others.

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
Enter fullscreen mode Exit fullscreen mode

To read ETH/USD on Ethereum mainnet, call latestRoundData() on the feed contract at 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419. The returned answer uses 8 decimals, so divide by 1e8 for the dollar price. See the full Chainlink Data Feeds documentation for feed addresses on each chain.

Best for: Smart contracts needing on-chain price verification, liquidation engines, and lending protocols.

2. DEX Swap Quotes as a Price Discovery Mechanism

Every DEX swap quote is implicitly a price quote. When you request a swap of 1 WETH to USDC, the returned expectedAmountOut divided by the input amount gives you the real-time market price based on actual pool liquidity -- not a stale oracle update or a centralized exchange's order book.

swapapi.dev turns this into a single GET request across 46 EVM chains with no API key required. Request a swap quote, extract expectedAmountOut and token decimals from the response, and compute the price:

price = (expectedAmountOut / 10^tokenTo.decimals) / (amountIn / 10^tokenFrom.decimals)
Enter fullscreen mode Exit fullscreen mode

Try it yourself

Query the ETH/USDC price on Ethereum:

curl "https://api.swapapi.dev/v1/swap/1?tokenIn=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&tokenOut=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&amount=1000000000000000000&sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
Enter fullscreen mode Exit fullscreen mode

The response includes data.swapPrice, data.expectedAmountOut, and full token metadata. To compute the human-readable price from the response:

const price = Number(data.expectedAmountOut) / 10 ** data.tokenTo.decimals;
Enter fullscreen mode Exit fullscreen mode

This method reflects actual executable liquidity, not theoretical mid-market prices. The priceImpact field tells you how much the trade moves the pool -- useful for detecting low-liquidity pairs where quoted prices may not be reliable. A priceImpact worse than -5% signals thin liquidity.

Multi-chain price comparison

Check the same pair across Arbitrum and Polygon to find price discrepancies:

curl "https://api.swapapi.dev/v1/swap/42161?tokenIn=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1&tokenOut=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&amount=1000000000000000000&sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
Enter fullscreen mode Exit fullscreen mode
curl "https://api.swapapi.dev/v1/swap/137?tokenIn=0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270&tokenOut=0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359&amount=1000000000000000000&sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
Enter fullscreen mode Exit fullscreen mode

With 46 supported chains -- including Ethereum, Arbitrum, Base, Polygon, BSC, Optimism, Avalanche, Sonic, Berachain, and Monad -- this approach scales to any token pair that has DEX liquidity. The response also includes rpcUrls for each chain, giving you everything needed to submit the transaction on-chain.

Best for: Arbitrage detection, DEX-native price feeds, price monitoring on chains not covered by traditional oracles, and AI trading agents that need execution-ready quotes.

3. Aggregated Market Data APIs (CoinGecko, CoinMarketCap)

Centralized market data APIs aggregate prices from hundreds of CEXs and DEXs into a single weighted average. CoinGecko tracks over 15,000 tokens across 265 networks and serves 150M+ monthly users. These APIs provide rich metadata -- market cap, 24h volume, historical charts, circulating supply -- that pure on-chain sources cannot.

The /simple/price endpoint returns USD prices for multiple tokens in one call:

curl "https://api.coingecko.com/api/v3/simple/price?ids=ethereum,matic-network&vs_currencies=usd"
Enter fullscreen mode Exit fullscreen mode

Trade-offs: Free tiers are rate-limited (typically 10-30 calls/minute). Prices reflect cross-exchange averages with 1-2 minute latency, not real-time DEX pool states. New or low-cap tokens may not be listed. CoinGecko and CoinMarketCap can show different prices for the same token due to differing methodologies and data sources.

For developers building multi-chain monitoring systems, the main limitation is that these APIs identify tokens by a global id (e.g., ethereum), not by chain-specific contract addresses. Mapping between contract addresses and CoinGecko IDs requires an additional lookup step via their /coins/list endpoint.

Best for: Portfolio dashboards, market cap displays, historical charting, and applications that need USD-denominated prices for well-known tokens.

4. DeFiLlama Price API for On-Chain Token Pricing

DeFiLlama provides a free, keyless API specifically designed for on-chain token pricing. Unlike CoinGecko's exchange-aggregated approach, DeFiLlama derives prices from on-chain DEX pools across 500+ chains tracking 7,000+ protocols. This makes it particularly useful for DeFi-native tokens that may not be listed on centralized exchanges.

The pricing endpoint uses chain:address format, making multi-chain queries straightforward:

curl "https://coins.llama.fi/prices/current/ethereum:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,arbitrum:0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
Enter fullscreen mode Exit fullscreen mode

This returns USD prices, confidence scores, and timestamps for each token. You can also query historical prices at a specific Unix timestamp:

curl "https://coins.llama.fi/prices/historical/1712000000/ethereum:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
Enter fullscreen mode Exit fullscreen mode

DeFiLlama's key advantage is chain-native addressing. You pass the contract address directly -- no ID lookups, no slug mapping. The API is free with no key required, though it is rate-limited and best suited for polling at intervals (every 30-60 seconds) rather than high-frequency use.

Coverage extends to long-tail tokens with DEX liquidity, including LP tokens and yield-bearing assets that aggregators like CoinGecko may not track. Over 82% of DeFi protocols now offer real-time or near-instant data updates, and DeFiLlama captures these on-chain price movements directly.

Best for: DeFi analytics dashboards, LP token pricing, historical price lookups, and monitoring tokens not listed on centralized exchanges.

5. Direct DEX Pool Reads via Multicall

For maximum control and zero API dependency, you can read token prices directly from DEX pool contracts using eth_call and multicall batching. This approach queries the pool reserves or slot0 (for concentrated liquidity pools) and computes the price from the on-chain state.

On Uniswap V3-style pools, the slot0() function returns sqrtPriceX96, from which you derive the current tick price:

const price = (sqrtPriceX96 ** 2 / 2 ** 192) * 10 ** (token0Decimals - token1Decimals);
Enter fullscreen mode Exit fullscreen mode

Using a multicall contract, you can batch hundreds of pool reads into a single RPC call, making this approach efficient for monitoring large token lists. Libraries like viem and ethers.js provide built-in multicall support.

The main challenge is pool discovery -- you need to know which DEX factory contracts exist on each chain and query them for pair addresses. On a single chain this is manageable, but across 46+ EVM chains it becomes a significant maintenance burden. You also need to handle different pool types (constant product, concentrated liquidity, stable pools) and aggregate across multiple DEXs to avoid stale or manipulable single-source prices.

If you need execution-ready prices without building this infrastructure, a DEX aggregator API like swapapi.dev handles pool discovery, routing, and price computation across all 46 chains behind a single endpoint.

Best for: MEV bots, on-chain price monitoring with zero external dependencies, and applications requiring block-by-block price granularity.

Comparison Table

Method Chain Coverage Latency Cost API Key Best Use Case
Chainlink Oracles ~20 chains 1-60s (heartbeat) Gas per read No Smart contract price verification
DEX Swap Quotes (swapapi.dev) 46 chains 1-5s Free No Arbitrage, execution-ready prices
CoinGecko / CoinMarketCap 265+ networks 1-2 min Free tier limited Yes (for pro) Portfolio dashboards, historical data
DeFiLlama Prices 500+ chains 30-60s Free No DeFi analytics, LP token pricing
Direct Pool Reads Any EVM chain Block time RPC costs No MEV, block-level granularity

Frequently Asked Questions

How do I monitor token prices across multiple EVM chains simultaneously?

The most efficient approach is to use an API that supports chain-specific addressing natively. DeFiLlama lets you batch multiple chain:address pairs in one request. For execution-aware prices, you can call api.swapapi.dev/v1/swap/{chainId} in parallel across chains -- each request returns the real-time DEX price, token metadata, and even executable swap calldata. Both APIs are free and require no API key.

Which method is most accurate for real-time token price monitoring on EVM chains?

Accuracy depends on your definition. Chainlink feeds are the gold standard for tamper-resistant prices used in smart contract logic, but they update on deviation thresholds (not continuously). DEX swap quotes from aggregators reflect the actual price you would receive for a given trade size, including slippage and price impact. For small amounts, CoinGecko's exchange-aggregated prices are reliable. For large trades, execution-based pricing (methods 2 and 5) is more accurate because it accounts for liquidity depth.

Can I monitor token prices for new or low-cap tokens on EVM chains?

Yes, but your options narrow. Chainlink and CoinGecko typically only cover tokens with established liquidity and market cap. DeFiLlama covers any token with DEX pool liquidity. DEX swap quotes via swapapi.dev will return a price for any token pair that has a routable path on a supported chain -- including tokens launched minutes ago, as long as liquidity exists. Check the priceImpact field to assess reliability; high impact (worse than -5%) indicates thin liquidity and potentially unreliable pricing.

What are the BSC decimal differences I need to handle?

On BSC (chain ID 56), USDC and USDT both use 18 decimals instead of the standard 6 decimals on Ethereum and most other chains. This is the most common source of price calculation bugs in multi-chain applications. USDC on BSC is 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d (18 decimals) and USDT is 0x55d398326f99059fF775485246999027B3197955 (18 decimals). Always read the decimals field from the API response rather than hardcoding assumptions.

How often should I poll for price updates?

It depends on the method and your use case. Chainlink feeds update every 1-60 seconds depending on the pair and chain. DeFiLlama is best polled every 30-60 seconds. CoinGecko free tier allows 10-30 calls per minute. For DEX swap quotes, swapapi.dev allows approximately 30 requests per minute per IP -- sufficient for monitoring a watchlist of 15-20 pairs with 2-second intervals. For sub-second price updates, direct pool reads via WebSocket subscriptions to RPC nodes are the only viable option.

Get Started

swapapi.dev gives you execution-ready token prices across 46 EVM chains through a single GET request. No API key. No authentication. No account registration.

Explore the full API specification at https://swapapi.dev/openapi.json, or browse the interactive docs at https://swapapi.dev/docs.

Start with a price check -- swap 1 WETH for USDC on Arbitrum:

curl "https://api.swapapi.dev/v1/swap/42161?tokenIn=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1&tokenOut=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&amount=1000000000000000000&sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
Enter fullscreen mode Exit fullscreen mode

The response includes data.swapPrice, data.expectedAmountOut, token metadata, price impact, and complete transaction calldata. Parse the price, monitor it on a schedule, or execute the swap -- all from the same endpoint.

Top comments (0)