法律合規提醒:在使用 Polymarket 服務或 API 前,請確認您所在地區的法律規定。Polymarket 目前不支援比利時、法國、新加坡、泰國、中國大陸等地區,政策可能隨時變化。
事件端點返回事件信息,一個事件可以包含多個相關市場。
GET https://gamma-api.polymarket.com/events
GET https://gamma-api.polymarket.com/events/{slug}
請求參數
| 參數 | 類型 | 描述 |
|---|
limit | number | 返回數量(默認:20) |
offset | number | 偏移量(默認:0) |
closed | boolean | 是否包含已關閉事件 |
tag | string | 按標籤過濾 |
請求示例
獲取所有事件
import requests
response = requests.get(
'https://gamma-api.polymarket.com/events',
params={
'limit': 10,
'offset': 0,
'closed': False
}
)
events = response.json()
for event in events:
print(f"事件: {event['title']}")
print(f"市場數: {len(event['markets'])}")
獲取特定事件
slug = "2024-us-presidential-election"
response = requests.get(
f'https://gamma-api.polymarket.com/events/{slug}'
)
event = response.json()
響應示例
{
"id": "12345",
"slug": "2024-us-presidential-election",
"title": "2024 年美國總統大選",
"description": "2024 年美國總統大選相關市場",
"start_date": "2024-11-05T00:00:00Z",
"end_date": "2024-11-06T00:00:00Z",
"image_url": "https://...",
"markets": [
{
"id": "...",
"question": "誰將贏得 2024 年美國總統大選?",
"active": true
}
],
"tags": ["politics", "elections"],
"created_at": "2023-01-01T00:00:00Z"
}
事件欄位
| 欄位 | 類型 | 描述 |
|---|
id | string | 事件唯一 ID |
slug | string | URL 友好的標識符 |
title | string | 事件標題 |
description | string | 事件描述 |
markets | array | 相關市場列表 |
tags | array | 事件標籤 |
start_date | string | 開始時間 |
end_date | string | 結束時間 |