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
}
]
}
}市场
获取订单簿
读取某联赛或赛事的订单簿(v2,推荐)
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
}
]
}
}以扁平形式返回某联赛或单场赛事的订单簿:每个市场是订单数组,而不是按让分 / 大小分数键控的对象。
这是推荐的订单簿端点。与 WebSocket 推送 行情推送搭配,可获取实时更新。
这些数组中的每笔订单具有以下形态:
请求
GET /exchange/v2/getOrderbook
string
联赛代码,例如
NBA(不区分大小写)。未提供 gameID 时必填。string
运动项目名称,例如
basketball(不区分大小写)。设置 league 时的可选过滤。string
单场赛事 ID。提供时会忽略
league 和 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"
响应
array
示例(已精简)
{
"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
}
]
}
}
授权
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.
查询参数
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.
响应
Orderbook for one or more games
Show child attributes
Show child attributes
此页面对您有帮助吗?