Get orderbook (v1, deprecated)
curl --request POST \
--url https://api.4casters.io/exchange/getOrderbook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"leagueRequested": "NBA"
}
'import requests
url = "https://api.4casters.io/exchange/getOrderbook"
payload = { "leagueRequested": "NBA" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({leagueRequested: 'NBA'})
};
fetch('https://api.4casters.io/exchange/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/getOrderbook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'leagueRequested' => 'NBA'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.4casters.io/exchange/getOrderbook"
payload := strings.NewReader("{\n \"leagueRequested\": \"NBA\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.4casters.io/exchange/getOrderbook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"leagueRequested\": \"NBA\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/getOrderbook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"leagueRequested\": \"NBA\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"market": "<string>",
"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": {},
"awaySpreads": {},
"over": {},
"under": {},
"homeMoneylines1x2": {},
"awayMoneylines1x2": {},
"draw1x2": {},
"mainHomeSpread": "<unknown>",
"mainAwaySpread": "<unknown>",
"mainTotal": "<unknown>",
"openInterest": 123,
"matchedVolume": 123
}
]
}
}市场
获取订单簿(v1,已弃用)
deprecated
为向后兼容保留的旧版嵌套订单簿端点
POST
/
exchange
/
getOrderbook
Get orderbook (v1, deprecated)
curl --request POST \
--url https://api.4casters.io/exchange/getOrderbook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"leagueRequested": "NBA"
}
'import requests
url = "https://api.4casters.io/exchange/getOrderbook"
payload = { "leagueRequested": "NBA" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({leagueRequested: 'NBA'})
};
fetch('https://api.4casters.io/exchange/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/getOrderbook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'leagueRequested' => 'NBA'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.4casters.io/exchange/getOrderbook"
payload := strings.NewReader("{\n \"leagueRequested\": \"NBA\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.4casters.io/exchange/getOrderbook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"leagueRequested\": \"NBA\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/getOrderbook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"leagueRequested\": \"NBA\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"market": "<string>",
"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": {},
"awaySpreads": {},
"over": {},
"under": {},
"homeMoneylines1x2": {},
"awayMoneylines1x2": {},
"draw1x2": {},
"mainHomeSpread": "<unknown>",
"mainAwaySpread": "<unknown>",
"mainTotal": "<unknown>",
"openInterest": 123,
"matchedVolume": 123
}
]
}
}已弃用。 更简单、推荐的扁平格式请使用
GET /exchange/v2/getOrderbook。此端点仅为与旧客户端向后兼容而保留。请求
POST /exchange/getOrderbook
string
必填
联赛代码(不区分大小写)。
curl -X POST https://api.4casters.io/exchange/getOrderbook \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"leagueRequested": "NBA"}'
响应
string
此端点始终为
null。array
带嵌套订单簿字段的赛事数组。单场形态见 获取单场订单簿 —
awayMoneylines / homeMoneylines 数组,以及按让分或大小分数键控的 awaySpreads / homeSpreads / over / under 对象。授权
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.
请求体
application/json
League code (case-insensitive).
响应
Nested-orderbook response
Show child attributes
Show child attributes
此页面对您有帮助吗?