> ## Documentation Index
> Fetch the complete documentation index at: https://dexbuilder.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 市場詳情

> 瞭解事件市場 Market 的結構、狀態、結果代幣與交易限制。

根據 Market ID 或 slug 查詢公開市場詳情時，兩種介面回傳相同的 MarketDetail 模型，包含多語言 `question` 和 Outcome、Unix 秒級市場時間及交易參數。兩種介面均無需認證。

生產環境 Base URL：

```text theme={null}
https://api.dexbuilder.com
```

## 查詢 Market

根據 Market ID：

```bash cURL theme={null}
curl "https://api.dexbuilder.com/api/v4/prediction/markets/<market_id>"
```

根據 slug：

```bash cURL theme={null}
curl "https://api.dexbuilder.com/api/v4/prediction/markets/slug/<market_slug>"
```

## Market 詳情回應

按 ID 和按 slug 查詢均回傳 MarketDetail。以下範例展示常用欄位；`outcomes[].token_id` 可直接用於對應 Token 的價格和訂單簿介面。

```json Example theme={null}
{
  "market_id": "ge_42_7",
  "event_id": "ge_42",
  "slug": "example-market",
  "question": { "en": "Will the outcome occur?" },
  "condition_id": "ge_condition",
  "status": "active",
  "closed": false,
  "accepting_orders": true,
  "enable_order_book": true,
  "start_date": 1782666000,
  "end_date": 1782752400,
  "outcomes": [
    { "outcome": { "en": "Yes" }, "token_id": "ge_yes" },
    { "outcome": { "en": "No" }, "token_id": "ge_no" }
  ]
}
```

| 欄位 | 說明 |
| - | - |
| `market_id`、`event_id` | Market 與所屬 Event 的 ID；後續請求應原樣使用 |
| `question` | 多語言市場問題物件 |
| `condition_id` | Condition ID |
| `outcomes` | 每項包含多語言 `outcome` 和 `token_id` |
| `status`、`closed` | 市場狀態 |
| `accepting_orders`、`enable_order_book` | 交易與訂單簿狀態；無值時可為 `null` |
| `min_order_size`、`tick_size`、`neg_risk` | 交易限制；無值時可為 `null` |
| `best_bid`、`best_ask`、`last_trade_price` | 盤口與最近成交摘要 |
| `start_date`、`end_date` | Unix 秒級時間戳；無值時為 `null` |

按 ID 查詢詳見[查詢市場](https://dexbuilder.mintlify.site/zh-TW/event-markets/rest/query-market.md)，按 slug 查詢詳見[按 Slug 查詢市場](https://dexbuilder.mintlify.site/zh-TW/event-markets/rest/query-market-by-slug.md)。

## 使用 Outcome Token

從 `outcomes[].token_id` 取得 Token ID 後，可以繼續呼叫價格、Ticker 和訂單簿介面：

```bash cURL theme={null}
TOKEN_ID="<token_id>"

curl "https://api.dexbuilder.com/api/v4/prediction/tokens/$TOKEN_ID/order_book?depth=20"
curl "https://api.dexbuilder.com/api/v4/prediction/tokens/$TOKEN_ID/price"
curl "https://api.dexbuilder.com/api/v4/prediction/tokens/$TOKEN_ID/ticker"
```

API 已直接在 `outcomes` 數組中回傳 Token ID，無需額外解析 JSON 字串形式的 Token 清單。

## 查詢所屬 Event

使用響應中的 `event_id` 查詢父級 Event：

```bash cURL theme={null}
curl "https://api.dexbuilder.com/api/v4/prediction/events/<event_id>"
```

Market 公開資料無需認證；下單、持倉、帳戶等私有介面需要認證。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.