Documentation Index
Fetch the complete documentation index at: https://polymarketcn.com/llms.txt
Use this file to discover all available pages before exploring further.
法律合規提醒:在使用 Polymarket 服務或 API 前,請確認您所在地區的法律規定。Polymarket 目前不支援比利時、法國、新加坡、泰國、中國大陸等地區,政策可能隨時變化。
搜索端點允許搜索市場、事件和用戶。
GET https://gamma-api.polymarket.com/search
請求參數
| 參數 | 類型 | 描述 |
|---|
q | string | 搜索關鍵詞 |
type | string | 搜索類型(markets, events, users) |
limit | number | 返回數量 |
請求示例
搜索市場
import requests
query = "Trump"
response = requests.get(
'https://gamma-api.polymarket.com/search',
params={
'q': query,
'type': 'markets',
'limit': 10
}
)
results = response.json()
for market in results['markets']:
print(f"市場: {market['question']}")
print(f"相關度: {market['score']}")
搜索事件
response = requests.get(
'https://gamma-api.polymarket.com/search',
params={
'q': 'election',
'type': 'events'
}
)
響應示例
{
"markets": [
{
"id": "123",
"question": "川普會贏得 2024 年大選嗎?",
"score": 0.95,
"volume": "1000000.00"
}
],
"events": [
{
"id": "456",
"title": "2024 年美國總統大選",
"score": 0.90
}
],
"total_count": 15
}
高級搜索
模糊搜索
# 搜索包含關鍵詞的市場
results = requests.get(
'https://gamma-api.polymarket.com/search',
params={
'q': 'bitcoin price',
'type': 'markets'
}
).json()
按相關度排序
搜索結果默認按相關度(score)排序,score 越高越相關。
TypeScript 示例
interface SearchResult {
markets: Market[];
events: Event[];
total_count: number;
}
async function searchMarkets(query: string): Promise<SearchResult> {
const response = await fetch(
`https://gamma-api.polymarket.com/search?q=${encodeURIComponent(query)}&type=markets`
);
return await response.json();
}
// 使用
const results = await searchMarkets('election 2024');
console.log(`找到 ${results.total_count} 個結果`);