Install
openclaw skills install polymarket-sdkInteract with Polymarket US prediction markets. Use when the user wants to: browse/search prediction markets, check market prices and odds, view portfolio positions and balances, place or cancel trades, check order status, look up events or sports markets, or get market settlement info. Requires the polymarket-us Python package and optionally API keys for trading.
openclaw skills install polymarket-sdkTrade and browse prediction markets via the Polymarket US API using the Python SDK.
Ensure the SDK is installed:
pip install polymarket-us
API keys are needed only for trading/portfolio endpoints. Generate at https://polymarket.us/developer
Store credentials as environment variables:
POLYMARKET_KEY_ID — API key UUIDPOLYMARKET_SECRET_KEY — Ed25519 private key (base64)Write and execute Python scripts using the polymarket_us SDK. For full API details, read references/api_reference.md.
from polymarket_us import PolymarketUS
client = PolymarketUS()
# Search markets
results = client.search.query({"query": "bitcoin", "limit": 5})
# Browse trending markets
markets = client.markets.list({"limit": 10, "orderBy": ["volumeNum"], "orderDirection": "desc"})
# Check price
bbo = client.markets.bbo("market-slug")
client.close()
import os
from polymarket_us import PolymarketUS
client = PolymarketUS(
key_id=os.environ["POLYMARKET_KEY_ID"],
secret_key=os.environ["POLYMARKET_SECRET_KEY"],
)
# Check balance
balances = client.account.balances()
# View positions
positions = client.portfolio.positions()
# Preview then place order
preview = client.orders.preview({"request": {
"marketSlug": "some-market",
"intent": "ORDER_INTENT_BUY_LONG",
"type": "ORDER_TYPE_LIMIT",
"price": {"value": "0.55", "currency": "USD"},
"quantity": 100,
}})
# Place order (ALWAYS confirm with user before executing)
order = client.orders.create({
"marketSlug": "some-market",
"intent": "ORDER_INTENT_BUY_LONG",
"type": "ORDER_TYPE_LIMIT",
"price": {"value": "0.55", "currency": "USD"},
"quantity": 100,
"tif": "TIME_IN_FORCE_GOOD_TILL_CANCEL",
})
client.close()
AuthenticationError, BadRequestError, RateLimitError, etc.When presenting market data to the user: