Cross-exchange price spread
GET /api/exchange-spreadOne coin's price across every major venue, measured against the cross-venue median: each venue's deviation in basis points, the high-to-low and interquartile spread, volume-weighted versus median price, each venue's quoted bid-ask spread and share of volume, and flags for stale, anomalous, wide-quote and outlier tickers. Send GET /api/exchange-spread with the required field coin and pay $0.005 per call over x402 or MPP (there is no free tier). It returns a JSON object with source, fetchedAt, cached, coin, name and 15 more.
Takes the venue's largest market per coin from the 100 largest tickers by volume; pass `quote` to compare one quote currency only (USDT, USD, USDC). Measured facts only, no trade direction. Deterministic code over market data; refreshed every 5 minutes. Data provided by CoinGecko (https://www.coingecko.com/en/api).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
coin | string | yes | Coin id (bitcoin, ethereum, solana). Use coin-search for ids. Also accepted as symbol, id, ticker, asset, currency. |
quote | string | no | Only compare markets quoted in this currency (USDT, USD, USDC). Omit for every quote, converted to USD. |
limit | number | no | Venues returned, widest deviation first, 1-50 (default 20). |
Example request
curl -i "https://agent402.tools/api/exchange-spread?coin=ethereum"
Without payment this returns HTTP 402 Payment Required with the exact price for exchange-spread; any x402 v2 or MPP client pays it and retries.
Example response
{
"source": "coingecko",
"fetchedAt": "2026-11-16T12:00:00.000Z",
"cached": false,
"coin": "ethereum",
"name": "Ethereum",
"quote": null,
"tickersRead": 100,
"venuesCompared": 61,
"returned": 1,
"matched": 61,
"complete": false,
"truncated": true,
"medianPriceUsd": 1811.6,
"volumeWeightedPriceUsd": 1811.72,
"spread": {
"highLowBps": 38.4,
"interquartileBps": 4.1,
"stdevBps": 6.2,
"medianBidAskPct": 0.0117
},
"highest": {
"venue": "Example Exchange",
"pair": "ETH/USDT",
"deviationBps": 21.3
},
"lowest": {
"venue": "Sample Markets",
"pair": "ETH/USD",
"deviationBps": -17.1
},
"venues": [
{
"rank": 1,
"venue": "Example Exchange",
"pair": "ETH/USDT",
"deviationBps": 21.3,
"bidAskPct": 0.02,
"volumeSharePct": 0.4,
"flags": [
"outlier"
]
}
],
"excluded": {
"stale": 1,
"anomalous": 0
},
"credit": "Data provided by CoinGecko (https://www.coingecko.com/en/api)."
}| Field | Type | Always present | In the example |
|---|---|---|---|
source | string | yes | coingecko |
fetchedAt | string | yes | 2026-11-16T12:00:00.000Z |
cached | boolean | yes | false |
coin | string | yes | ethereum |
name | string | yes | Ethereum |
quote | null | no | null |
tickersRead | number | yes | 100 |
venuesCompared | number | yes | 61 |
returned | number | yes | 1 |
matched | number | yes | 61 |
complete | boolean | yes | false |
truncated | boolean | yes | true |
medianPriceUsd | number | yes | 1811.6 |
volumeWeightedPriceUsd | number | yes | 1811.72 |
spread | object | yes | 4 fields: highLowBps, interquartileBps, stdevBps, medianBidAskPct |
highest | object | yes | 3 fields: venue, pair, deviationBps |
lowest | object | yes | 3 fields: venue, pair, deviationBps |
venues | array of objects | yes | 1 item in the example |
excluded | object | yes | 2 fields: stale, anomalous |
credit | string | yes | Data provided by CoinGecko (https://www.coingecko.com/en/api). |
From an MCP client
catalog.call {
"slug": "exchange-spread",
"params": {
"coin": "ethereum"
}
}The hosted connector at https://agent402.tools/mcp needs a payment for exchange-spread; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.13.32.
Errors and behavior
coinis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement runs after the tool and only on a successful response. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
POSTwith a JSON body to /api/exchange-spread is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.005" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/exchange-spread?coin=ethereum");Related tools
Exchange tickers
Markets (tickers) listed on one exchange: base/target pair, last price, 24h volume, USD- and BTC-converted last price.
Known-address label lookup
Label a known EVM address from a curated, committed dataset: major stablecoin + token contracts (the USDC and USDG.
DEX pool health
Measured health of one DEX pool by network and pool address: liquidity, 24h turnover (volume over liquidity), buy share.
DEX volume board by network
A network's decentralized exchanges ranked by their share of 24h volume across the network's top pools (the 60 largest.
Crypto exchanges
Crypto exchanges ranked by trust score: id, name, country, year established, trust score (1-10) and rank, 24h volume.
Funding rate screener across venues
Perpetual funding for one coin across every listed derivatives venue, computed in one call: open-interest-weighted.