Retrieve pool batch bid and ask
POST /public/v1/evm/{chain_id}/bid_ask/batch
Returns the bid and ask for up to 100 pools on one chain in a single request. Use it to scan or rank many pools, for example by depth, without sending one request per pool.
Each pool gets exactly the quote that GET /public/v1/evm/{chain_id}/{pool_address}/bid_ask returns for it, and the two endpoints share a cache, so a pool quoted by one is served to the other from cache.
This is a public endpoint. Its rate limit is lower than the single-pool endpoint's, since one request quotes up to 100 pools. A Trading API key is optional; sending one raises your rate limit:
Authorization: Bearer <your_trading_api_key>
A key you send must be valid: an unknown key returns 401. Leave the header out if you don't have one.
Path parameters
chain_id1. Must be one of the chains returned by GET /public/v1/chains.Request body
poolsGET /public/v1/evm/{chain_id}/metadata. Case-insensitive. An address listed more than once is quoted once.depthtruefalse returns "depth": null for every pool, as the single-pool depth parameter does (see Unavailable prices).Any other field is rejected with 400.
Request
curl -X POST "https://api.metric.xyz/public/v1/evm/1/bid_ask/batch" \
-H "Authorization: Bearer <your_trading_api_key>" \
-H "Content-Type: application/json" \
-d '{
"pools": [
"0xF85AfbADeCC7F23Dd173ed706f07d9C7e2473e24",
"0x0000000000000000000000000000000000000001"
],
"depth": false
}'Response
200 OK. results holds one entry per distinct pool, in the order you listed them. Each entry carries either a quote or an error, never both.
{
"results": [
{
"poolAddress": "0xF85AfbADeCC7F23Dd173ed706f07d9C7e2473e24",
"quote": {
"pair": "WETH/USDC",
"poolAddress": "0xF85AfbADeCC7F23Dd173ed706f07d9C7e2473e24",
"priceProviderStatus": "healthy",
"bidAdj": "49940417631045696435290",
"askAdj": "49945012360825322506424",
"totalToken0Available": "24503618827789131821",
"totalToken1Available": "49785157539",
"serverTs": 1790508850,
"depth": null
}
},
{
"poolAddress": "0x0000000000000000000000000000000000000001",
"error": {
"status": 404,
"error": "Pair metadata not found for 0x0000000000000000000000000000000000000001"
}
}
]
}Response fields
resultsresults[].poolAddressresults[].quotedepth.results[].errorstatus is the HTTP status the single-pool endpoint would have returned for this pool, error its message.To estimate what an order fills for from a quote's depth, see Estimate a fill from depth.
A pool whose feed has no price is a quote, not an error. It carries the unavailable sentinel (bidAdj = "0", askAdj = 2^128 − 1) and its priceProviderStatus, exactly as on the single-pool endpoint. Check priceProviderStatus and each side's price in every quote before using it (see Unavailable prices). A healthy quote can still revert onchain if the feed goes stale before your swap executes, and on Ethereum the swap must go through participating builders: see Before you trade.
Typical per-pool errors are 404 (Pair metadata not found for <pool>: the pool isn't served on this chain) and the temporary 500 (Internal server error), 502 (Upstream service error) and 503 (Service temporarily unavailable). Retry pools with a temporary error.
Errors
These fail the whole request. Per-pool problems never do: they are returned as entries in results.
400pools must name at least one pool addresspools is empty.400pools names <n> addresses; at most 100 are allowed per request400pools[<index>] is not a valid pool address<index> is its zero-based position.400Invalid request body: …pools is missing, or it has unknown fields.401Invalid API keyAuthorization header was sent with an unknown or revoked key.404Unknown chainId: <id>429Retry-After.503Service temporarily unavailableThe rate limit counts batch requests, not pools, so one batch of 100 pools costs one request.
Last updated 29 days ago
Relatick