$npx -y skills add AlexAI-MCP/hermes-CCC --skill polymarketQuery Polymarket prediction markets for probability data and research insights on real-world events.
| 1 | # Polymarket |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Use this skill to pull live prediction market data for research and forecasting workflows. |
| 6 | - Polymarket is useful for probability-oriented views of current events, elections, macro themes, and sports or policy questions. |
| 7 | - Treat the market price as a crowd-implied probability signal, not ground truth. |
| 8 | |
| 9 | ## API Surface |
| 10 | |
| 11 | - Base reference: `https://clob.polymarket.com/` |
| 12 | - Public market discovery is commonly accessed through the gamma API. |
| 13 | - Start with active markets and then filter by topic or keyword. |
| 14 | |
| 15 | ## Request Discipline and Rate Limits |
| 16 | |
| 17 | - Send a timeout on every request and fail fast instead of hanging a long-running research pass. |
| 18 | - Start with at most 1 request per second when iterating on the gamma API and slow down further if responses get unstable. |
| 19 | - Back off and retry once on `429` or transient `5xx` responses with a short sleep before the second request. |
| 20 | - Cache raw JSON snapshots by timestamp when polling the same topic so you do not hit the API repeatedly for the same view. |
| 21 | - Keep `limit` small during discovery, then widen only after you confirm the endpoint shape and the filter logic you need. |
| 22 | - Record the exact URL you used in notes or logs so later analysis can reproduce the same market slice. |
| 23 | |
| 24 | ## Fetch Active Markets |
| 25 | |
| 26 | ```bash |
| 27 | curl "https://gamma-api.polymarket.com/markets?active=true&limit=20" |
| 28 | ``` |
| 29 | |
| 30 | - This returns a JSON list of market objects. |
| 31 | - Use small limits during exploration and larger limits when building a topic watcher. |
| 32 | |
| 33 | ## Important Market Fields |
| 34 | |
| 35 | - `question` |
| 36 | - `outcomes` |
| 37 | - `outcomePrices` |
| 38 | - `volume` |
| 39 | |
| 40 | These are usually enough for first-pass research. |
| 41 | |
| 42 | ## Additional Fields to Inspect |
| 43 | |
| 44 | - Inspect `slug` when you need a stable human-readable identifier for later lookups or reporting. |
| 45 | - Inspect `endDate` or other settlement timing fields when the timing of resolution matters more than the headline probability. |
| 46 | - Inspect `liquidity` when present to separate tradeable markets from thin markets that move on little size. |
| 47 | - Inspect `active` and `closed` to keep live monitoring separate from post-resolution analysis. |
| 48 | - Inspect `category`, `tags`, or related event metadata when you need to group markets into a watcher by theme. |
| 49 | - Inspect `conditionId` or token identifiers when you need to correlate market data across downstream systems. |
| 50 | |
| 51 | ## Interpret the Data |
| 52 | |
| 53 | - `question` is the market prompt. |
| 54 | - `outcomes` lists the named outcomes, often `Yes` and `No`. |
| 55 | - `outcomePrices` represents the current market-implied probabilities. |
| 56 | - `volume` helps indicate liquidity and how much weight to assign the price signal. |
| 57 | |
| 58 | ## Probability Interpretation |
| 59 | |
| 60 | - Interpret a price like `0.65` as roughly a 65 percent implied chance. |
| 61 | - Lower-liquidity markets may be noisier. |
| 62 | - High probability is not certainty. |
| 63 | - Large probability moves over time can matter more than a single point estimate. |
| 64 | |
| 65 | ## Python Example |
| 66 | |
| 67 | ```python |
| 68 | import requests |
| 69 | |
| 70 | url = "https://gamma-api.polymarket.com/markets?active=true&limit=20" |
| 71 | markets = requests.get(url, timeout=20).json() |
| 72 | |
| 73 | for market in markets: |
| 74 | question = market.get("question") |
| 75 | prices = market.get("outcomePrices") |
| 76 | print(question, prices) |
| 77 | ``` |
| 78 | |
| 79 | - This is the minimum useful fetch loop. |
| 80 | - Add defensive parsing because API field presence can vary. |
| 81 | |
| 82 | ## Error Handling and Parsing Rules |
| 83 | |
| 84 | - Call `response.raise_for_status()` before parsing JSON so transport failures are not mistaken for empty market sets. |
| 85 | - Normalize the response into a list even if the endpoint returns a single object or a wrapped payload. |
| 86 | - Parse `outcomes` and `outcomePrices` defensively because some clients expose them as serialized JSON strings. |
| 87 | - Skip a market if the number of outcomes does not match the number of prices, and log the `question` for review. |
| 88 | - Treat missing `volume` or `liquidity` as a low-confidence signal instead of silently trusting the quoted price. |
| 89 | - Drop closed or inactive markets from live-monitoring runs unless the task is explicitly about settlement or historical analysis. |
| 90 | - Return the raw market object when the schema changes and your parser no longer finds the expected keys. |
| 91 | |
| 92 | ## Filter by Category or Keyword |
| 93 | |
| 94 | - Filter by category when tracking a domain like politics, crypto, or macro. |
| 95 | - Filter by keyword when you care about a specific topic such as `tariffs`, `Fed`, or `OpenAI`. |
| 96 | - Keep the raw result set if you want to backtest or compare price movement later. |
| 97 | |
| 98 | Simple pattern: |
| 99 | |
| 100 | ```python |
| 101 | keyword = "election" |
| 102 | filtered = [ |
| 103 | m for m in markets |
| 104 | if keyword.lower() in (m.get("question", "")).lower() |
| 105 | ] |
| 106 | ``` |
| 107 | |
| 108 | ## Concrete Workflows |
| 109 | |
| 110 | 1. Track a single topic with `curl` and `jq`. |
| 111 | |
| 112 | ```bash |
| 113 | curl -s "https://gamma-api.polymarket |