API से arbitrage scanner को feed करें

एक ही request में आपकी key के सभी bookmakers के एक ही matches के दाम, हर outcome के हिसाब से सेट की गई कीमतें, और एक्शन लेने से पहले की जाने वाली जाँच। स्कैनिंग का काम पूरी तरह आपका अपना है।

6 मिनट में पढ़ें ·

यह गाइड in play matches की ids से शुरू होती है, और आपकी पहली request उन्हें ढूँढने का तरीका बताती है। एक scanner कई bookmakers पर एक market की तुलना करता है, और API उस एक match id के तहत मैच के लिए हर bookmaker के दाम देता है: आपको खुद कभी bookmakers के बीच events मैच नहीं करने पड़ते।

एक ही request में सभी bookmakers

matches को match_ids में डालें और bookmaker_ids को छोड़ दें: response में आपकी key से जुड़े हर bookmaker का data होता है, ताकि आप जिन कीमतों की तुलना कर रहे हैं, वे एक साथ पढ़ी गई हों।

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]}'

जवाब · 26 नव॰ 2026 को API से मिला एक जवाब, जिसकी शुरुआती रो दिखाई गई हैं। आपके अपने जवाब में अलग ids होंगी: उन्हें अगली रिक्वेस्ट में इस्तेमाल करें।

JSON में जवाब: एक ही request में सभी bookmakers
{
  "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"
}

कीमतों को align करें

एक ही outcome की कीमतें match_id, period_id, type_id और hc share करती हैं। 1X2 rows पर type ही outcome होता है:

मार्केट के प्रकार
type_idनाममतलब
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.

किन चीज़ों की तुलना न करें

किसी exchange पर एक row lay price (back_lay_id 1) हो सकती है या best level से नीचे का level (order 2 या 3) हो सकती है। back prices का scanner हमेशा best level पर मौजूद back prices को ही रखता है।

odds रो के फ़ील्ड्स
फ़ील्डमतलब
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.

जब bookmaker किसी कीमत को suspend या close कर देता है, तो वह feed से हट जाती है: response में गायब कीमत उपलब्ध नहीं होती, इसलिए कभी भी आखिरी बार देखी गई कीमत को स्टोर करके न रखें।

एक्शन लेने से पहले जाँच करें

कीमतों पर एक्शन लेने से पहले, उनकी ids को odds_seen में भेजें: seen बताता है कि हमारे scanner ने आखिरी बार उसकी पुष्टि कब की थी, और हटने पर closed भर दिया जाता है।

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]}'

जवाब · 26 नव॰ 2026 को API से मिला एक जवाब, जिसकी शुरुआती रो दिखाई गई हैं।

JSON में जवाब: एक्शन लेने से पहले जाँच करें
{
  "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"
}

एक ही script में सेट की गई कीमतें

यह script आपके द्वारा दिए गए matches के लिए आपकी key के हर bookmaker से 1X2 कीमतें मँगाती है, best level पर back prices रखती है, और हर outcome की कीमतों को सबसे ऊँची से नीचे के क्रम में प्रिंट करती है। यह आपकी key को 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}`);
  }
}

feed कहाँ ख़त्म होती है

हर outcome की सबसे बेहतरीन कीमत लेना और ऐसी कीमतें ढूँढना जो मिलकर हर outcome को कवर करें, scanner का अपना काम है। वह गणना आपकी अपनी है: feed केवल raw कीमतें देती है।

आगे

arbitrage scanner use case दिखाता है कि एक scanner API से और क्या-क्या पढ़ता है।

इसे लाइव डेटा पर आज़माएं

फ्री अकाउंट में प्लेग्राउंड आपके ब्राउज़र में लाइव डेटा पर इन रिक्वेस्ट को रन करता है।