trading-polymarket
Execute trades on Polymarket using py_clob_client - full API access for market data, orders, positions
What this skill does
# Polymarket Trading - Complete API Reference
Full access to Polymarket's CLOB (Central Limit Order Book) via the official `py_clob_client` library.
**60+ methods documented. This is the complete reference.**
## Required Environment Variables
```bash
PRIVATE_KEY=0x... # Ethereum private key for signing
POLY_FUNDER_ADDRESS=0x... # Your wallet address on Polygon
POLY_API_KEY=... # From Polymarket API
POLY_API_SECRET=... # Base64 encoded secret
POLY_API_PASSPHRASE=... # API passphrase
```
## Installation
```bash
pip install py-clob-client requests
```
---
## Authentication Levels
| Level | Requirements | Capabilities |
|-------|--------------|--------------|
| **L0** | None | Read-only: orderbooks, prices, markets |
| **L1** | Private key | Create & sign orders (not post) |
| **L2** | Private key + API creds | Full trading: post orders, cancel, query |
### Signature Types
| Type | Use Case |
|------|----------|
| `0` | Standard EOA (MetaMask, hardware wallets) |
| `1` | Magic/email wallets (delegated signing) |
| `2` | Proxy wallets (Gnosis Safe, browser proxy) |
---
## ClobClient - Complete API (60+ Methods)
### Initialization
```python
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import (
OrderArgs, MarketOrderArgs, ApiCreds, OrderType,
BookParams, TradeParams, OpenOrderParams, BalanceAllowanceParams,
AssetType, OrderScoringParams, OrdersScoringParams, DropNotificationParams
)
from py_clob_client.order_builder.constants import BUY, SELL
from py_clob_client.constants import POLYGON # 137
# Level 2 Auth (full trading access)
client = ClobClient(
host="https://clob.polymarket.com",
key=os.getenv("PRIVATE_KEY"), # Private key for signing
chain_id=POLYGON, # 137 for mainnet, 80002 for Amoy testnet
funder=os.getenv("POLY_FUNDER_ADDRESS"), # Wallet address (for proxy wallets)
signature_type=2 # 0=EOA, 1=MagicLink, 2=Proxy
)
# Set API credentials for authenticated endpoints
client.set_api_creds(ApiCreds(
api_key=os.getenv("POLY_API_KEY"),
api_secret=os.getenv("POLY_API_SECRET"),
api_passphrase=os.getenv("POLY_API_PASSPHRASE")
))
```
### Health & Configuration
```python
client.get_ok() # Check if server is up
client.get_server_time() # Get server timestamp
client.get_address() # Your signer's public address
client.get_collateral_address() # USDC contract address
client.get_conditional_address() # CTF contract address
client.get_exchange_address() # Exchange contract (neg_risk=False default)
```
### Market Data - Single Token
```python
# Get prices and spreads
client.get_midpoint(token_id) # Mid market price
client.get_price(token_id, side="BUY") # Best price for side
client.get_spread(token_id) # Current spread
client.get_last_trade_price(token_id) # Last executed trade price
# Get full orderbook
orderbook = client.get_order_book(token_id)
# Returns: OrderBookSummary with bids, asks, tick_size, neg_risk, timestamp, hash
```
### Market Data - Batch (Multiple Tokens)
```python
params = [
BookParams(token_id="TOKEN1", side="BUY"),
BookParams(token_id="TOKEN2", side="SELL")
]
client.get_midpoints(params) # Multiple midpoints
client.get_prices(params) # Multiple prices
client.get_spreads(params) # Multiple spreads
client.get_order_books(params) # Multiple orderbooks
client.get_last_trades_prices(params) # Multiple last prices
```
### Market Metadata
```python
client.get_tick_size(token_id) # Returns: "0.1", "0.01", "0.001", or "0.0001"
client.get_neg_risk(token_id) # Returns: True/False (negative risk market)
client.get_fee_rate_bps(token_id) # Returns: fee rate in basis points (0 or 1000)
```
---
## Order Types
```python
from py_clob_client.clob_types import OrderType
OrderType.GTC # Good Till Cancelled - stays open until filled/cancelled
OrderType.FOK # Fill Or Kill - fill entirely immediately or cancel
OrderType.GTD # Good Till Date - expires at timestamp (min 60 seconds)
OrderType.FAK # Fill And Kill - fill what's possible, cancel rest
```
### When to Use Each Order Type
| Type | Use Case | Example |
|------|----------|---------|
| **GTC** | Entries - wait for fill | Place buy at 0.45, wait for dip |
| **FOK** | Exits - need immediate fill | Market sell entire position NOW |
| **GTD** | Time-limited orders | Offer expires in 5 minutes |
| **FAK** | Partial fills OK | Get as much as possible now |
### OrderArgs - Limit Orders
```python
OrderArgs(
token_id: str, # Token ID (outcome to trade)
price: float, # Price 0.01-0.99
size: float, # Number of shares
side: str, # "BUY" or "SELL" (or use BUY/SELL constants)
fee_rate_bps: int = 0, # Optional: fee rate in bps (0 or check market)
nonce: int = 0, # Optional: unique nonce for cancellation
expiration: int = 0, # Optional: expiry timestamp (0 = GTC, use timestamp for GTD)
taker: str = ZERO_ADDRESS # Optional: specific taker (ZERO_ADDRESS = anyone)
)
```
### MarketOrderArgs - Market Orders
```python
MarketOrderArgs(
token_id: str, # Token ID
amount: float, # Total USDC amount to spend (BUY) or shares (SELL)
side: str, # "BUY" or "SELL"
price: float = 0, # Optional: worst acceptable price (slippage protection)
fee_rate_bps: int = 0, # Optional: fee rate
nonce: int = 0, # Optional: nonce
taker: str = ZERO_ADDRESS, # Optional: taker address
order_type: OrderType = FOK # Optional: FOK (default) or FAK
)
```
### Complete Order Examples
```python
from py_clob_client.order_builder.constants import BUY, SELL
# 1. LIMIT BUY (GTC) - sits on book until filled
order = client.create_and_post_order(
OrderArgs(token_id=TOKEN_ID, price=0.45, size=100.0, side=BUY)
)
# 2. LIMIT SELL (GTC)
order = client.create_and_post_order(
OrderArgs(token_id=TOKEN_ID, price=0.55, size=50.0, side=SELL)
)
# 3. MARKET BUY - spend $100 USDC at current prices (FOK)
signed = client.create_market_order(
MarketOrderArgs(token_id=TOKEN_ID, amount=100.0, side=BUY)
)
result = client.post_order(signed, orderType=OrderType.FOK)
# 4. MARKET SELL - sell all shares immediately (FOK)
signed = client.create_market_order(
MarketOrderArgs(token_id=TOKEN_ID, amount=my_shares, side=SELL)
)
result = client.post_order(signed, orderType=OrderType.FOK)
# 5. POST-ONLY MAKER ORDER (avoid taker fees, earn rebates)
signed = client.create_order(
OrderArgs(token_id=TOKEN_ID, price=0.44, size=100.0, side=BUY)
)
result = client.post_order(signed, orderType=OrderType.GTC, post_only=True)
# If order would cross spread, it gets REJECTED instead of taking
# 6. GOOD TIL DATE (GTD) - expires after timestamp
import time
expiry = int(time.time()) + 300 # 5 minutes from now
signed = client.create_order(
OrderArgs(token_id=TOKEN_ID, price=0.50, size=100.0, side=BUY, expiration=expiry)
)
result = client.post_order(signed, orderType=OrderType.GTD)
# 7. FILL AND KILL (FAK) - fill what you can, cancel rest
signed = client.create_market_order(
MarketOrderArgs(token_id=TOKEN_ID, amount=1000.0, side=BUY)
)
result = client.post_order(signed, orderType=OrderType.FAK)
```
---
## Order Operations
### Create and Post Orders
```python
# SIMPLE: Create and post in one call (recommended)
result = client.create_and_post_order(
OrderArgs(
token_id="123456789012345678901234567890",
price=0.45,
size=10.0,
side="BUY"
)
)
# Returns: {"orderID": "...", "status": "...", ...}
# ADVANCED: Separate create and post
order = client.create_order(OrderArgs(...)) # Returns SignedOrder
result = client.post_order(order, orderType=OrderType.GTC, post_only=False)
# Market order (calculates price automatRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.