> ## 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 後，可以使用 Market Detail 介面讀取完整屬性。該介面屬於公開市場資料，不需要認證。

生產環境 Base URL：

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

## 查詢 Market

根據 Market ID：

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

根據 slug：

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

## 響應示例

```json Example theme={null}
{
  "market_id": "market-123",
  "event_id": "event-123",
  "slug": "example-market",
  "question": { "en": "Will the outcome occur?" },
  "condition_id": "0xabc...",
  "status": "active",
  "closed": false,
  "accepting_orders": true,
  "enable_order_book": true,
  "outcomes": [
    { "token_id": "token-yes", "outcome": { "en": "Yes", "cn": "是", "tw": "是" } },
    { "token_id": "token-no", "outcome": { "en": "No", "cn": "否", "tw": "否" } }
  ],
  "best_bid": "0.48",
  "best_ask": "0.52",
  "last_trade_price": "0.50",
  "min_order_size": "5",
  "tick_size": "0.01",
  "neg_risk": false,
  "volume": "12500.50",
  "volume_24hr": "850.25",
  "resolution_source": "https://example.com/source"
}
```

## 欄位說明

| 欄位 | 說明 |
| - | - |
| `market_id` | Market 唯一標識 |
| `event_id` | 所屬 Event ID |
| `slug` | Market slug |
| `question` | 多語言問題對象 |
| `condition_id` | 結算 Condition ID |
| `outcomes` | Outcome 數組，每個元素包含 `token_id` 與 `outcome` |
| `status` | Market 目前狀態 |
| `closed` | Market 是否關閉 |
| `accepting_orders` | 目前是否接受訂單 |
| `enable_order_book` | 是否啓用訂單簿 |
| `best_bid`, `best_ask` | 目前最佳買價與賣價 |
| `last_trade_price` | 最近成交價 |
| `min_order_size` | 最小下單數量 |
| `tick_size` | 最小價格變動單位 |
| `neg_risk` | 是否使用 Negative Risk 結算機制 |
| `start_date`, `end_date` | Market 時間欄位，Unix 秒 |
| `resolved_at` | 已結算時的結算時間 |
| `winning_outcome`, `winning_token_id` | 獲勝結果與對應 Token ID |
| `tags` | Market 關聯 Tag |

## 使用 Outcome Token

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

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

curl "https://api.dexbuilder.com/api/v4/event_contracts/tokens/$TOKEN_ID/order_book?depth=20"
curl "https://api.dexbuilder.com/api/v4/event_contracts/tokens/$TOKEN_ID/price"
curl "https://api.dexbuilder.com/api/v4/event_contracts/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/event_contracts/events/<event_id>"
```

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


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