Hướng dẫn này bắt đầu từ id của một trận đấu, và Yêu cầu đầu tiên của bạn sẽ chỉ cách tìm id đó. Tại đây trận đấu đang diễn ra, nơi mức kèo Asian handicap có thể được tính từ tỷ số hiện tại.
Các loại thị trường
Asian handicap và totals gồm bốn loại thị trường, bạn có thể yêu cầu trong odd_type_ids. Mức kèo của mỗi dòng nằm trong hc.
| type_id | Tên | Ý nghĩa |
|---|---|---|
0 | AH1 | Asian handicap, home |
1 | AH2 | Asian handicap, away |
8 | Over | Total goals over, Asian lines included (the line is in hc, e.g. 2.25 or 2.75). The coverage pages list the Asian lines as Asian Over/Under. |
9 | Under | Total goals under, Asian lines included (the line is in hc, e.g. 2.25 or 2.75). The coverage pages list the Asian lines as Asian Over/Under. |
Cách yêu cầu dữ liệu
Đưa trận đấu vào match_ids, bốn loại thị trường vào odd_type_ids và cả trận vào odd_period_ids. Loại thị trường và hiệp đấu là bộ lọc: nếu bỏ qua, phản hồi sẽ chứa mọi thị trường và hiệp đấu của trận.
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],"odd_type_ids":[0,1,8,9],"odd_period_ids":[1]}'const res = await fetch('https://oddfeeds.com/api/v1/feeds', {
method: 'POST',
headers: {
'Authorization': 'Bearer ofk_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({"scope":"odds","match_ids":[13675188],"odd_type_ids":[0,1,8,9],"odd_period_ids":[1]}),
});
const feed = await res.json();import requests
res = requests.post(
'https://oddfeeds.com/api/v1/feeds',
headers={'Authorization': 'Bearer ofk_your_api_key'},
json={"scope":"odds","match_ids":[13675188],"odd_type_ids":[0,1,8,9],"odd_period_ids":[1]},
timeout=20,
)
feed = res.json()Kết quả trả về · Kết quả thực tế từ API vào ngày 26 thg 11, 2026, hiển thị các dòng đầu tiên.
Phản hồi dưới dạng JSON: Cách yêu cầu dữ liệu
{
"status": "ok",
"data": {
"prematch": [],
"inplay": [
{
"id": 401955490,
"active": 1,
"match_id": 13675188,
"event_id": 72586828,
"bookmaker": {
"id": 26,
"name": "Bet365"
},
"datetime": "2026-11-26T15:17:12",
"period_id": 1,
"type_id": 0,
"order": 1,
"back_lay_id": 0,
"liquidity": -1,
"hc": 0.75,
"hc_as_draw": 1,
"price": 1.575,
"nav": "{\"v\":1,\"scope\":\"inplay\",\"eventId\":\"204400836\",\"oddId\":\"55...",
"runtime": {
"play": {
"codec": 12,
"display": "1H 12'"
},
"points": {
"home": 0,
"away": 0
}
}
},
{
"id": 401954914,
"active": 1,
"match_id": 13675188,
"event_id": 72457317,
"bookmaker": {
"id": 41,
"name": "yabo"
},
"datetime": "2026-11-26T15:17:20",
"period_id": 1,
"type_id": 0,
"order": 1,
"back_lay_id": 0,
"liquidity": -1,
"hc": 1,
"hc_as_draw": 1,
"price": 1.41,
"nav": "{\"v\":1,\"scope\":\"inplay\",\"eventId\":\"5853048\",\"event\":{\"spo...",
"runtime": {
"play": {
"codec": 12,
"display": "1H 12'"
},
"points": {
"home": 0,
"away": 0
}
}
}
]
},
"time": "2026-11-26T15:17:21",
"ms": "14.54ms"
}
Mỗi dòng là một tỷ lệ kèo từ một nhà cái: type_id cho biết thị trường và cửa cược nào, còn hc cung cấp mức kèo tương ứng.
Mức kèo và cách tính
| Trường dữ liệu | Ý nghĩa |
|---|---|
hc | The handicap / total line, e.g. -0.5 or 2.5. On 1X2 rows (type_id 2, 3, 4) a non-zero hc is a European handicap line, and for correct score (type_id 66) it carries the score; see the type_id table. |
hc_as_draw | 1 when the line counts from the current score, 0 when it counts from kickoff. In-play they differ by the goal difference: at 1-0, -0.25 with 1 equals -1.25 with 0. |
Khi trận đấu đang diễn ra, runtime chứa tỷ số tại thời điểm có tỷ lệ cược đó: tỷ số mà một mức kèo có hc_as_draw bằng 1 dùng làm mốc tính.
Cả trận và các hiệp
odd_period_ids chọn thời gian của trận đấu mà tỷ lệ cược áp dụng: cả trận, hiệp một hoặc hiệp hai.
| period_id | Tên |
|---|---|
0 | First half |
1 | Full time |
6 | Second half |
Lấy mọi mức kèo của một trận đấu bằng một script
Script này yêu cầu bốn loại thị trường của một trận đấu và in ra mức kèo của từng nhà cái, với cửa Over và Under của tổng số bàn thắng được đặt cạnh nhau. Script đọc API key từ ODDFEEDS_KEY và nhận trận đấu từ tham số đầu tiên, là một match_id từ kết quả phản hồi của bạn.
// Every Asian handicap and over/under line of one match, per bookmaker.
// Run it with your key and a match id from your own answer:
// ODDFEEDS_KEY=<your key> node asian-handicap.mjs <match id>
const API = process.env.ODDFEEDS_URL || 'https://oddfeeds.com/api/v1/feeds';
const matchId = Number(process.argv[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: [matchId],
odd_type_ids: [0, 1, 8, 9],
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(`Match ${matchId}: ${rows.length} prices`);
const SIDE = { 0: 'AH home', 1: 'AH away' };
const byBook = new Map();
for (const r of rows) {
if (!byBook.has(r.bookmaker.name)) byBook.set(r.bookmaker.name, []);
byBook.get(r.bookmaker.name).push(r);
}
for (const [name, list] of byBook) {
console.log(name);
const ah = list.filter((r) => r.type_id <= 1)
.sort((a, b) => a.type_id - b.type_id || a.hc - b.hc);
for (const r of ah) {
const fromScore = r.hc_as_draw ? ' (from the score)' : '';
console.log(` ${SIDE[r.type_id]} ${r.hc}${fromScore}: ${r.price}`);
}
const totals = new Map();
for (const r of list.filter((x) => x.type_id === 8 || x.type_id === 9)) {
if (!totals.has(r.hc)) totals.set(r.hc, {});
totals.get(r.hc)[r.type_id === 8 ? 'over' : 'under'] = r.price;
}
for (const [hc, t] of [...totals].sort((a, b) => a[0] - b[0])) {
console.log(` total ${hc}: over ${t.over ?? '-'}, under ${t.under ?? '-'}`);
}
}# Every Asian handicap and over/under line of one match, per bookmaker.
# Run it with your key and a match id from your own answer:
# ODDFEEDS_KEY=<your key> python asian-handicap.py <match id>
import os
import sys
import requests
API = os.environ.get('ODDFEEDS_URL', 'https://oddfeeds.com/api/v1/feeds')
match_id = int(sys.argv[1])
res = requests.post(
API,
headers={'Authorization': f"Bearer {os.environ['ODDFEEDS_KEY']}"},
json={'scope': 'odds', 'match_ids': [match_id],
'odd_type_ids': [0, 1, 8, 9], 'odd_period_ids': [1]},
timeout=20,
)
feed = res.json()
if feed['status'] != 'ok':
raise RuntimeError(f"{res.status_code}: {feed['error']}")
rows = feed['data']['prematch'] + feed['data']['inplay']
print(f"Match {match_id}: {len(rows)} prices")
SIDE = {0: 'AH home', 1: 'AH away'}
by_book = {}
for r in rows:
by_book.setdefault(r['bookmaker']['name'], []).append(r)
for name, items in by_book.items():
print(name)
ah = sorted((r for r in items if r['type_id'] <= 1),
key=lambda r: (r['type_id'], r['hc']))
for r in ah:
from_score = ' (from the score)' if r['hc_as_draw'] else ''
print(f" {SIDE[r['type_id']]} {r['hc']}{from_score}: {r['price']}")
totals = {}
for r in items:
if r['type_id'] in (8, 9):
side = 'over' if r['type_id'] == 8 else 'under'
totals.setdefault(r['hc'], {})[side] = r['price']
for hc, t in sorted(totals.items()):
print(f" total {hc}: over {t.get('over', '-')}, under {t.get('under', '-')}")Bước tiếp theo
Các bảng tham chiếu trong tài liệu liệt kê mọi loại thị trường và hiệp đấu, và trang phạm vi dữ liệu liệt kê các thị trường của từng nhà cái, bao gồm Asian handicap và Asian over/under.