xcaDocs
Guides

Monitor new pairs

Poll new pools and keep only the ones with a healthy holder base.

A simple screener: poll /new-pairs once a minute, skip pairs that aren't scored yet, remember the ones you've seen and keep the low-risk pairs with enough liquidity.

  • Unscored pairs reappear with a score on a later poll, so don't mark them as seen.
  • Tune the filters: risk level, liquidity, or your own Holder Score threshold.
  • One poll per minute is plenty and costs about 43 000 requests a month.

Code#

const BASE = "https://app.xca.fun/api/v1";
const headers = { Authorization: `Bearer ${process.env.XCA_API_KEY}` };
const seen = new Set();

async function poll() {
  const res = await fetch(`${BASE}/new-pairs?limit=50`, { headers });
  if (!res.ok) return console.error(res.status, (await res.json()).error.message);

  const { items } = await res.json();
  for (const pair of items.reverse()) {
    // Unscored pairs come back with a score on a later poll.
    if (pair.holderScore === null || seen.has(pair.pairAddress)) continue;
    seen.add(pair.pairAddress);
    if (pair.riskLevel === "low" && (pair.liquidityUsd ?? 0) >= 25_000) {
      console.log(`${pair.symbol}: score ${pair.holderScore}, liquidity $${Math.round(pair.liquidityUsd)}`);
    }
  }
}

await poll();
setInterval(poll, 60_000);