Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Query Polymarket prediction market data and manage CLOB orders via the Grimoire CLI venue adapter.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: grimoire-polymarket3description: Queries Polymarket market data and CLOB state, and manages CLOB orders via the Grimoire venue CLI wrapper backed by the official Polymarket CLI.4---56# Grimoire Polymarket Skill78Use this skill for Polymarket market discovery, CLOB market data, and order-management operations through the `polymarket` venue adapter.910Preferred invocations:1112- `grimoire venue polymarket ...`13- `npx -y @grimoirelabs/cli venue polymarket ...` (no-install)14- `bun run packages/cli/src/index.ts venue polymarket ...` (repo-local)15- `grimoire-polymarket ...` (direct binary from `@grimoirelabs/venues`)1617Recommended preflight:1819- `grimoire venue doctor --adapter polymarket --json`20- `grimoire venue polymarket info --format json`2122## Commands2324Canonical agent commands:2526- `grimoire venue polymarket info [--format <auto|json|table>]`27- `grimoire venue polymarket search-markets [--query <text>] [--slug <slug|url>] [--question <text>] [--event <text>] [--tag <text>] [--category <text>] [--league <text>] [--sport <text>] [--open-only <true|false>] [--active-only <true|false>] [--ignore-end-date <true|false>] [--tradable-only <true|false>] [--all-pages <true|false>] [--max-pages <n>] [--stop-after-empty-pages <n>] [--limit <n>] [--format <auto|json|table>]`2829Allowed passthrough groups (official CLI surface, restricted by wrapper policy):3031- `markets` (`list|get|search|tags`)32- `data` (positions/value/leaderboards/etc.)3334Blocked groups in this wrapper (intentionally not exposed for agents):3536- `wallet`37- `bridge`38- `approve`39- `ctf`40- `setup`41- `upgrade`42- `shell`4344Legacy compatibility aliases are still supported (`market`, `book`, `midpoint`, `spread`, `price`, `last-trade-price`, `tick-size`, `neg-risk`, `fee-rate`, `price-history`, `order`, `trades`, `open-orders`, `balance-allowance`, `closed-only-mode`, `server-time`) but should not be used for new agent flows.4546## Examples4748```bash49# Wrapper/health50grimoire venue polymarket info --format json51grimoire venue polymarket status --format json5253# Canonical discovery54grimoire venue polymarket search-markets --query bitcoin --active-only true --open-only true --format json55grimoire venue polymarket search-markets --category sports --league "la liga" --active-only true --open-only true --format json5657# Official passthrough discovery/data58grimoire venue polymarket markets list --limit 25 --format json59grimoire venue polymarket markets search "atleti" --limit 25 --format json60grimoire venue polymarket data positions <address> --limit 25 --format json61grimoire venue polymarket data trades <address> --limit 25 --format json62grimoire venue polymarket data leaderboard --period week --order-by vol --limit 25 --format json6364# Legacy compatibility aliases (still supported)65grimoire venue polymarket book --token-id <token_id> --format json66grimoire venue polymarket price --token-id <token_id> --side buy --format json67grimoire venue polymarket order --order-id <order_id> --format json68grimoire venue polymarket open-orders --market <condition_id> --format json69```7071## Runtime Configuration7273Adapter/runtime auth (for spell execution):7475- required by default: `POLYMARKET_PRIVATE_KEY`76- optional API creds: `POLYMARKET_API_KEY`, `POLYMARKET_API_SECRET`, `POLYMARKET_API_PASSPHRASE`77- optional derive toggle (default true): `POLYMARKET_DERIVE_API_KEY=true|false`78- optional signature routing: `POLYMARKET_SIGNATURE_TYPE` (`0` EOA, `1` POLY_PROXY, `2` GNOSIS_SAFE), `POLYMARKET_FUNDER`79- `grimoire cast` / `grimoire resume` key-based flows inject the same wallet-manager key into the Polymarket adapter, so a separate `POLYMARKET_PRIVATE_KEY` env is not required there.8081Venue CLI backend:8283- Official binary required: `polymarket`84- Install: `brew tap Polymarket/polymarket-cli && brew install polymarket`85- Optional path override: `POLYMARKET_OFFICIAL_CLI=/custom/path/polymarket`8687## Spell Actions8889Polymarket uses `custom` action type with `op: "order"` for order placement:9091```spell92polymarket.custom(93op="order",94token_id="TOKEN_ID",95price="0.55",96size="100",97side="BUY",98order_type="GTC",99)100```101102The adapter does not support runtime constraints (`max_slippage`, etc.). Order routing:103- `GTC`/`GTD` → limit order (`createAndPostOrder`)104- `FOK`/`FAK` → market order (`createAndPostMarketOrder`)105106## Metric Surface (Spell Comparisons)107108Polymarket exposes `mid_price` for CLOB token midpoint comparisons:109110```spell111poly_mid = metric("mid_price", polymarket, USDC, "token_id=<clobTokenId>")112```113114Selector keys accepted: `token_id`, `tokenid`, `market_id`, `id`.115If selector is omitted, the metric falls back to the 3rd argument value.116117## Adapter Notes118119- Adapter name: `polymarket`120- Execution type: `offchain`121- Supported chain metadata: `137` (Polygon)122- Action type: `custom`123- Supported custom ops: `order`, `cancel_order`, `cancel_orders`, `cancel_all`, `heartbeat`124125Order argument aliases accepted:126127- token: `token_id` or `tokenID` or `tokenId` or `coin`128- amount: `size` or `amount`129- side: `BUY`/`SELL`130- order type: `GTC`/`GTD`/`FOK`/`FAK`131- extra compatibility aliases: `arg0..arg5`, `reduce_only`132133Order type routing:134135- `GTC`/`GTD` -> limit order path (`createAndPostOrder`)136- `FOK`/`FAK` -> market order path (`createAndPostMarketOrder`)137138## Notes139140- Prefer `--format json` for agent and automation workflows.141- `search-markets` is the agent-oriented normalized discovery command; passthrough `markets search` is thinner and closer to official behavior.142- Keep prompts/tooling on this CLI surface; do not call Polymarket HTTP APIs directly from advisory tools.143