Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
搜索市場和事件
GET https://gamma-api.polymarket.com/search
q
type
limit
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()
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} 個結果`);