Alimentare uno scanner di arbitraggio dall'API

Tutti i bookmaker della tua chiave sugli stessi match in un'unica richiesta, le quote allineate per esito e la verifica prima di agire. La scansione vera e propria spetta a te.

6 min di lettura ·

Questa guida parte dagli ID dei match in corso e La tua prima richiesta mostra come trovarli. Uno scanner confronta un mercato su più bookmaker e l'API fornisce le quote di ogni bookmaker per un match sotto quel singolo ID match: non devi mai abbinare gli eventi tra bookmaker manualmente.

Tutti i bookmaker in un'unica richiesta

Inserisci i match in match_ids e ometti bookmaker_ids: la risposta include tutti i bookmaker previsti dalla tua chiave, così le quote confrontate sono lette insieme.

curl -X POST https://oddfeeds.com/api/v1/feeds \
  -H "Authorization: Bearer ofk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"scope":"odds","match_ids":[13675188,13677494],"odd_type_ids":[2,3,4],"odd_period_ids":[1]}'

La risposta · Una risposta dall'API del 26 nov 2026, di cui vengono mostrate le prime righe. La tua risposta conterrà ID diversi: inseriscili nella richiesta successiva.

La risposta in JSON: Tutti i bookmaker in un'unica richiesta
{
  "status": "ok",
  "data": {
    "prematch": [],
    "inplay": [
      {
        "id": 401959094,
        "active": 1,
        "match_id": 13675188,
        "event_id": 72567276,
        "bookmaker": {
          "id": 47,
          "name": "BetfairExchange"
        },
        "datetime": "2026-11-26T15:18:13",
        "period_id": 1,
        "type_id": 2,
        "order": 1,
        "back_lay_id": 0,
        "liquidity": 12,
        "hc": -3,
        "hc_as_draw": 0,
        "price": 200,
        "nav": "{\"v\":1,\"scope\":\"inplay\",\"eventId\":\"36359303\",\"url\":\"https...",
        "runtime": {
          "play": {
            "codec": 13,
            "display": "1H 13'"
          },
          "points": {
            "home": 0,
            "away": 0
          }
        }
      },
      {
        "id": 401921412,
        "active": 1,
        "match_id": 13677494,
        "event_id": 72567313,
        "bookmaker": {
          "id": 47,
          "name": "BetfairExchange"
        },
        "datetime": "2026-11-26T15:15:46",
        "period_id": 1,
        "type_id": 3,
        "order": 2,
        "back_lay_id": 1,
        "liquidity": 20,
        "hc": 3,
        "hc_as_draw": 0,
        "price": 120,
        "nav": "{\"v\":1,\"scope\":\"inplay\",\"eventId\":\"36359307\",\"url\":\"https...",
        "runtime": {
          "play": {
            "codec": 300,
            "display": "HT"
          },
          "points": {
            "home": 0,
            "away": 0
          }
        }
      }
    ]
  },
  "time": "2026-11-26T15:18:21",
  "ms": "18.09ms"
}

Allinea le quote

Le quote dello stesso esito condividono match_id, period_id, type_id e hc. Sulle righe 1X2 il tipo corrisponde all'esito:

Tipi di mercato
type_idNomeSignificato
21Match winner, home. With a non-zero hc it's European handicap: hc is the home team's handicap, the same on all three rows of the line, so at -1 this row wins when the home team wins by two goals or more. The coverage pages list these rows as European handicap.
3XMatch winner, draw. With a non-zero hc it's European handicap: at -1 this row wins when the home team wins by exactly one goal.
42Match winner, away. With a non-zero hc it's European handicap: at -1 this row wins on a draw or an away win.

Cosa non confrontare

Su un exchange una riga può essere una quota banca (back_lay_id 1) o un livello inferiore al migliore (order 2 o 3). Uno scanner di quote punta mantiene le quote punta al livello migliore.

