Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c537944241 |
@@ -418,7 +418,7 @@ sequenceDiagram
|
||||
participant C as 客户端
|
||||
participant H as market_http.rs
|
||||
participant E as Exchange
|
||||
C->>H: GET /neg-risk?token_id=eb%3ANO%3Aa
|
||||
C->>H: GET /neg-risk/{token_id} 或 /neg-risk?token_id=…
|
||||
H->>E: 查询市场 a 的成员关系
|
||||
E-->>H: true
|
||||
H-->>C: 200,neg_risk 为真
|
||||
|
||||
@@ -200,9 +200,17 @@ fn token_setting(
|
||||
.token_id
|
||||
.into(),
|
||||
};
|
||||
if token.trim().is_empty() {
|
||||
return Err(invalid);
|
||||
}
|
||||
let missing = if name == "fee-rate" {
|
||||
(404, "fee rate not found for market")
|
||||
} else {
|
||||
(404, "market not found")
|
||||
};
|
||||
let exchange = engine.lock().map_err(|_| (500, "Internal server error"))?;
|
||||
let unavailable = |e| match e {
|
||||
exchange::MarketDataError::Invalid(_) => invalid,
|
||||
exchange::MarketDataError::Invalid(_) => missing,
|
||||
exchange::MarketDataError::Unavailable => (500, "Internal server error"),
|
||||
};
|
||||
match name {
|
||||
@@ -210,21 +218,21 @@ fn token_setting(
|
||||
let flag = exchange
|
||||
.token_neg_risk(&token)
|
||||
.map_err(unavailable)?
|
||||
.ok_or((404, "market not found"))?;
|
||||
.ok_or(missing)?;
|
||||
Ok(json!({"neg_risk":flag}))
|
||||
}
|
||||
"fee-rate" => {
|
||||
let fee = exchange
|
||||
.base_fee_bps(&token)
|
||||
.map_err(unavailable)?
|
||||
.ok_or((404, "fee rate not found for market"))?;
|
||||
.ok_or(missing)?;
|
||||
Ok(json!({"base_fee":fee}))
|
||||
}
|
||||
_ => {
|
||||
let tick = exchange
|
||||
.minimum_tick_size(&token)
|
||||
.map_err(unavailable)?
|
||||
.ok_or((404, "market not found"))?;
|
||||
.ok_or(missing)?;
|
||||
Ok(json!({"minimum_tick_size":tick}))
|
||||
}
|
||||
}
|
||||
@@ -339,9 +347,8 @@ fn respond(mut req: Request, engine: &Mutex<Exchange>) -> std::io::Result<()> {
|
||||
let (name, segment) = route
|
||||
.split_once('/')
|
||||
.map_or((route, None), |(name, id)| (name, Some(id)));
|
||||
let is_setting = path == "/neg-risk"
|
||||
|| (matches!(name, "tick-size" | "fee-rate")
|
||||
&& !segment.is_some_and(|id| id.contains('/')));
|
||||
let is_setting = matches!(name, "neg-risk" | "tick-size" | "fee-rate")
|
||||
&& !segment.is_some_and(|id| id.contains('/'));
|
||||
let lookup = path
|
||||
.strip_prefix('/')
|
||||
.and_then(|p| p.split_once('/'))
|
||||
@@ -617,6 +624,9 @@ mod tests {
|
||||
let lookup_info = json!({"mbf":0,"tbf":30,"fd":{"r":0.05,"e":1,"to":true},"gst":null,"nr":false,"rfqe":false,"ibce":false,"oas":0,"mos":0.01,"mts":0.0025,
|
||||
"t":[{"o":"YES","t":"eb:YES:map+2/1"},{"o":"NO","t":"eb:NO:map+2/1"}]});
|
||||
for command in [
|
||||
json!({"op":"list","id":"rp-list","market":"resolved-params","rules":"resolved parameters","tick_size":"0.001","base_fees":{"maker_bps":0,"taker_bps":1000}}),
|
||||
json!({"op":"close","id":"rp-close","market":"resolved-params"}),
|
||||
json!({"op":"finalize","id":"rp-final","market":"resolved-params","winner":"YES"}),
|
||||
json!({"op":"fund","id":"v-fund","account":"unpriced-owner","cents":100}),
|
||||
json!({"op":"list","id":"v-list","market":"unpriced","rules":"valuation fixture"}),
|
||||
json!({"op":"split","id":"v-split","account":"unpriced-owner","market":"unpriced","qty":1}),
|
||||
@@ -779,9 +789,17 @@ mod tests {
|
||||
("GET","/clob-markets/missing",String::new(),400,None),
|
||||
("POST","/clob-markets/map+2%2F1","{}".into(),405,None),
|
||||
("GET",tick_query.as_str(),String::new(),200,Some(json!({"minimum_tick_size":0.01}))),
|
||||
("GET","/neg-risk/eb:NO:map+2%2F1",String::new(),200,Some(json!({"neg_risk":false}))),
|
||||
("GET","/neg-risk/",String::new(),400,Some(json!({"error":"Invalid token id"}))),
|
||||
("GET","/neg-risk/garbage",String::new(),404,Some(json!({"error":"market not found"}))),
|
||||
("GET","/fee-rate?token_id=garbage",String::new(),404,Some(json!({"error":"fee rate not found for market"}))),
|
||||
("GET","/tick-size/garbage",String::new(),404,Some(json!({"error":"market not found"}))),
|
||||
("GET","/neg-risk/eb:NO:resolved-params",String::new(),200,Some(json!({"neg_risk":false}))),
|
||||
("GET","/fee-rate/eb:NO:resolved-params",String::new(),200,Some(json!({"base_fee":1000}))),
|
||||
("GET","/tick-size/eb:NO:resolved-params",String::new(),200,Some(json!({"minimum_tick_size":0.001}))),
|
||||
("GET","/neg-risk?token_id=eb%3AYES%3Amap%2B2%2F1",String::new(),200,Some(json!({"neg_risk":false}))),
|
||||
("GET","/neg-risk?token_id=eb%3ANO%3Amissing",String::new(),404,None),
|
||||
("GET","/neg-risk?token_id=bad",String::new(),400,None),
|
||||
("GET","/neg-risk?token_id=bad",String::new(),404,Some(json!({"error":"market not found"}))),
|
||||
("GET","/neg-risk",String::new(),400,None),
|
||||
("POST","/neg-risk",String::new(),405,None),
|
||||
("GET","/fee-rate?token_id=eb%3AYES%3Amap%2B2%2F1",String::new(),200,Some(json!({"base_fee":30}))),
|
||||
|
||||
@@ -123,28 +123,3 @@ sequenceDiagram
|
||||
2026-12-03 06:55 UTC 采集的[同侧报价快照](fixtures/live-side-prices.json)按请求保存前后盘口、报价、时间、方法及响应。双侧盘口最优价为 0.039 和 0.04。缺买盘的结果返回 BUY 字符串 0,缺卖盘的结果返回 SELL 字符串 1。批量 POST 返回相同字符串。文档列出的逗号分隔 GET 在这次生产取样返回 400。三个资产的前后盘口哈希各自一致。[官方单价接口](https://docs.polymarket.com/api-reference/market-data/get-market-price)
|
||||
|
||||
[电竞盘双空样本](fixtures/live-empty-prices.json)保留前后盘口和两次价格请求。两个深度数组均为空,公开 BUY 返回 "0",SELL 返回 "1"。探针把该结果计为已验证的空盘报价,实际可成交数量仍为零。
|
||||
|
||||
## 外场资产协议对应关系
|
||||
|
||||
`--inspect-condition ID` 查询市场条件、V2 结构条件或互斥组。用 `--inspect-tokens IDS` 查询逗号分隔的资产 ID。两者输出请求来源、完整响应及按协议整理的结果。保存输出后可用 `--replay-tokens FILE` 离线核对。单资产查询只展示返回的一侧,complete 为 false。
|
||||
|
||||
迁移市场样本中,市场条件返回 CTF 与 V2 两对资产,结构条件只返回 V2 的一对。互斥组样本覆盖三道题,各有 CTF 与 V2 两对。探针核对同对互补链接,以及 binary 和 neg_risk 的 V2 资产高位条件和低位结果索引。目录结果用于识别资产协议,实际可交易资产仍由场所盘口确认。[生产样本](fixtures/live-token-families.json) · [官方 Data API](https://data-api.polymarket.com/v2/openapi.json)
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
main["main.rs"] --> lookup["token_families.rs"]
|
||||
lookup --> id["catalog.rs 的 uint256 解码"]
|
||||
lookup --> api["Polymarket Data API /v2/tokens"]
|
||||
```
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant C as 操作员
|
||||
participant P as venue-probe
|
||||
participant D as Data API
|
||||
C->>P: 查询条件、互斥组或结果资产
|
||||
P->>D: GET /v2/tokens
|
||||
D-->>P: 各协议的资产与互补链接
|
||||
P->>P: 按市场和协议配对,核对 V2 编码
|
||||
P-->>C: 原始响应与协议分组
|
||||
```
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@ fn pair(value: &Value) -> Result<[String; 2]> {
|
||||
}
|
||||
|
||||
// Polymarket serializes token IDs as decimal strings. Decode without f64 or u128 truncation.
|
||||
pub(crate) fn uint256(raw: &str) -> Result<[u8; 32]> {
|
||||
fn uint256(raw: &str) -> Result<[u8; 32]> {
|
||||
ensure!(
|
||||
!raw.is_empty() && raw.len() <= 78 && raw.bytes().all(|b| b.is_ascii_digit()),
|
||||
"invalid decimal token ID"
|
||||
|
||||
@@ -3,7 +3,6 @@ mod books;
|
||||
mod catalog;
|
||||
mod price_check;
|
||||
mod probes;
|
||||
mod token_families;
|
||||
use anyhow::{ensure, Result};
|
||||
use reqwest::blocking::Client;
|
||||
use serde_json::{json, Value};
|
||||
@@ -34,22 +33,8 @@ fn observe_book(client: &Client, url: reqwest::Url, token: &str) -> Result<()> {
|
||||
fn main() -> Result<()> {
|
||||
let args: Vec<_> = std::env::args().skip(1).collect();
|
||||
let usage =
|
||||
"usage: venue-probe [--compare-prices | --inspect-book TOKEN | --replay-book TOKEN FILE | --replay-market FILE | --inspect-condition ID | --inspect-tokens IDS | --replay-tokens FILE]";
|
||||
"usage: venue-probe [--compare-prices | --inspect-book TOKEN | --replay-book TOKEN FILE | --replay-market FILE]";
|
||||
if let [mode, file] = args.as_slice() {
|
||||
if mode == "--replay-tokens" {
|
||||
let input: Value = serde_json::from_reader(std::fs::File::open(file)?)?;
|
||||
if let Some(status) = input.get("status") {
|
||||
ensure!(
|
||||
status.as_u64().is_some_and(|n| (200..300).contains(&n)),
|
||||
"saved request failed"
|
||||
);
|
||||
}
|
||||
println!(
|
||||
"{}",
|
||||
token_families::inspect(input.get("body").unwrap_or(&input))?
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
if mode == "--replay-market" {
|
||||
let raw = serde_json::from_reader(std::fs::File::open(file)?)?;
|
||||
println!("{}", catalog::Market::parse(&raw)?.report);
|
||||
@@ -73,14 +58,7 @@ fn main() -> Result<()> {
|
||||
let compare = match args.as_slice() {
|
||||
[] => false,
|
||||
[flag] if flag == "--compare-prices" => true,
|
||||
[flag, _]
|
||||
if matches!(
|
||||
flag.as_str(),
|
||||
"--inspect-book" | "--inspect-condition" | "--inspect-tokens"
|
||||
) =>
|
||||
{
|
||||
false
|
||||
}
|
||||
[flag, _] if flag == "--inspect-book" => false,
|
||||
_ => anyhow::bail!(usage),
|
||||
};
|
||||
let client = Client::builder()
|
||||
@@ -88,16 +66,7 @@ fn main() -> Result<()> {
|
||||
.timeout(Duration::from_secs(15))
|
||||
.user_agent("eventbook-readonly-probe/0.1")
|
||||
.build()?;
|
||||
if let [flag, token] = args.as_slice() {
|
||||
if matches!(flag.as_str(), "--inspect-condition" | "--inspect-tokens") {
|
||||
let selector = if flag == "--inspect-condition" {
|
||||
"condition"
|
||||
} else {
|
||||
"token_id"
|
||||
};
|
||||
println!("{}", token_families::observe(&client, selector, token)?);
|
||||
return Ok(());
|
||||
}
|
||||
if let [_, token] = args.as_slice() {
|
||||
let url = reqwest::Url::parse_with_params(
|
||||
"https://clob.polymarket.com/book",
|
||||
&[("token_id", token)],
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
use crate::catalog::uint256;
|
||||
use anyhow::{ensure, Context, Result};
|
||||
use reqwest::{blocking::Client, Url};
|
||||
use serde::Deserialize;
|
||||
use serde_json::{json, Value};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Token<'a> {
|
||||
token_id: &'a str,
|
||||
condition_id: &'a str,
|
||||
structural_condition_id: Option<&'a str>,
|
||||
module: &'a str,
|
||||
outcome_index: u8,
|
||||
opposite_token_id: &'a str,
|
||||
question_index: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Eq, Hash, PartialEq)]
|
||||
struct Family<'a> {
|
||||
condition: &'a str,
|
||||
structure: Option<&'a str>,
|
||||
module: &'a str,
|
||||
}
|
||||
|
||||
pub(crate) fn inspect(body: &Value) -> Result<Value> {
|
||||
let data = body["data"].as_array().context("missing token rows")?;
|
||||
let mut families = Vec::<[Option<&Value>; 2]>::new();
|
||||
let mut indexes = HashMap::new();
|
||||
let mut seen = HashSet::new();
|
||||
for row in data {
|
||||
let token = Token::deserialize(row)?;
|
||||
let token_id = uint256(token.token_id)?;
|
||||
let opposite = uint256(token.opposite_token_id)?;
|
||||
ensure!(seen.insert(token_id), "duplicate token ID");
|
||||
ensure!(
|
||||
token_id != opposite && token.outcome_index <= 1,
|
||||
"invalid binary pair"
|
||||
);
|
||||
if matches!(token.module, "binary" | "neg_risk") {
|
||||
let mut structural = String::from("0x");
|
||||
use std::fmt::Write;
|
||||
for byte in &token_id[..31] {
|
||||
write!(structural, "{byte:02x}")?;
|
||||
}
|
||||
structural.push_str("00");
|
||||
ensure!(
|
||||
token.structural_condition_id == Some(structural.as_str())
|
||||
&& token_id[31] == token.outcome_index
|
||||
&& opposite[..31] == token_id[..31]
|
||||
&& opposite[31] == 1 - token.outcome_index,
|
||||
"V2 position ID contradicts structural condition or outcome"
|
||||
);
|
||||
}
|
||||
let key = Family {
|
||||
condition: token.condition_id,
|
||||
structure: token.structural_condition_id,
|
||||
module: token.module,
|
||||
};
|
||||
let family = *indexes.entry(key).or_insert_with(|| {
|
||||
families.push([None, None]);
|
||||
families.len() - 1
|
||||
});
|
||||
let slots = &mut families[family];
|
||||
if let Some(other) = slots[usize::from(1 - token.outcome_index)] {
|
||||
let other = Token::deserialize(other)?;
|
||||
ensure!(
|
||||
other.token_id == token.opposite_token_id
|
||||
&& other.opposite_token_id == token.token_id
|
||||
&& other.question_index == token.question_index,
|
||||
"outcome links point outside the protocol pair"
|
||||
);
|
||||
}
|
||||
ensure!(
|
||||
slots[usize::from(token.outcome_index)]
|
||||
.replace(row)
|
||||
.is_none(),
|
||||
"duplicate outcome slot"
|
||||
);
|
||||
}
|
||||
let groups: Vec<_> = families.into_iter().map(|slots| {
|
||||
let row = slots[0].or(slots[1]).expect("each family has a known token");
|
||||
json!({
|
||||
"condition_id":row["condition_id"], "structural_condition_id":row["structural_condition_id"],
|
||||
"module":row["module"],"question_index":row["question_index"],
|
||||
"complete":slots.iter().all(Option::is_some),"outcomes":slots
|
||||
})
|
||||
}).collect();
|
||||
Ok(json!({"families":groups,"token_count":data.len()}))
|
||||
}
|
||||
|
||||
pub(crate) fn observe(client: &Client, selector: &str, value: &str) -> Result<Value> {
|
||||
let url = Url::parse_with_params(
|
||||
"https://data-api.polymarket.com/v2/tokens",
|
||||
&[(selector, value)],
|
||||
)?;
|
||||
let response = client.get(url.clone()).send()?.error_for_status()?;
|
||||
let status = response.status().as_u16();
|
||||
let observed = response
|
||||
.headers()
|
||||
.get(reqwest::header::DATE)
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.map(str::to_owned);
|
||||
let body: Value = response.json()?;
|
||||
let report = inspect(&body)?;
|
||||
Ok(json!({"source":url.as_str(),"status":status,"date":observed,"body":body,"report":report}))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn production_rows_separate_both_protocols_and_partial_lookup() {
|
||||
let sample: Value =
|
||||
serde_json::from_str(include_str!("../fixtures/live-token-families.json")).unwrap();
|
||||
let migrated = &sample["neg_risk_migrated"];
|
||||
let body = &migrated["responses"][0]["body"];
|
||||
let groups = inspect(body).unwrap();
|
||||
assert_eq!(groups["token_count"], 4);
|
||||
assert_eq!(groups["families"][0]["module"], "v1_ctf");
|
||||
assert_eq!(groups["families"][1]["module"], "neg_risk");
|
||||
assert_eq!(groups["families"][1]["complete"], true);
|
||||
assert_eq!(
|
||||
inspect(&migrated["structural"]["body"]).unwrap()["token_count"],
|
||||
2
|
||||
);
|
||||
assert_eq!(
|
||||
inspect(&sample["group"]["body"]).unwrap()["families"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.len(),
|
||||
6
|
||||
);
|
||||
assert_eq!(
|
||||
inspect(&sample["one"]["body"]).unwrap()["families"][0]["complete"],
|
||||
false
|
||||
);
|
||||
let mut mismatch = body.clone();
|
||||
mismatch["data"][0]["opposite_token_id"] = mismatch["data"][3]["token_id"].clone();
|
||||
assert!(inspect(&mismatch).is_err());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{"endpoint":"fee-rate","mode":"query","case":"live","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate?token_id=35090254409399344650860070211816464534198960801264823587796928404808383727584","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:31 GMT","body":{"base_fee":1000}}},
|
||||
{"endpoint":"fee-rate","mode":"query","case":"resolved_v1","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate?token_id=73979342585906843441145134109923710004884703083095161594360108477170435492453","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:31 GMT","body":{"base_fee":1000}}},
|
||||
{"endpoint":"fee-rate","mode":"query","case":"resolved_v2","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate?token_id=759916398134244316868652908232832573045153963965173623897622651599218278400","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:31 GMT","body":{"base_fee":1000}}},
|
||||
{"endpoint":"fee-rate","mode":"query","case":"unknown","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate?token_id=123","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:31 GMT","body":{"error":"fee rate not found for market"}}},
|
||||
{"endpoint":"fee-rate","mode":"query","case":"malformed","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate?token_id=not-an-asset","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"error":"fee rate not found for market"}}},
|
||||
{"endpoint":"fee-rate","mode":"query","case":"blank","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate?token_id=","payload":null,"status":400,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"error":"Invalid token id"}}},
|
||||
{"endpoint":"fee-rate","mode":"json_path","case":"live","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate/35090254409399344650860070211816464534198960801264823587796928404808383727584","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"base_fee":1000}}},
|
||||
{"endpoint":"fee-rate","mode":"json_path","case":"resolved_v1","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate/73979342585906843441145134109923710004884703083095161594360108477170435492453","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"base_fee":1000}}},
|
||||
{"endpoint":"fee-rate","mode":"json_path","case":"resolved_v2","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate/759916398134244316868652908232832573045153963965173623897622651599218278400","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"base_fee":1000}}},
|
||||
{"endpoint":"fee-rate","mode":"json_path","case":"unknown","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate/123","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"error":"fee rate not found for market"}}},
|
||||
{"endpoint":"fee-rate","mode":"json_path","case":"malformed","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate/not-an-asset","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"error":"fee rate not found for market"}}},
|
||||
{"endpoint":"tick-size","mode":"query","case":"live","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size?token_id=35090254409399344650860070211816464534198960801264823587796928404808383727584","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"minimum_tick_size":0.001}}},
|
||||
{"endpoint":"tick-size","mode":"query","case":"resolved_v1","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size?token_id=73979342585906843441145134109923710004884703083095161594360108477170435492453","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"minimum_tick_size":0.001}}},
|
||||
{"endpoint":"tick-size","mode":"query","case":"resolved_v2","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size?token_id=759916398134244316868652908232832573045153963965173623897622651599218278400","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"minimum_tick_size":0.001}}},
|
||||
{"endpoint":"tick-size","mode":"query","case":"unknown","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size?token_id=123","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"error":"market not found"}}},
|
||||
{"endpoint":"tick-size","mode":"query","case":"malformed","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size?token_id=not-an-asset","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:32 GMT","body":{"error":"market not found"}}},
|
||||
{"endpoint":"tick-size","mode":"query","case":"blank","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size?token_id=","payload":null,"status":400,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"error":"Invalid token id"}}},
|
||||
{"endpoint":"tick-size","mode":"json_path","case":"live","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size/35090254409399344650860070211816464534198960801264823587796928404808383727584","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"minimum_tick_size":0.001}}},
|
||||
{"endpoint":"tick-size","mode":"json_path","case":"resolved_v1","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size/73979342585906843441145134109923710004884703083095161594360108477170435492453","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"minimum_tick_size":0.001}}},
|
||||
{"endpoint":"tick-size","mode":"json_path","case":"resolved_v2","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size/759916398134244316868652908232832573045153963965173623897622651599218278400","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"minimum_tick_size":0.001}}},
|
||||
{"endpoint":"tick-size","mode":"json_path","case":"unknown","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size/123","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"error":"market not found"}}},
|
||||
{"endpoint":"tick-size","mode":"json_path","case":"malformed","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size/not-an-asset","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"error":"market not found"}}},
|
||||
{"endpoint":"neg-risk","mode":"query","case":"live","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk?token_id=35090254409399344650860070211816464534198960801264823587796928404808383727584","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"neg_risk":true}}},
|
||||
{"endpoint":"neg-risk","mode":"query","case":"resolved_v1","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk?token_id=73979342585906843441145134109923710004884703083095161594360108477170435492453","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"neg_risk":false}}},
|
||||
{"endpoint":"neg-risk","mode":"query","case":"resolved_v2","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk?token_id=759916398134244316868652908232832573045153963965173623897622651599218278400","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"neg_risk":false}}},
|
||||
{"endpoint":"neg-risk","mode":"query","case":"unknown","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk?token_id=123","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:33 GMT","body":{"error":"market not found"}}},
|
||||
{"endpoint":"neg-risk","mode":"query","case":"malformed","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk?token_id=not-an-asset","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"error":"market not found"}}},
|
||||
{"endpoint":"neg-risk","mode":"query","case":"blank","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk?token_id=","payload":null,"status":400,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"error":"Invalid token id"}}},
|
||||
{"endpoint":"neg-risk","mode":"json_path","case":"live","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk/35090254409399344650860070211816464534198960801264823587796928404808383727584","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"neg_risk":true}}},
|
||||
{"endpoint":"neg-risk","mode":"json_path","case":"resolved_v1","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk/73979342585906843441145134109923710004884703083095161594360108477170435492453","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"neg_risk":false}}},
|
||||
{"endpoint":"neg-risk","mode":"json_path","case":"resolved_v2","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk/759916398134244316868652908232832573045153963965173623897622651599218278400","payload":null,"status":200,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"neg_risk":false}}},
|
||||
{"endpoint":"neg-risk","mode":"json_path","case":"unknown","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk/123","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"error":"market not found"}}},
|
||||
{"endpoint":"neg-risk","mode":"json_path","case":"malformed","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk/not-an-asset","payload":null,"status":404,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"error":"market not found"}}},
|
||||
{"endpoint":"fee-rate","mode":"no_query","case":"missing","response":{"method":"GET","url":"https://clob.polymarket.com/fee-rate","payload":null,"status":400,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"error":"Invalid token id"}}},
|
||||
{"endpoint":"tick-size","mode":"no_query","case":"missing","response":{"method":"GET","url":"https://clob.polymarket.com/tick-size","payload":null,"status":400,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"error":"Invalid token id"}}},
|
||||
{"endpoint":"neg-risk","mode":"no_query","case":"missing","response":{"method":"GET","url":"https://clob.polymarket.com/neg-risk","payload":null,"status":400,"date":"Fri, 04 Dec 2026 20:37:34 GMT","body":{"error":"Invalid token id"}}}
|
||||
]
|
||||
@@ -468,4 +468,6 @@ SDK 使用 `GET /neg-risk?token_id=…`,也可以从已缓存的 CLOB 市场
|
||||
`open_orders` 的列表和精确查询均返回 `created_at`(Unix 秒)、`order_type` 和本地扩展 `post_only`。升级已有数据库时,用已受理的命令回执和 GTD 截止记录恢复提交指令;没有原始时钟记录的受理时间为 null。缺少原始回执的历史行仍可查询,未知字段保留为 null。官方当前将累计成交和逐笔对账分别放在订单的 size_matched 和账户成交记录;其单笔订单 HTTP 接口需要账户认证。本地验证使用可信操作员的 JSONL 接口,订单号与账户是模拟环境的标识。生产私有接口尚未实测。[官方订单查询](https://docs.polymarket.com/trading/manage-orders)
|
||||
|
||||
|
||||
连接器通过只读 /v2/tokens 核对迁移市场。实测原市场条件返回 CTF 与 V2 各一对,结构条件只返回 V2。一个三题互斥组返回十二项。结果按市场条件、结构条件和协议分组,并保留原始结果与互补标识。外场目录映射尚未写入本地账本。[连接器取样](../crates/venue-probe/fixtures/live-token-families.json)
|
||||
### 已裁决资产的交易参数
|
||||
|
||||
生产样本中,活跃资产和两个已裁决资产都可通过路径或查询参数读取 tick-size、fee-rate 和 neg-risk。已裁决样本的基础费字段为 1000,步长为 0.001,这些值来自样本的市场配置。缺少 ID 或传空值时返回 400,非空但无法识别的 ID 返回 404,基础费接口使用自己的错误文案。本地路径接受百分号编码的结果标识。[生产响应](examples/public-token-settings.json) · [官方报价步长接口](https://docs.polymarket.com/api-reference/market-data/get-tick-size) · [官方基础费接口](https://docs.polymarket.com/api-reference/market-data/get-fee-rate)
|
||||
|
||||
Reference in New Issue
Block a user