Skills Plugins MCP Prompt Model 博客 我的中心
数据分析与咨询 #data #trading #api #ai

polymarket-api

Deep integration guide for Polymarket's CLOB API, Gamma API, and on-chain data. Use when building trading functionality, fetching market data, or implementing order execution.

DeepseekModel 官方收录技能 质量 良好 · 64 v1.0.0

获取

https://deepseekmodel.com/api/download.php?id=agentmc15-polymarket-trader-claude-skills-polymarket-api-skill-md&format=skill
下载 .skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用
.skill 文件中 system_prompt 字段的实际内容。
name polymarket-api description Deep integration guide for Polymarket's CLOB API, Gamma API, and on-chain data. Use when building trading functionality, fetching market data, or implementing order execution. Polymarket API Integration Skill Overview This skill provides comprehensive guidance for integrating with Polymarket's APIs and smart contracts. API Endpoints CLOB API (Central Limit Order Book) Base URL: https://clob.polymarket.com Authentication Levels Level 0 (Public) : Market data, orderbooks, prices Level 1 (Signer) : Create/derive API keys Level 2 (Authenticated) : Trading, orders, positions Key Endpoints GET /markets # List all markets GET /markets/{token_id} # Get specific market GET /price?token_id=X # Get current price GET /midpoint?token_id=X # Get midpoint price GET /book?token_id=X # Get orderbook GET /trades # Get user trades POST /order # Place order DELETE /order/{id} # Cancel order GET /positions # Get positions Gamma API (Market Metadata) Base URL: https://gamma-api.polymarket.com GET /events # List events GET /events/{slug} # Get event details GET /markets # List markets GET /markets/{id} # Get market details Python Implementation Patterns Initialize Client from py_clob_client.client import ClobClient from py_clob_client.clob_types import OrderArgs, OrderType import os class PolymarketService : def __init__ ( self ): self .client = ClobClient( host= "https://clob.polymarket.com" , key=os.getenv( "POLYMARKET_PRIVATE_KEY" ), chain_id= 137 , signature_type= 1 , funder=os.getenv( "POLYMARKET_FUNDER_ADDRESS" ) ) self .client.set_api_creds( self .client.create_or_derive_api_creds() ) async def get_market_data ( self, token_id: str ) -> dict : """Fetch comprehensive market data.""" return { "price" : self .client.get_price(token_id, "BUY" ), "midpoint" : self .client.get_midpoint(token_id), "book" : self .client.get_order_book(token_id), "spread" : self .client.get_spread(token_id), } async def place_order ( self, token_id: str , side: str , price: float , size: float , order_type: str = "GTC" ) -> dict : """Place a limit order.""" order = self .client.create_order( OrderArgs( token_id=token_id, price=price, size=size, side=side, ) ) return self .client.post_order(order, order_type) WebSocket Subscription import asyncio import websockets import json async def subscribe_market_updates ( token_ids: list [ str ] ): """Subscribe to real-time market updates.""" uri = "wss://ws-subscriptions-clob.polymarket.com/ws/market" async with websockets.connect(uri) as ws: await ws.send(json.dumps({ "type" : "subscribe" , "markets" : token_ids })) async for message in ws: data = json.loads(message) yield data Gamma API Client import httpx class GammaClient : BASE_URL = "https://gamma-api.polymarket.com" def __init__ ( self ): self .client = httpx.AsyncClient(base_url= self .BASE_URL) async def get_active_markets ( self ) -> list [ dict ]: """Fetch all active markets.""" response = await self .client.get( "/markets" , params={ "active" : True }) return response.json() async def get_event ( self, slug: str ) -> dict : """Fetch event with all markets.""" response = await self .client.get( f"/events/ {slug} " ) return response.json() Order Types GTC (Good Till Cancelled): Stays until filled or cancelled GTD (Good Till Date): Expires at specified time FOK (Fill or Kill): Must fill entirely or cancel IOC (Immediate or Cancel): Fill what's available, cancel rest Price Calculations def calculate_implied_probability ( price: float ) -> float : """Convert price to implied probability.""" return price # Prices ARE probabilities (0-1) def calculate_cost ( price: float , shares: float ) -> float : """Calculate cost to buy shares.""" return price * shares def calculate_pnl ( entry_price: float , current_price: float , shares: float , side: str ) -> float : """Calculate unrealized P&L.""" if side == "BUY" : return (current_price - entry_price) * shares return (entry_price - current_price) * shares Error Handling from py_clob_client.exceptions import PolymarketException try : result = client.post_order(order) except PolymarketException as e: if "INSUFFICIENT_BALANCE" in str (e): # Handle insufficient funds pass elif "INVALID_PRICE" in str (e): # Handle price out of range pass raise Rate Limits Public endpoints: ~100 requests/minute Authenticated endpoints: ~1000 requests/minute WebSocket: Varies by subscription type Always implement exponential backoff and request queuing. Key Contract Addresses (Polygon) CONTRACTS = { "CTF_EXCHANGE" : "0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E" , "NEG_RISK_CTF_EXCHANGE" : "0xC5d563A36AE78145C45a50134d48A1215220f80a" , "CONDITIONAL_TOKENS" : "0x4D97DCd97eC945f40cF65F87097ACe5EA0476045" , "USDC" : "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" , }
Agent 识别该技能的关键词,点击任意一个即可复制。

该技能未提供触发词。

下载的 .skill 包内含以下字段。
字段 说明
format格式标识(skill/v1)
skill_id技能唯一 ID
name技能名称
version版本号
description技能描述
category所属分类(数组)
trigger_words触发词列表
tags标签列表
source来源标识
source_url来源链接(本页地址)
exported_at导出时间(每次下载生成)
system_prompt系统提示词正文
model_config模型参数:provider / model / temperature / max_tokens / top_p
examples示例
install_guide各平台导入说明(Coze / Dify / Claude / 自定义框架)
同一份技能可按不同平台格式导出。
.skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用 下载
.skillpro 增强格式,额外含脚本 / 工具 / 依赖 / 钩子占位 下载
.json 纯 JSON 导出,只含 system_prompt 与模型参数 下载
Coze 带 frontmatter 的 Markdown,Coze 平台导入用 下载
Dify Dify DSL,创建应用后直接导入 下载

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

验证码 --

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。