Campi di una riga di quote
CampoSignificato
back_lay_id0 = back, 1 = lay (exchanges).
orderOn an exchange, the price level: 1 is the best price, 2 and 3 the next ones on the same side, each with its own liquidity. It isn't a line number: lines differ by hc.
liquidityAvailable volume at this price level in euros, rounded down to whole euros. Exchanges only; -1 at other bookmakers.

Una quota che il bookmaker sospende o chiude esce dal feed: una quota mancante in una risposta non è disponibile, quindi non mantenere mai l'ultima che hai visto.

Verifica prima di agire

Prima di agire sulle quote, passa i relativi ID a odds_seen: seen indica quando il nostro scanner ha confermato l'ultima volta ciascuna quota, mentre closed viene popolato una volta rimossa.

curl -X POST https://oddfeeds.com/api/v1/feeds \
  -H "Authorization: Bearer ofk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"scope":"odds_seen","odd_ids":[401959094,401921412,401918414]}'

La risposta · Una risposta dall'API del 26 nov 2026, di cui vengono mostrate le prime righe.

La risposta in JSON: Verifica prima di agire
{
  "status": "ok",
  "data": [
    {
      "id": 401959094,
      "open": "2026-11-26T15:05:21",
      "seen": "2026-11-26T15:18:21",
      "closed": ""
    },
    {
      "id": 401921412,
      "open": "2026-11-26T14:27:03",
      "seen": "2026-11-26T15:18:21",
      "closed": ""
    }
  ],
  "time": "2026-11-26T15:18:22",
  "ms": "1.54ms"
}

Le quote allineate in un unico script

Questo script richiede le quote 1X2 dei match forniti per tutti i bookmaker della tua chiave, mantiene le quote punta al livello migliore e stampa le quote di ciascun esito dalla più alta alla più bassa. Legge la tua chiave da ODDFEEDS_KEY.

// The 1X2 prices of some matches at every bookmaker of your key, lined up per outcome:
// back prices at the best level only, highest first. The scanning itself is yours.
//   ODDFEEDS_KEY=<your key> node arbitrage-scanner-feed.mjs <match id> ...
const API = process.env.ODDFEEDS_URL || 'https://oddfeeds.com/api/v1/feeds';
const matchIds = process.argv.slice(2).map(Number);
const SIDE = { 2: '1', 3: 'X', 4: '2' };

const res = await fetch(API, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.ODDFEEDS_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    scope: 'odds',
    match_ids: matchIds,
    odd_type_ids: [2, 3, 4],
    odd_period_ids: [1],
  }),
});
const feed = await res.json();
if (feed.status !== 'ok') throw new Error(`${res.status}: ${feed.error}`);
const rows = [...feed.data.prematch, ...feed.data.inplay];
console.log(`Matches ${matchIds.join(', ')}: ${rows.length} prices`);

// One market = one match, one period, one line (hc); in it, one list per outcome.
const markets = new Map();
for (const r of rows) {
  if (r.back_lay_id !== 0 || (r.order ?? 1) > 1) continue; // lay prices, deeper levels
  const key = `${r.match_id} period ${r.period_id} hc ${r.hc}`;
  if (!markets.has(key)) markets.set(key, { 2: [], 3: [], 4: [] });
  markets.get(key)[r.type_id].push({ book: r.bookmaker.name, price: r.price });
}
for (const [key, outcomes] of markets) {
  console.log(`Match ${key}`);
  for (const type of [2, 3, 4]) {
    const list = outcomes[type].sort((a, b) => b.price - a.price);
    const prices = list.map((x) => `${x.book} ${x.price}`).join(', ');
    console.log(`  ${SIDE[type]}: ${prices}`);
  }
}

Dove finisce il feed

Prendere la quota migliore per ciascun esito e trovare quote che, puntate insieme, coprano ogni esito garantendo un profitto è compito dello scanner. Quel calcolo spetta a te: il feed fornisce le quote grezze.

Passaggi successivi

Il caso d'uso dello scanner di arbitraggio mostra cos'altro legge uno scanner dall'API.

Provala con dati live

Il playground in un account gratuito esegue queste richieste nel tuo browser su dati live.