Get order books (request body)
curl --request POST \
--url https://clob.polymarket.com/books \
--header 'Content-Type: application/json' \
--data '
[
{
"token_id": "0xabc123def456..."
},
{
"token_id": "0xdef456abc123..."
}
]
'import requests
url = "https://clob.polymarket.com/books"
payload = [{ "token_id": "0xabc123def456..." }, { "token_id": "0xdef456abc123..." }]
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([{token_id: '0xabc123def456...'}, {token_id: '0xdef456abc123...'}])
};
fetch('https://clob.polymarket.com/books', 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://clob.polymarket.com/books",
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([
[
'token_id' => '0xabc123def456...'
],
[
'token_id' => '0xdef456abc123...'
]
]),
CURLOPT_HTTPHEADER => [
"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://clob.polymarket.com/books"
payload := strings.NewReader("[\n {\n \"token_id\": \"0xabc123def456...\"\n },\n {\n \"token_id\": \"0xdef456abc123...\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
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://clob.polymarket.com/books")
.header("Content-Type", "application/json")
.body("[\n {\n \"token_id\": \"0xabc123def456...\"\n },\n {\n \"token_id\": \"0xdef456abc123...\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://clob.polymarket.com/books")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"token_id\": \"0xabc123def456...\"\n },\n {\n \"token_id\": \"0xdef456abc123...\"\n }\n]"
response = http.request(request)
puts response.read_body[
{
"market": "0x1234567890123456789012345678901234567890",
"asset_id": "0xabc123def456...",
"timestamp": "1234567890",
"hash": "a1b2c3d4e5f6...",
"bids": [
{
"price": "0.45",
"size": "100"
}
],
"asks": [
{
"price": "0.46",
"size": "150"
}
],
"min_order_size": "1",
"tick_size": "0.01",
"neg_risk": false,
"last_trade_price": "0.45"
}
]{
"error": "Invalid payload"
}获取订单簿(请求体)
Retrieves order book summaries for multiple token IDs using a request body.
POST
/
books
Get order books (request body)
curl --request POST \
--url https://clob.polymarket.com/books \
--header 'Content-Type: application/json' \
--data '
[
{
"token_id": "0xabc123def456..."
},
{
"token_id": "0xdef456abc123..."
}
]
'import requests
url = "https://clob.polymarket.com/books"
payload = [{ "token_id": "0xabc123def456..." }, { "token_id": "0xdef456abc123..." }]
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([{token_id: '0xabc123def456...'}, {token_id: '0xdef456abc123...'}])
};
fetch('https://clob.polymarket.com/books', 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://clob.polymarket.com/books",
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([
[
'token_id' => '0xabc123def456...'
],
[
'token_id' => '0xdef456abc123...'
]
]),
CURLOPT_HTTPHEADER => [
"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://clob.polymarket.com/books"
payload := strings.NewReader("[\n {\n \"token_id\": \"0xabc123def456...\"\n },\n {\n \"token_id\": \"0xdef456abc123...\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
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://clob.polymarket.com/books")
.header("Content-Type", "application/json")
.body("[\n {\n \"token_id\": \"0xabc123def456...\"\n },\n {\n \"token_id\": \"0xdef456abc123...\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://clob.polymarket.com/books")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"token_id\": \"0xabc123def456...\"\n },\n {\n \"token_id\": \"0xdef456abc123...\"\n }\n]"
response = http.request(request)
puts response.read_body[
{
"market": "0x1234567890123456789012345678901234567890",
"asset_id": "0xabc123def456...",
"timestamp": "1234567890",
"hash": "a1b2c3d4e5f6...",
"bids": [
{
"price": "0.45",
"size": "100"
}
],
"asks": [
{
"price": "0.46",
"size": "150"
}
],
"min_order_size": "1",
"tick_size": "0.01",
"neg_risk": false,
"last_trade_price": "0.45"
}
]{
"error": "Invalid payload"
}请求体
application/json
响应
Successfully retrieved order books
Market condition ID
示例:
"0x1234567890123456789012345678901234567890"
Token ID (asset ID)
示例:
"0xabc123def456..."
Timestamp of the order book snapshot
示例:
"1234567890"
Hash of the order book summary
示例:
"a1b2c3d4e5f6..."
List of bid orders (sorted by price descending)
Show child attributes
Show child attributes
List of ask orders (sorted by price ascending)
Show child attributes
Show child attributes
Minimum order size
示例:
"1"
Minimum price increment (tick size)
示例:
"0.01"
Whether negative risk is enabled for this market
示例:
false
Last trade price
示例:
"0.45"
此页面对您有帮助吗?
⌘I