Expose event and market directory details with consistent outcome prices
This commit is contained in:
@@ -242,3 +242,28 @@ sequenceDiagram
|
||||
```
|
||||
|
||||
event_id 取自本地 events 或 catalog 查询,market_id 取自 assets 查询。两个参数均可重复,同类 ID 取并集,同时指定事件与市场时取交集。独立市场的公告也能通过 market_id 查询。默认按公告 ID 降序,每页 20 条;支持 order=id、ascending、offset 和 0 到 100 的 limit。当前查询对其他筛选参数返回 400。
|
||||
|
||||
### 从事件页进入订单簿
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
H["market_http.rs"] --> G["exchange/gamma_directory.rs"]
|
||||
H --> B["exchange/book_snapshot.rs"]
|
||||
```
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant C as 客户端
|
||||
participant H as market-http
|
||||
participant E as Exchange
|
||||
C->>H: GET /events/slug/nvda-closing-price-2027
|
||||
H->>E: gamma_event
|
||||
E-->>C: markets 数组,每项含该门槛的目录 ID
|
||||
C->>H: GET /markets/{id}
|
||||
H->>E: gamma_market
|
||||
E-->>C: outcomes 与 clobTokenIds,均为 JSON 数组编码的字符串
|
||||
C->>H: GET /book?token_id=选中的资产
|
||||
H-->>C: 该结果的买卖盘
|
||||
```
|
||||
|
||||
加载 [主题事件样例](../../docs/examples/topic.jsonl) 后即可按上图读取。事件与市场均支持按数字 ID 和按 slug 查询,缺失资源返回 404。路径段按 UTF-8 百分号编码,路径中的加号表示加号。当前详情入口支持无查询参数的 GET。
|
||||
|
||||
@@ -251,6 +251,46 @@ fn market_lookup(engine: &Mutex<Exchange>, prefix: &str, raw: &str) -> Reply {
|
||||
.ok_or((if is_token { 404 } else { 400 }, "market not found"))
|
||||
}
|
||||
|
||||
fn directory_route(path: &str) -> Option<(&str, bool, &str)> {
|
||||
let (resource, tail) = path.strip_prefix('/')?.split_once('/')?;
|
||||
if !matches!(resource, "markets" | "events") {
|
||||
return None;
|
||||
}
|
||||
let (by_slug, raw) = match tail.strip_prefix("slug/") {
|
||||
Some(slug) => (true, slug),
|
||||
None => (false, tail),
|
||||
};
|
||||
(!raw.is_empty() && !raw.contains('/')).then_some((resource, by_slug, raw))
|
||||
}
|
||||
|
||||
fn directory_lookup(engine: &Mutex<Exchange>, route: (&str, bool, &str), params: &str) -> Reply {
|
||||
let (resource, by_slug, raw) = route;
|
||||
if !params.is_empty() {
|
||||
return Err((400, "Unsupported directory query"));
|
||||
}
|
||||
let value = percent_decode_str(raw)
|
||||
.decode_utf8()
|
||||
.map_err(|_| (400, "Invalid directory key"))?;
|
||||
let key = if by_slug {
|
||||
exchange::DirectoryKey::Slug(&value)
|
||||
} else {
|
||||
let id = value
|
||||
.parse::<i64>()
|
||||
.ok()
|
||||
.filter(|id| *id > 0 && value.bytes().all(|b| b.is_ascii_digit()))
|
||||
.ok_or((400, "Invalid directory id"))?;
|
||||
exchange::DirectoryKey::Id(id)
|
||||
};
|
||||
let exchange = engine.lock().map_err(|_| (500, "Directory unavailable"))?;
|
||||
let found = match resource {
|
||||
"markets" => exchange.gamma_market(key),
|
||||
_ => exchange.gamma_event(key),
|
||||
};
|
||||
found
|
||||
.map_err(|_| (500, "Directory unavailable"))?
|
||||
.ok_or((404, "Not found"))
|
||||
}
|
||||
|
||||
fn clarifications(engine: &Mutex<Exchange>, query: &str) -> Reply {
|
||||
let invalid = (400, "Invalid clarification query");
|
||||
let fields: Vec<(String, String)> = serde_urlencoded::from_str(query).map_err(|_| invalid)?;
|
||||
@@ -425,7 +465,14 @@ fn respond(mut req: Request, engine: &Mutex<Exchange>) -> std::io::Result<()> {
|
||||
allow = Some("POST");
|
||||
Err((405, "Method not allowed"))
|
||||
}
|
||||
_ => Err((404, "Not found")),
|
||||
_ => match directory_route(path) {
|
||||
Some(route) if req.method() == &Method::Get => directory_lookup(engine, route, params),
|
||||
Some(_) => {
|
||||
allow = Some("GET");
|
||||
Err((405, "Method not allowed"))
|
||||
}
|
||||
None => Err((404, "Not found")),
|
||||
},
|
||||
};
|
||||
let (status, body) = match reply {
|
||||
Ok(v) => (200, v),
|
||||
@@ -550,7 +597,56 @@ mod tests {
|
||||
let note_query = format!(
|
||||
"/market-clarifications?market_id=9999&market_id={note_id}&order=id&ascending=true"
|
||||
);
|
||||
for command in include_str!("../../../docs/examples/topic.jsonl")
|
||||
.lines()
|
||||
.take(3)
|
||||
{
|
||||
db.execute(serde_json::from_str(command).unwrap()).unwrap();
|
||||
}
|
||||
let topic = db
|
||||
.gamma_event(exchange::DirectoryKey::Slug("nvda-closing-price-2027"))
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let event_path = format!("/events/{}", topic["id"].as_str().unwrap());
|
||||
let first_child = &topic["markets"][0];
|
||||
assert_eq!(first_child["conditionId"], "nvda-200");
|
||||
assert_eq!(topic["markets"].as_array().unwrap().len(), 2);
|
||||
let info = db
|
||||
.gamma_market(exchange::DirectoryKey::Slug("nvda-200"))
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let market_path = format!("/markets/{}", info["id"].as_str().unwrap());
|
||||
assert_eq!(info["events"][0]["id"], topic["id"]);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<[String; 2]>(info["clobTokenIds"].as_str().unwrap()).unwrap()[0],
|
||||
"eb:YES:nvda-200"
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<[String; 2]>(info["outcomes"].as_str().unwrap()).unwrap()[1],
|
||||
"未超过"
|
||||
);
|
||||
let separate = db
|
||||
.gamma_market(exchange::DirectoryKey::Slug("map+2/1"))
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(separate["events"], json!([]));
|
||||
let quoted = db
|
||||
.gamma_market(exchange::DirectoryKey::Slug("s"))
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(quoted["bestBid"], json!(0.39));
|
||||
assert_eq!(quoted["bestAsk"], json!(0.41));
|
||||
assert_eq!(quoted["outcomePrices"], r#"["0.4","0.6"]"#);
|
||||
let cases = [
|
||||
("GET",event_path.as_str(),String::new(),200,Some(topic.clone())),
|
||||
("GET","/events/slug/nvda-closing-price-2027",String::new(),200,Some(topic)),
|
||||
("GET",market_path.as_str(),String::new(),200,Some(info.clone())),
|
||||
("GET","/markets/slug/nvda-200",String::new(),200,Some(info)),
|
||||
("GET","/markets/slug/map+2%2F1",String::new(),200,Some(separate)),
|
||||
("GET","/events/0",String::new(),400,None),
|
||||
("GET","/markets/slug/missing",String::new(),404,None),
|
||||
("GET","/events/999999",String::new(),404,None),
|
||||
("POST","/events/slug/test","{}".into(),405,None),
|
||||
("GET","/market-clarifications?event_id=1&event_id=2",String::new(),200,Some(json!([]))),
|
||||
("GET","/market-clarifications?event_id=0",String::new(),400,None),
|
||||
("GET",note_query.as_str(),String::new(),200,Some(note)),
|
||||
|
||||
@@ -1169,3 +1169,28 @@ sequenceDiagram
|
||||
O->>E: resolution
|
||||
E-->>O: 原始规则、历次公告、裁决阶段和已确定的兑付权重
|
||||
```
|
||||
|
||||
### 事件与盘口目录详情
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
E["lib.rs · Exchange"] --> G["gamma_directory.rs"]
|
||||
G --> S["gamma_market.sql"]
|
||||
G --> Q["quotes.rs · display_price"]
|
||||
G --> A["assets.rs · 结果资产 ID"]
|
||||
S --> D["事件、盘口、报价和成交表"]
|
||||
```
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant C as 客户端
|
||||
participant E as Exchange
|
||||
participant D as SQLite
|
||||
C->>E: gamma_event,指定目录 ID 或 slug
|
||||
E->>D: 开始读事务,读取事件及其可展示子盘
|
||||
D-->>E: 问题、规则、结果标签、价格和结算状态
|
||||
E-->>C: 事件及按目录顺序排列的 markets
|
||||
C->>E: gamma_market,指定其中一个市场 ID
|
||||
E->>D: 同一读快照中取市场详情及父事件摘要
|
||||
E-->>C: 结果资产、盘口状态、价格与 events
|
||||
```
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
use crate::{
|
||||
assets, inventory, lots,
|
||||
quotes::display_price,
|
||||
tick_size::{TickSize, PAR},
|
||||
Exchange, MarketDataError,
|
||||
};
|
||||
use rusqlite::{Connection, OptionalExtension, Row, ToSql};
|
||||
use serde_json::{json, Value};
|
||||
|
||||
/// Slugs and numeric IDs are independent namespaces, including numeric-looking slugs.
|
||||
pub enum DirectoryKey<'a> {
|
||||
Id(i64),
|
||||
Slug(&'a str),
|
||||
}
|
||||
|
||||
fn header(row: &Row<'_>) -> rusqlite::Result<(String, Value)> {
|
||||
let key = row.get("id")?;
|
||||
let event = json!({
|
||||
"id":row.get::<_,i64>("event_id")?.to_string(),"slug":row.get::<_,String>("slug")?,
|
||||
"title":row.get::<_,String>("title")?,"category":row.get::<_,String>("category")?
|
||||
});
|
||||
Ok((key, event))
|
||||
}
|
||||
|
||||
fn event_header(
|
||||
db: &Connection,
|
||||
column: &str,
|
||||
key: &dyn ToSql,
|
||||
) -> rusqlite::Result<Option<(String, Value)>> {
|
||||
let sql =
|
||||
format!("SELECT id,event_id,slug,title,category FROM numbered_events WHERE {column}=?1");
|
||||
db.prepare_cached(&sql)?.query_row([key], header).optional()
|
||||
}
|
||||
|
||||
fn market(row: &Row<'_>) -> rusqlite::Result<Value> {
|
||||
let key: String = row.get("market")?;
|
||||
let phase: String = row.get("phase")?;
|
||||
let accepts = matches!(phase.as_str(), "preopen" | "continuous");
|
||||
let size = row
|
||||
.get::<_, Option<i64>>("microshares")?
|
||||
.unwrap_or(lots::MICROS);
|
||||
let tick = row
|
||||
.get::<_, Option<i64>>("step_micros")?
|
||||
.map(TickSize)
|
||||
.unwrap_or(TickSize::WHOLE_CENT);
|
||||
let bid: Option<i64> = row.get("yes_bid")?;
|
||||
let ask: Option<i64> = row.get("yes_ask")?;
|
||||
let last: Option<i64> = row.get("yes_last")?;
|
||||
let no_last = row.get("no_last")?;
|
||||
let marks = match row.get::<_, Option<String>>("winner")?.as_deref() {
|
||||
Some("YES") => Some((inventory::UNIT, 0)),
|
||||
Some("NO") => Some((0, inventory::UNIT)),
|
||||
Some("VOID") => Some((inventory::UNIT / 2, inventory::UNIT / 2)),
|
||||
_ => display_price(bid, ask, last, &phase)
|
||||
.zip(display_price(
|
||||
ask.map(|p| PAR - p),
|
||||
bid.map(|p| PAR - p),
|
||||
no_last,
|
||||
&phase,
|
||||
))
|
||||
.map(|(yes, no)| (yes.0, no.0)),
|
||||
};
|
||||
let prices = marks.map(|(yes, no)| {
|
||||
json!([
|
||||
inventory::decimal(yes.into(), inventory::UNIT).to_string(),
|
||||
inventory::decimal(no.into(), inventory::UNIT).to_string()
|
||||
])
|
||||
.to_string()
|
||||
});
|
||||
let dollars = |p: i64| inventory::decimal(p.into(), PAR);
|
||||
Ok(json!({
|
||||
"id":row.get::<_,String>("id")?,"conditionId":key,"slug":row.get::<_,String>("slug")?,
|
||||
"question":row.get::<_,String>("question")?,"description":row.get::<_,String>("rules")?,
|
||||
"resolutionSource":row.get::<_,Option<String>>("source")?,
|
||||
"outcomes":json!([row.get::<_,String>("yes_label")?,row.get::<_,String>("no_label")?]).to_string(),
|
||||
"clobTokenIds":json!([assets::id(&key,"YES"),assets::id(&key,"NO")]).to_string(),
|
||||
"enableOrderBook":true,"acceptingOrders":accepts,"closed":!accepts,
|
||||
"orderPriceMinTickSize":tick.number(),"orderMinSize":inventory::decimal(size.into(),inventory::UNIT),
|
||||
"groupItemTitle":row.get::<_,Option<String>>("group_title")?,
|
||||
"bestBid":bid.map(dollars),"bestAsk":ask.map(dollars),"lastTradePrice":last.map(dollars),"outcomePrices":prices,
|
||||
"negRisk":row.get::<_,bool>("neg_risk")?,"feesEnabled":row.get::<_,bool>("fees_enabled")?
|
||||
}))
|
||||
}
|
||||
|
||||
impl Exchange {
|
||||
pub fn gamma_market(&self, key: DirectoryKey<'_>) -> Result<Option<Value>, MarketDataError> {
|
||||
let tx = self.db.unchecked_transaction()?;
|
||||
let (column, arg): (_, &dyn ToSql) = match &key {
|
||||
DirectoryKey::Id(id) => ("id", id),
|
||||
DirectoryKey::Slug(slug) => ("slug", slug),
|
||||
};
|
||||
let sql = format!(
|
||||
"{} AND w.market=(SELECT market FROM market_directory_ids WHERE {column}=?1)",
|
||||
include_str!("gamma_market.sql")
|
||||
);
|
||||
let record = tx
|
||||
.prepare_cached(&sql)?
|
||||
.query_row([arg], |r| {
|
||||
Ok((market(r)?, r.get::<_, Option<String>>("parent")?))
|
||||
})
|
||||
.optional()?;
|
||||
let Some((mut detail, parent)) = record else {
|
||||
return Ok(None);
|
||||
};
|
||||
let mut events = Vec::new();
|
||||
if let Some(parent) = parent {
|
||||
if let Some((_, event)) = event_header(&tx, "id", &parent)? {
|
||||
events.push(event);
|
||||
}
|
||||
}
|
||||
detail["events"] = Value::Array(events);
|
||||
tx.commit()?;
|
||||
Ok(Some(detail))
|
||||
}
|
||||
|
||||
pub fn gamma_event(&self, key: DirectoryKey<'_>) -> Result<Option<Value>, MarketDataError> {
|
||||
let tx = self.db.unchecked_transaction()?;
|
||||
let found = match key {
|
||||
DirectoryKey::Id(id) => event_header(&tx, "event_id", &id)?,
|
||||
DirectoryKey::Slug(slug) => event_header(&tx, "slug", &slug)?,
|
||||
};
|
||||
let Some((parent, mut detail)) = found else {
|
||||
return Ok(None);
|
||||
};
|
||||
let mut stmt = tx.prepare_cached(concat!(include_str!("gamma_market.sql"),
|
||||
" AND w.market IN (SELECT market FROM sports_markets WHERE event=?1 UNION ALL SELECT market FROM topic_markets WHERE event=?1)
|
||||
ORDER BY COALESCE(t.group_order,0),w.market"))?;
|
||||
let markets = stmt
|
||||
.query_map([parent], market)?
|
||||
.collect::<rusqlite::Result<Vec<_>>>()?;
|
||||
drop(stmt);
|
||||
detail["markets"] = Value::Array(markets);
|
||||
tx.commit()?;
|
||||
Ok(Some(detail))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
SELECT w.market, w.id, w.slug, w.question, w.yes_label, w.no_label, m.rules, m.phase, m.winner, quotes.yes_bid, quotes.yes_ask,
|
||||
yes_trade.price AS yes_last, no_trade.price AS no_last,
|
||||
COALESCE(s.source,t.source) AS source, COALESCE(s.event,t.event) AS parent,
|
||||
COALESCE(a.name,t.group_title) AS group_title,
|
||||
tick.step_micros, minimum.microshares, member.market IS NOT NULL AS neg_risk,
|
||||
COALESCE(fee.rate_ppm,0)>0 AS fees_enabled
|
||||
FROM market_wire_metadata w
|
||||
JOIN markets m ON m.id=w.market
|
||||
LEFT JOIN sports_markets s ON s.market=w.market
|
||||
LEFT JOIN topic_markets t ON t.market=w.market
|
||||
LEFT JOIN augmented_outcomes a ON a.market=w.market
|
||||
LEFT JOIN market_tick_sizes tick ON tick.market=w.market
|
||||
LEFT JOIN market_minimum_sizes minimum ON minimum.market=w.market
|
||||
LEFT JOIN neg_risk_members member ON member.market=w.market
|
||||
LEFT JOIN market_fee_rates fee ON fee.market=w.market
|
||||
LEFT JOIN quote_events quotes ON quotes.seq=(SELECT MAX(seq) FROM quote_events WHERE market=w.market)
|
||||
LEFT JOIN last_asset_trades yes_trade ON yes_trade.market=w.market AND yes_trade.outcome='YES'
|
||||
LEFT JOIN last_asset_trades no_trade ON no_trade.market=w.market AND no_trade.outcome='NO'
|
||||
WHERE COALESCE(a.role,'')<>'placeholder'
|
||||
@@ -8,6 +8,7 @@ mod depth_feed;
|
||||
mod estimate;
|
||||
mod expiry;
|
||||
mod fees;
|
||||
mod gamma_directory;
|
||||
mod heartbeat;
|
||||
mod holders;
|
||||
mod twap;
|
||||
@@ -48,6 +49,7 @@ use std::{path::Path, time::Duration};
|
||||
|
||||
pub use assets::parse_id as parse_asset_id;
|
||||
pub use depth_feed::MarketPage;
|
||||
pub use gamma_directory::DirectoryKey;
|
||||
pub use prices_history::http::HistoryQuery;
|
||||
pub use prices_history::legacy::ClobHistoryQuery;
|
||||
pub use quotes::{PriceQueryError, PriceRequest, PriceSide};
|
||||
|
||||
@@ -57,17 +57,7 @@ impl Quote {
|
||||
}
|
||||
|
||||
pub fn mark(&self, phase: &str) -> Option<(i64, &'static str)> {
|
||||
if phase == "continuous" {
|
||||
if let (Some(b), Some(a)) = (self.bid, self.ask) {
|
||||
if (0..=1000).contains(&(a - b)) {
|
||||
return Some(((a + b) * 50, "midpoint"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if matches!(phase, "continuous" | "closed") {
|
||||
return self.last.map(|p| (p * 100, "last_trade"));
|
||||
}
|
||||
None
|
||||
display_price(self.bid, self.ask, self.last, phase)
|
||||
}
|
||||
|
||||
fn spread_micros(&self) -> Option<i64> {
|
||||
@@ -85,6 +75,25 @@ impl Quote {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn display_price(
|
||||
bid: Option<i64>,
|
||||
ask: Option<i64>,
|
||||
last: Option<i64>,
|
||||
phase: &str,
|
||||
) -> Option<(i64, &'static str)> {
|
||||
if phase == "continuous" {
|
||||
if let (Some(b), Some(a)) = (bid, ask) {
|
||||
if (0..=1000).contains(&(a - b)) {
|
||||
return Some(((a + b) * 50, "midpoint"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if matches!(phase, "continuous" | "closed") {
|
||||
return last.map(|p| (p * 100, "last_trade"));
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub(crate) struct Filter {
|
||||
|
||||
@@ -3304,3 +3304,34 @@ fn event_clarifications_span_sibling_markets_across_restart() {
|
||||
assert_eq!(all.len(), 4);
|
||||
assert_eq!(all[2]["content"], "solo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gamma_directory_reads_numeric_slugs_separately_and_keeps_settled_markets() {
|
||||
use exchange::DirectoryKey;
|
||||
let dir = tempdir().unwrap();
|
||||
let path = dir.path().join("gamma.sqlite");
|
||||
let mut db = Exchange::open(&path).unwrap();
|
||||
db.execute(json!({"op":"list","id":"first","market":"one","slug":"2","rules":"First."}))
|
||||
.unwrap();
|
||||
db.execute(json!({"op":"list","id":"second","market":"two","slug":"1","rules":"Second."}))
|
||||
.unwrap();
|
||||
let first = db.gamma_market(DirectoryKey::Id(1)).unwrap().unwrap();
|
||||
assert_eq!(first["conditionId"], "one");
|
||||
assert_eq!(first["slug"], "2");
|
||||
assert_eq!(first["outcomePrices"], Value::Null);
|
||||
assert_eq!(
|
||||
db.gamma_market(DirectoryKey::Slug("1")).unwrap().unwrap()["conditionId"],
|
||||
"two"
|
||||
);
|
||||
db.execute(json!({"op":"close","id":"seal","market":"one"}))
|
||||
.unwrap();
|
||||
db.execute(json!({"op":"finalize","id":"void","market":"one","winner":"VOID"}))
|
||||
.unwrap();
|
||||
drop(db);
|
||||
let db = Exchange::open(&path).unwrap();
|
||||
let final_state = db.gamma_market(DirectoryKey::Slug("2")).unwrap().unwrap();
|
||||
assert_eq!(final_state["id"], first["id"]);
|
||||
assert_eq!(final_state["closed"], true);
|
||||
assert_eq!(final_state["acceptingOrders"], false);
|
||||
assert_eq!(final_state["outcomePrices"], r#"["0.5","0.5"]"#);
|
||||
}
|
||||
|
||||
@@ -388,3 +388,9 @@ Polymarket 的单资产最近成交接口规定,无成交时返回价格字符
|
||||
|
||||
|
||||
例如,使用 [足球样例](examples/football.jsonl) 上架的全场 2:1 和半场 1:0 是同一场比赛的两个独立市场。各发一条公告后,用 `op: catalog` 按 `cup-a-b` 取得 `event.event_id`。查询 `GET /market-clarifications?event_id=<该编号>&ascending=true` 可以同时读到两条。再传半场盘的 `market_id` 就只返回半场盘的公告。`event_id` 和 `market_id` 使用本库各自独立的数字编号。重启保留编号,旧库按原有事件键排序补号。跨筛选条件取交集的行为已用本地样例验证,尚待同一批生产公告逐项对照。[官方筛选参数](https://docs.polymarket.com/api-reference/markets/list-market-clarifications)
|
||||
|
||||
### Gamma 事件与盘口详情
|
||||
|
||||
公开目录中,市场 559651 和事件 30828 使用同一 slug。市场的 outcomes 和 clobTokenIds 在外层 JSON 中都是字符串,各自解码一次得到两个按位置对应的值。生产目录的市场对象带 events 数组。官方事件详情把各子盘放在 markets 数组。此次生产列表读取成功,两个 slug 详情端点的线上回执尚未取得。[生产目录样例](https://gamma-api.polymarket.com/markets?limit=1) · [官方事件详情](https://docs.polymarket.com/api-reference/events/get-event-by-slug) · [官方市场详情](https://docs.polymarket.com/api-reference/markets/get-market-by-slug)
|
||||
|
||||
本地支持 `/events/{id}`、`/events/slug/{slug}`、`/markets/{id}` 和 `/markets/slug/{slug}`。每次读取在同一 SQLite 快照组装目录、规则、当前价格和父子关系。主题盘口沿用运营方指定的顺序,未命名的预留选项在命名后才对外显示。独立盘口的 events 为空。conditionId、目录 ID 和两侧资产 ID 来自本地上架记录。目录标记 acceptingOrders 涵盖可接收限价单的盘前和连续交易阶段。无可用价格时返回 null。已裁决盘的 outcomePrices 使用兑付比例,作废盘为 0.5 和 0.5。标签展开、图像、链上标识和完整生产字段覆盖仍待对照。
|
||||
|
||||
Reference in New Issue
Block a user