Connect ›
Cover: Build a price screener in 50 lines: the batch endpoint walkthrough

Build a price screener in 50 lines: the batch endpoint walkthrough

POST /api/quote/prepare with {"requests": [...]} prepares up to 32 quotes at once; your node answers them in one JSON-RPC batch and /api/quote/decode turns each answer into a quote. The complete pattern for screeners, arbitrage scanners and portfolio dashboards — no key, no infra.

BlazePhoenix Engineering · updated 2026-10-05 · data through 2026-10-11 · 5 min · written from the deployed bytecode

By Mitra (@Sigmacrit) — anonymous developer of the BlazePhoenix protocol. The code is the résumé.

Abstract in 15 languages · resumo · resumen · 摘要 · 要旨 · ملخص

English — POST /api/quote/batch prices up to 10 pairs in one round-trip, order preserved, errors inline per item — one dead pair never breaks the loop. Resolve symbols once, batch with addresses, refresh at block speed.

Português — POST /api/quote/batch cota até 10 pares numa só ida, ordem preservada, erros inline por item — um par morto nunca quebra o loop. Resolve símbolos uma vez, agrupa com endereços, atualiza à velocidade do bloco.

Español — POST /api/quote/batch cotiza hasta 10 pares en un solo viaje, orden preservado, errores inline por ítem — un par muerto nunca rompe el bucle. Resuelve símbolos una vez, agrupa con direcciones, refresca a velocidad de bloque.

Français — POST /api/quote/batch cote jusqu'à 10 paires en un aller-retour, ordre préservé, erreurs en ligne par élément — une paire morte ne casse jamais la boucle. Résolvez les symboles une fois, groupez par adresses, rafraîchissez au rythme des blocs.

Deutsch — POST /api/quote/batch quotiert bis zu 10 Paare in einem Round-Trip, Reihenfolge erhalten, Fehler inline pro Eintrag — ein totes Paar bricht nie die Schleife. Symbole einmal auflösen, mit Adressen batchen, im Blocktakt aktualisieren.

Русский — POST /api/quote/batch котирует до 10 пар за один запрос: порядок сохранён, ошибки inline по каждому элементу — мёртвая пара никогда не ломает цикл. Разрешите символы один раз, батчите адресами, обновляйте со скоростью блока.

Türkçe — POST /api/quote/batch tek gidiş-dönüşte 10 çifte kadar fiyatlar; sıra korunur, hatalar öğe başına satır içidir — ölü bir çift döngüyü asla kırmaz. Sembolleri bir kez çözün, adreslerle toplayın, blok hızında yenileyin.

العربية — يسعّر POST /api/quote/batch حتى 10 أزواج في رحلة واحدة، بترتيب محفوظ وأخطاء مضمّنة لكل عنصر — الزوج الميت لا يكسر الحلقة أبداً. حُلَّ الرموز مرة، وادمج بالعناوين، وحدّث بسرعة الكتلة.

हिन्दी — POST /api/quote/batch एक ही राउंड-ट्रिप में 10 जोड़े तक कोट करता है, क्रम सुरक्षित, हर आइटम की त्रुटि इनलाइन — एक मृत जोड़ा कभी लूप नहीं तोड़ता। सिंबल एक बार रिज़ॉल्व करें, पतों से बैच करें, ब्लॉक गति पर रीफ्रेश करें।

日本語 — POST /api/quote/batchは1往復で最大10ペアを見積もり。順序は保持され、エラーは項目ごとにインライン。死んだペアがループを壊すことはありません。シンボルは一度だけ解決し、アドレスでバッチし、ブロック速度で更新を。

中文 — POST /api/quote/batch 一次往返为最多 10 个交易对报价,顺序保持、错误按项内联——一个死交易对永远不会中断循环。符号解析一次,用地址批量,按区块速度刷新。

한국어 — POST /api/quote/batch는 한 번의 왕복으로 최대 10개 페어를 견적합니다. 순서 유지, 항목별 인라인 오류 — 죽은 페어 하나가 루프를 깨지 않습니다. 심볼은 한 번만 해석하고, 주소로 배치하고, 블록 속도로 갱신하세요.

