mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-16 12:28:06 +00:00
4.7 KiB
4.7 KiB
name, description
| name | description |
|---|---|
| polymarket | Polymarket prediction-market skill: REST/API research, CLOB market data, trading integration boundaries, WebSocket real-time data client, subscriptions, filters, authentication, and LLM-oriented market monitoring. |
polymarket Skill
Use this skill to build Polymarket research, monitoring, market-data, and integration workflows while keeping trading/authentication risks explicit.
When to Use This Skill
Trigger when any of these applies:
- Querying Polymarket markets, events, prices, trades, comments, RFQ, or CLOB data.
- Building prediction-market monitors, dashboards, alerts, or LLM market-analysis tools.
- Using the
@polymarket/real-time-data-clientWebSocket client. - Subscribing to activity, comments, RFQ, crypto price,
clob_market, or authenticatedclob_usertopics. - Debugging subscription filters, authentication payloads, reconnect handling, or message processing.
Not For / Boundaries
- Not financial advice, market-making advice, or a guarantee of trading profitability.
- Do not expose CLOB API keys, secrets, passphrases, wallet keys, or private signing material.
- Private user streams and trading actions require explicit authentication and security review.
- Required inputs: market/event slug or CLOB market id, topic/type, auth need, filter payload, runtime, and expected output.
- For live trading, verify API terms, regional restrictions, auth scheme, and risk controls before implementation.
Quick Reference
Common Patterns
Install the real-time data client
npm install @polymarket/real-time-data-client
Subscribe to live trades
import { RealTimeDataClient } from "@polymarket/real-time-data-client";
const client = new RealTimeDataClient({
onMessage: (message) => console.log(message.topic, message.type, message.payload),
onConnect: (c) => c.subscribe({
subscriptions: [{ topic: "activity", type: "trades" }],
}),
});
client.connect();
Filter activity to one market slug
client.subscribe({
subscriptions: [{
topic: "activity",
type: "trades",
filters: "{\"market_slug\":\"btc-above-100k-2024\"}",
}],
});
Subscribe to CLOB market price changes
client.subscribe({
subscriptions: [{
topic: "clob_market",
type: "price_change",
filters: "[\"100\",\"101\",\"102\"]",
}],
});
Subscribe to comments for an event
client.subscribe({
subscriptions: [{
topic: "comments",
type: "*",
filters: "{\"parentEntityID\":12345,\"parentEntityType\":\"Event\"}",
}],
});
Authenticate a user stream
client.subscribe({
subscriptions: [{
topic: "clob_user",
type: "*",
clob_auth: {
key: "YOUR_API_KEY",
secret: "YOUR_API_SECRET",
passphrase: "YOUR_PASSPHRASE",
},
}],
});
Examples
Example 1: Public Trade Monitor
- Input: market slug and alert threshold.
- Steps:
- Subscribe to
activity/tradeswith amarket_slugfilter. - Normalize messages into timestamp, market, side, price, size.
- Alert only when trade size or price movement crosses the configured threshold.
- Subscribe to
- Expected output / acceptance: real-time public trade stream with no private authentication material.
Example 2: CLOB Price Dashboard
- Input: CLOB market IDs.
- Steps:
- Subscribe to
clob_market/price_changewith a JSON array filter. - Update an in-memory view keyed by market id.
- Persist snapshots at a controlled interval rather than every message if volume is high.
- Subscribe to
- Expected output / acceptance: dashboard shows latest market prices and handles reconnects idempotently.
Example 3: Authenticated User Order Feed
- Input: CLOB API credentials stored in a secret manager.
- Steps:
- Load credentials at runtime without logging them.
- Subscribe to
clob_userorder/trade events. - Validate message schema and write audit logs without secrets.
- Expected output / acceptance: private user updates are received and secrets never appear in source control or logs.
References
references/index.md: navigation for local Polymarket references.references/api.md: platform API documentation.references/getting_started.md: onboarding and setup notes.references/trading.md: trading and market operations.references/realtime-client.md: WebSocket real-time data client.references/README.md: platform overview.references/llms.mdandreferences/llms-full.md: LLM integration material.
Maintenance
- Sources: local
references/extracted from Polymarket platform and real-time client documentation. - Last updated: 2026-04-28
- Known limits: API auth, market availability, and regional/legal constraints must be verified outside this skill before live trading.