가이드 / JavaScript 배당률 API

JavaScript 배당률 API

dino.markets 팀 작성 · 2026년 11월 25일 업데이트

이 스크립트는 북메이커 두 곳의 NBA 머니라인을 요청하고, 모든 페이지를 순회하며, 북메이커마다 한 줄을 출력합니다. Node.js 18 이상이 필요하며 패키지는 없습니다. 아래 출력은 Node.js 24에서 나온 것입니다.

키 설정

대시보드에서 키를 만들고 DINO_API_KEY로 내보내세요. 스크립트는 Authorization: Bearer 헤더로 보냅니다.

스크립트 실행

다음을 odds.mjs로 저장하고 node odds.mjs를 실행하세요.

const url = new URL("https://api.dino.markets/v2/odds");
url.search = new URLSearchParams({ league: "nba", markets: "moneyline", books: "draftkings,fanduel", limit: "5" });
const headers = { Authorization: `Bearer ${process.env.DINO_API_KEY}` };

let cursor = null;
do {
  if (cursor) url.searchParams.set("cursor", cursor);
  const response = await fetch(url, { headers });
  const body = await response.json();
  if (!response.ok) throw new Error(`${response.status} ${body.error}: ${body.message}`);

  for (const event of body.events) {
    if (new Date(event.start_time) <= new Date()) continue; // only games that have not started
    const team = Object.fromEntries(event.participants.map((p) => [p.role, p.name]));
    console.log(`${team.away} at ${team.home}, ${event.start_time}`);
    for (const book of event.books) {
      const prices = book.markets[0].outcomes.map((o) => `${o.name} ${o.american}`);
      console.log(`  ${book.name}: ${prices.join(", ")}`);
    }
  }
  cursor = body.next_cursor;
  if (!cursor) console.log(`${response.headers.get("x-requests-remaining")} credits left`);
} while (cursor);

2026년 11월 25일 03:33 UTC에 실행한 첫 두 경기와 마지막 줄:

출력
Miami Heat at Philadelphia 76ers, 2026-11-25T22:10:00Z
  DraftKings: Philadelphia 76ers -116, Miami Heat -102
  FanDuel: Philadelphia 76ers -104, Miami Heat -112
Chicago Bulls at Charlotte Hornets, 2026-11-26T00:10:00Z
  DraftKings: Charlotte Hornets -163, Chicago Bulls +137
  FanDuel: Charlotte Hornets -158, Chicago Bulls +134
...
999960 credits left

경기 페이지 넘기기

limit은 1~100경기를 받으며, 생략하면 25입니다. next_cursor가 null이 아닌 동안 같은 필터와 함께 cursor로 다시 보내세요. 스크립트는 반복을 보여 주려고 5를 사용합니다.

크레딧 계산

스크립트가 읽는 페이지마다 호출 한 번, 1크레딧입니다. 따라서 limit이 높을수록 같은 경기를 더 적은 크레딧으로 읽습니다. GET /v2/events는 가격 없이 같은 경기를 나열하며 무료입니다.

오류 읽기

오류 응답에는 error, message, request_id가 있습니다. 키가 틀리면 스크립트는 다음 줄을 출력하고 멈춥니다.

출력
Error: 401 unauthorized: API key is invalid or not tied to a subscription.

오류 페이지에 모든 코드가 있습니다.

자주 묻는 질문

JavaScript SDK가 있나요?

아니요. API는 HTTPS의 일반 JSON이므로 내장 fetch면 충분합니다.

웹 페이지에서 호출해도 되나요?

서버에서 호출하세요. 키를 볼 수 있는 사람은 누구나 내 크레딧을 쓸 수 있습니다.

경기 하나는 어떻게 받나요?

이벤트 id로 GET /v2/events/{id}/odds를 요청하세요. 응답에 북메이커가 있으면 1크레딧입니다.

429를 받으면 어떻게 하나요?

rate_limited면 Retry-After 초만큼 기다리세요. quota_exceeded면 다음 달까지 기다리거나 요금제를 바꾸세요.