Skip to main content
還沒有帳號?點擊這裡註冊 Polymarket 並完成入金,才能用錢包私鑰為訂單籤名、實際成交。
法律合規提醒:在使用 Polymarket 服務或 API 前,請確認您所在地區的法律規定。Polymarket 目前不支援比利時、法國、新加坡、泰國、中國大陸等地區,政策可能隨時變化。
市場端點是 Gamma API 最重要的端點,返回市場的詳細信息。

端點

GET https://gamma-api.polymarket.com/markets
GET https://gamma-api.polymarket.com/markets/{condition_id}

請求參數

參數類型描述
limitnumber返回數量(默認:20,最大:100)
offsetnumber偏移量(默認:0)
closedboolean是否包含已關閉市場
activeboolean是否只返回活躍市場
tagstring按標籤過濾
orderstring排序方式(volume, liquidity, etc.)

請求示例

獲取活躍市場

import requests

response = requests.get(
    'https://gamma-api.polymarket.com/markets',
    params={
        'limit': 10,
        'active': True,
        'closed': False,
        'order': 'volume'
    }
)

markets = response.json()
for market in markets:
    print(f"問題: {market['question']}")
    print(f"交易量: ${market['volume']}")
    print(f"流動性: ${market['liquidity']}")
    print("---")

獲取特定市場

condition_id = "0x1234..."
response = requests.get(
    f'https://gamma-api.polymarket.com/markets/{condition_id}'
)
market = response.json()

響應示例

{
  "id": "12345",
  "condition_id": "0x1234...",
  "question": "川普會贏得 2024 年大選嗎?",
  "description": "詳細描述...",
  "tokens": [
    {
      "token_id": "0xabc...",
      "outcome": "Yes",
      "price": "0.55",
      "winner": null
    },
    {
      "token_id": "0xdef...",
      "outcome": "No",  
      "price": "0.45",
      "winner": null
    }
  ],
  "volume": "1234567.89",
  "liquidity": "234567.89",
  "active": true,
  "closed": false,
  "end_date": "2024-11-06T00:00:00Z",
  "tags": ["politics", "elections"],
  "created_at": "2023-01-01T00:00:00Z"
}

市場欄位

欄位類型描述
idstring市場 ID
condition_idstring條件 ID(鏈上)
questionstring市場問題
descriptionstring詳細描述
tokensarray結果代幣信息
volumestring總交易量(USDC)
liquiditystring流動性(USDC)
activeboolean是否活躍
closedboolean是否已關閉
end_datestring結束時間

高級過濾

# 獲取高交易量的政治市場
response = requests.get(
    'https://gamma-api.polymarket.com/markets',
    params={
        'tag': 'politics',
        'order': 'volume',
        'limit': 20,
        'active': True
    }
)

TypeScript 示例

interface Market {
  id: string;
  condition_id: string;
  question: string;
  volume: string;
  liquidity: string;
  active: boolean;
}

async function getMarkets(): Promise<Market[]> {
  const response = await fetch(
    'https://gamma-api.polymarket.com/markets?limit=10&active=true'
  );
  return await response.json();
}