Bahasa Indonesia — POST /api/quote/batch menguotasi hingga 10 pasangan dalam satu perjalanan, urutan terjaga, kesalahan inline per item — satu pasangan mati tak pernah memutus loop. Selesaikan simbol sekali, batch dengan alamat, segarkan secepat blok.

বাংলা — POST /api/quote/batch এক রাউন্ড-ট্রিপে ১০টি পর্যন্ত জোড়া কোট করে, ক্রম বজায়, প্রতি আইটেমে ইনলাইন ত্রুটি — একটি মৃত জোড়া কখনো লুপ ভাঙে না। সিম্বল একবার সমাধান করুন, ঠিকানা দিয়ে ব্যাচ করুন, ব্লকের গতিতে রিফ্রেশ করুন।

Filipino — Ang POST /api/quote/batch ay nagpepresyo ng hanggang 10 pares sa isang round-trip, panatili ang pagkakasunod, errors inline bawat item — hindi kailanman sinisira ng patay na pares ang loop. Isang beses i-resolve ang simbolo, mag-batch gamit ang address, mag-refresh sa bilis ng block.

A screener's job is breadth: many pairs, refreshed often, cheaply. Serial calls waste round-trips; the batch prepare takes up to 32 requests in one POST, preserves order, and returns one JSON-RPC batch your node answers in a single round-trip. Each answer is then decoded on its own, so one dead pair returns its error code in place while the others return quotes. Your loop never breaks on a partial failure.

Batch prepare accepts 0x addresses and the built-in symbols ETH, WETH, USDC and BZPX. One batch goes to one node, so group requests by chain: a Base batch for your Base node, an Arbitrum batch for your Arbitrum node.

const API = 'https://blazephoenix.xyz/api/quote';
const post = (u, b) => fetch(u, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(b) }).then(r => r.json());
const pairs = [
  { chain: 'base', in: 'WETH', out: 'USDC', amountIn: '1000000000000000000' },
  { chain: 'base', in: 'WETH', out: '0x532f27101965dd16442e59d40670faf5ebb142e4', amountIn: '1000000000000000000' }, // BRETT
];
const prep = await post(API + '/prepare', { requests: pairs });   // one chain per batch
const answers = await post(BASE_RPC_URL, prep.rpcBatch);          // ONE round-trip to your node; id = item index
for (const a of answers) {
  const q = await post(API + '/decode', { request: prep.items[a.id].request, result: a.result });
  console.log(q.ok ? q.amountOut : q.code);
}

The refresh loop that respects the physics

Chain state changes once per block — polling faster than block time buys nothing. On Base (2s blocks) a 2-second loop is the honest maximum; prepare and decode make no RPC call, so an aggressive loop costs only your own node's reads. For alerting, compare amountOut across cycles; for arbitrage scanning, remember the number you act on should be re-quoted with exact=1 and a recipient — the screener number is a preview by design.

Do not trust this page — reproduce it

Every claim above is checkable against the chain. Start here:

run the snippet above in any Node ≥18 terminal — three chains priced in one round-trip, no key
Cite this article

Licensed CC BY 4.0 — quote, translate and reuse freely, including commercially, with attribution and a link. Copy a ready-made citation:

BlazePhoenix (2026). Build a price screener in 50 lines: the batch endpoint walkthrough. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/build-a-screener
@misc{blazephoenix_build_a_screener,
  title  = {Build a price screener in 50 lines: the batch endpoint walkthrough},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/learn/build-a-screener},
  note   = {Accessed: reproduce the claim with the command above}
}

Writing an answer, a wiki entry or a paper? The claim above is reproducible against the chain before you quote it — which is the only sound basis for citing a technical source at all.

Contracts are verified on every chain we deploy to — addresses in the protocol manifest. Deeper formal treatment: the whitepaper (PDF).

Related engineering

Next in Build & integrate · 4 / 9
Integrate any bot: keyless, keyed, ethers, viem, Python, and AI agents ›One quote API, every runtime. Copy-paste integration for keyless fetch bots, keyed-RPC servers, ethers v6, viem, web3.py and — as a first-class citizen — LLM function-calling tool schemas so AI agents can trade through BlazePhoenix natively.6 min