Get orderbook (v2)
curl --request GET \
--url https://api.4casters.io/exchange/v2/getOrderbook \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/exchange/v2/getOrderbook"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.4casters.io/exchange/v2/getOrderbook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.4casters.io/exchange/v2/getOrderbook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.4casters.io/exchange/v2/getOrderbook"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.4casters.io/exchange/v2/getOrderbook")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/v2/getOrderbook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"games": [
{
"id": "<string>",
"parentGameID": "<string>",
"cheapDataUID": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"live": true,
"featured": true,
"eventName": "<string>",
"tournamentName": "<string>",
"periodName": "<string>",
"isSpecials": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"homeAway": "home",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
],
"homeMoneylines": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"awayMoneylines": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"homeSpreads": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"awaySpreads": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"over": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"under": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"homeMoneylines1x2": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"awayMoneylines1x2": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"draw1x2": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"openInterest": 123,
"matchedVolume": 123
}
]
}
}Mercados
Obtener libro de órdenes
Lee el libro de órdenes de una liga o juego (v2, recomendado)
GET
/
exchange
/
v2
/
getOrderbook
Get orderbook (v2)
curl --request GET \
--url https://api.4casters.io/exchange/v2/getOrderbook \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/exchange/v2/getOrderbook"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.4casters.io/exchange/v2/getOrderbook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.4casters.io/exchange/v2/getOrderbook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.4casters.io/exchange/v2/getOrderbook"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.4casters.io/exchange/v2/getOrderbook")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/v2/getOrderbook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"games": [
{
"id": "<string>",
"parentGameID": "<string>",
"cheapDataUID": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"live": true,
"featured": true,
"eventName": "<string>",
"tournamentName": "<string>",
"periodName": "<string>",
"isSpecials": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"homeAway": "home",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
],
"homeMoneylines": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"awayMoneylines": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"homeSpreads": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"awaySpreads": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"over": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"under": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"homeMoneylines1x2": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"awayMoneylines1x2": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"draw1x2": [
{
"id": "<string>",
"type": "moneyline",
"createdBy": "<string>",
"sumUntaken": 123,
"odds": 123,
"bet": 123,
"gameID": "<string>",
"takenRatio": 123,
"expiry": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"mockOrder": true,
"gameStartExpiry": true,
"isPostArb": true,
"participantID": "<string>",
"spread": 123,
"total": 123,
"OU": "over",
"market": "<string>",
"side": "yes"
}
],
"openInterest": 123,
"matchedVolume": 123
}
]
}
}Devuelve el libro de órdenes de una liga o de un solo juego en forma plana: cada mercado es un array de órdenes en lugar de un objeto indexado por spread / total.
Este es el endpoint de libro de órdenes recomendado. Combínalo con el feed de precios de Streaming WebSocket para actualizaciones en tiempo real.
Cada orden en esos arrays tiene la siguiente forma:
Solicitud
GET /exchange/v2/getOrderbook
string
Código de liga, p. ej.
NBA (no distingue mayúsculas). Obligatorio cuando no se proporciona gameID.string
Nombre del deporte, p. ej.
basketball (no distingue mayúsculas). Filtro opcional cuando está definido league.string
Id de un solo juego. Cuando se proporciona, se ignoran
league y sport.curl "https://api.4casters.io/exchange/v2/getOrderbook?league=NBA" \
-H "Authorization: Bearer YOUR_TOKEN"
curl "https://api.4casters.io/exchange/v2/getOrderbook?gameID=688c0516fbc14da0c202d426" \
-H "Authorization: Bearer YOUR_TOKEN"
Respuesta
array
Cada
game tiene la forma estándar de Game con los siguientes arrays adicionales por mercado:Mostrar Campos del libro de órdenes por juego
Mostrar Campos del libro de órdenes por juego
array
Órdenes moneyline en espera a favor del equipo visitante. Ordenadas con el mejor precio primero.
array
Órdenes moneyline en espera a favor del equipo local.
array
Órdenes spread en espera del lado visitante, aplanadas entre números de spread.
array
Órdenes spread en espera del lado local.
array
Órdenes
over en espera, aplanadas entre totals.array
Órdenes
under en espera.array
Solo fútbol. Órdenes de moneyline a tres vías a favor del equipo visitante.
array
Solo fútbol. Órdenes de moneyline a tres vías a favor del equipo local.
array
Solo fútbol. Órdenes de moneyline a tres vías sobre el empate.
number
Suma de
bet de cada orden en espera del juego.number
Volumen total cruzado en este juego.
Ejemplo (recortado)
{
"data": {
"games": [
{
"id": "67aaba04c32f13ae2e8aa070",
"league": "NBA",
"sport": "basketball",
"start": "2025-02-12T00:10:00.000Z",
"ended": false,
"live": false,
"featured": false,
"eventName": "TORONTO RAPTORS VS PHILADELPHIA 76ERS",
"isSpecials": false,
"periodName": "Full Time",
"participants": [/* away, home */],
"awayMoneylines": [
{
"id": "67ab79fc786aa2c2cfe7524f",
"type": "moneyline",
"sumUntaken": 1151.04,
"odds": 330,
"bet": 3798.43,
"gameID": "67aaba04c32f13ae2e8aa070",
"takenRatio": 0,
"participantID": "61a3917a8afa5950306490fd",
"expiry": "2025-02-12T00:10:06.000Z",
"createdAt": "2025-02-11T16:25:32.354Z",
"gameStartExpiry": true
}
],
"homeMoneylines": [/* ... */],
"awaySpreads": [/* ... */],
"homeSpreads": [/* ... */],
"over": [/* ... */],
"under": [/* ... */],
"openInterest": 12450.30,
"matchedVolume": 27916.55
}
]
}
}
Autorizaciones
Pass your auth token in the Authorization header. The Bearer prefix is optional; the server also accepts a signed auth cookie or a token field in the request body.
Parámetros de consulta
League code, e.g. NBA (case-insensitive).
Sport name, e.g. basketball (case-insensitive). Optional filter when league is set.
Single game id. When provided, league and sport are ignored.
Respuesta
Orderbook for one or more games
Show child attributes
Show child attributes
¿Esta página le ayudó?