# polymarket

Adopt this skill: https://proskills.md/skills/other/2025emma-vibe-coding-cn-i18n-zh-skills-polymarket

Page: https://proskills.md/skills/other/2025emma-vibe-coding-cn-i18n-zh-skills-polymarket
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: i18n/zh/skills/polymarket/SKILL.md
size: 6293
upstream: https://github.com/2025emma/vibe-coding-cn/blob/main/i18n/zh/skills/polymarket/SKILL.md

````text
---
name: polymarket
description: Comprehensive Polymarket skill covering prediction markets, API, trading, market data, and real-time WebSocket data streaming. Build applications with Polymarket services, monitor live trades, and integrate market predictions.
---

# Polymarket Comprehensive Skill

Complete assistance with Polymarket development - covering the full platform (API, trading, market data) and the real-time data streaming client (WebSocket subscriptions for live market activity).

## When to Use This Skill

This skill should be triggered when:

**Platform & API:**
- Working with Polymarket prediction markets
- Using Polymarket API for market data
- Implementing trading strategies
- Building applications with Polymarket services
- Learning Polymarket best practices

**Real-Time Data Streaming:**
- Connecting to Polymarket's WebSocket service
- Building prediction market monitoring tools
- Processing live trades, orders, and market updates
- Monitoring market comments and social reactions
- Tracking RFQ (Request for Quote) activity
- Integrating crypto price feeds

## Quick Reference

### Real-Time Data Client Setup

**Installation:**
```bash
npm install @polymarket/real-time-data-client
```

**Basic Usage:**
```typescript
import { RealTimeDataClient } from "@polymarket/real-time-data-client";

const onMessage = (message: Message): void => {
    console.log(message.topic, message.type, message.payload);
};

const onConnect = (client: RealTimeDataClient): void => {
    client.subscribe({
        subscriptions: [{
            topic: "activity",
            type: "trades"
        }]
    });
};

new RealTimeDataClient({ onMessage, onConnect }).connect();
```

### Supported WebSocket Topics

**1. Activity (`activity`)**
- `trades` - Completed trades
- `orders_matched` - Order matching events
- Filters: `{"event_slug":"string"}` OR `{"market_slug":"string"}`

**2. Comments (`comments`)**
- `comment_created`, `comment_removed`
- `reaction_created`, `reaction_removed`
- Filters: `{"parentEntityID":number,"parentEntityType":"Event"}`

**3. RFQ (`rfq`)**
- Request/Quote lifecycle events
- No filters, no auth required

**4. Crypto Prices (`crypto_prices`, `crypto_prices_chainlink`)**
- `update` - Real-time price feeds
- Filters: `{"symbol":"BTC"}` (optional)

**5. CLOB User (`clob_user`)** ⚠️ Requires Auth
- `order` - User's order updates
- `trade` - User's trade executions

**6. CLOB Market (`clob_market`)**
- `price_change` - Price movements
- `agg_orderbook` - Aggregated order book
- `last_trade_price` - Latest prices
- `market_created`, `market_resolved`

### Authentication for User Data

```typescript
client.subscribe({
    subscriptions: [{
        topic: "clob_user",
        type: "*",
        clob_auth: {
            key: "your-api-key",
            secret: "your-api-secret",
            passphrase: "your-passphrase"
        }
    }]
});
```

### Common Use Cases

**Monitor Specific Market:**
```typescript
client.subscribe({
    subscriptions: [{
        topic: "activity",
        type: "trades",
        filters: `{"market_slug":"btc-above-100k-2024"}`
    }]
});
```

**Track Multiple Markets:**
```typescript
client.subscribe({
    subscriptions: [{
        topic: "clob_market",
        type: "price_change",
        filters: `["100","101","102"]`
    }]
});
```

**Monitor Event Comments:**
```typescript
client.subscribe({
    subscriptions: [{
        topic: "comments",
        type: "*",
        filters: `{"parentEntityID":12345,"parentEntityType":"Event"}`
    }]
});
```

## Reference Files

This skill includes comprehensive documentation in `references/`:

**Platform Documentation:**
- **api.md** - Polymarket API documentation
- **getting_started.md** - Getting started guide
- **guides.md** - Development guides
- **learn.md** - Learning resources
- **trading.md** - Trading documentation
- **other.md** - Additional resources

**Real-Time Client:**
- **README.md** - WebSocket client API and examples
- **llms.md** - LLM integration guide
- **llms-full.md** - Complete LLM documentation

Use `view` to read specific reference files for detailed information.

## Key Features

**Platform Capabilities:**
✅ Prediction market creation and resolution
✅ Trading API (REST & WebSocket)
✅ Market data queries
✅ User portfolio management
✅ Event and market discovery

**Real-Time Streaming:**
✅ WebSocket-based persistent connections
✅ Topic-based subscriptions
✅ Dynamic subscription management
✅ Filter support for targeted data
✅ User authentication for private data
✅ TypeScript with full type safety
✅ Initial data dumps on connection

## Best Practices

### WebSocket Connection Management
- Use `onConnect` callback for subscriptions
- Implement reconnection logic for production
- Clean up with `disconnect()` when done
- Handle authentication errors gracefully

### Subscription Strategy
- Use wildcards (`"*"`) sparingly
- Apply filters to reduce data volume
- Unsubscribe from unused streams
- Process messages asynchronously

### Performance
- Consider batching high-frequency data
- Use filters to minimize client processing
- Validate message payloads before use

## Requirements

- **Node.js**: 14+ recommended
- **TypeScript**: Optional but recommended
- **Package Manager**: npm or yarn

## Resources

### Official Links
- **Polymarket Platform**: https://polymarket.com
- **Real-Time Client Repo**: https://github.com/Polymarket/real-time-data-client
- **API Documentation**: See references/api.md

### Working with This Skill

**For Beginners:**
Start with `getting_started.md` for foundational concepts.

**For API Integration:**
Use `api.md` and `trading.md` for REST API details.

**For Real-Time Data:**
Use `README.md` for WebSocket client implementation.

**For LLM Integration:**
Use `llms.md` and `llms-full.md` for AI/ML use cases.

## Notes

- Real-Time Client is TypeScript/JavaScript (not Python)
- Some WebSocket topics require authentication
- Use filters to manage message volume effectively
- All timestamps are Unix timestamps
- Market IDs are strings (e.g., "100", "101")
- Platform documentation covers both REST API and WebSocket usage

---

**This comprehensive skill combines Polymarket platform expertise with real-time data streaming capabilities!**
````

## File: README.md
upstream: https://github.com/2025emma/vibe-coding-cn/blob/main/README.md

```text
<!--
-------------------------------------------------------------------------------
  项目头部区域 (HEADER)
-------------------------------------------------------------------------------
-->
<p align="center">
  <!-- 建议尺寸: 1280x640px。可以使用 Canva, Figma 或 https://banners.beyondco.de/ 等工具制作 -->
  <img src="https://github.com/tukuaiai.png" alt="Vibe Coding 指南" width="80px">
</p>

<div align="center">

# Vibe Coding 指南

**一个通过与 AI 结对编程，将想法变为现实的终极工作站**

---

<!--
  徽章区域 (BADGES)
-->
<!-- 项目状态徽章 -->
<p>
  <a href="https://github.com/tukuaiai/vibe-coding-cn/actions"><img src="https://img.shields.io/github/actions/workflow/status/tukuaiai/vibe-coding-cn/main.yml?label=%E6%9E%84%E5%BB%BA%E7%8A%B6%E6%80%81&style=for-the-badge" alt="构建状态"></a>
  <a href="https://github.com/tukuaiai/vibe-coding-cn/releases"><img src="https://img.shields.io/github/v/release/tukuaiai/vibe-coding-cn?label=%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC&style=for-the-badge" alt="最新版本"></a>
  <a href="LICENSE"><img src="https://img.shields.io/github/license/tukuaiai/vibe-coding-cn?label=%E8%AE%B8%E5%8F%AF%E8%AF%81&style=for-the-badge" alt="许可证"></a>
  <a href="https://github.com/tukuaiai/vibe-coding-cn"><img src="https://img.shields.io/github/languages/top/tukuaiai/vibe-coding-cn?label=%E4%B8%BB%E8%A6%81%E8%AF%AD%E8%A8%80&style=for-the-badge" alt="主要语言"></a>
  <a href="https://github.com/tukuaiai/vibe-coding-cn"><img src="https://img.shields.io/github/languages/code-size/tukuaiai/vibe-coding-cn?label=%E4%BB%A3%E7%A0%81%E9%87%8F&style=for-the-badge" alt="代码量"></a>
  <a href="https://github.com/tukuaiai/vibe-coding-cn/graphs/contributors"><img src="https://img.shields.io/github/contributors/tukuaiai/vibe-coding-cn?label=%E8%B4%A1%E7%8C%AE%E8%80%85&style=for-the-badge" alt="贡献者"></a>
  <a href="https://t.me/glue_coding"><img src="https://img.shields.io/badge/聊天-Telegram-blue?style=for-the-badge&logo=telegram" alt="交流群"></a>
</p>

<!-- 多语言入口 -->
<p>
  <a href="./i18n/zh/README.md"><img src="https://img.shields.io/badge/语言-中文-red?style=for-the-badge" alt="简体中文"></a>
  <a href="./i18n/en/README.md"><img src="https://img.shields.io/badge/语言-English-lightgrey?style=for-the-badge" alt="English"></a>
  <a href="./i18n/he/"><img src="https://img.shields.io/badge/语言-עברית-navy?style=for-the-badge" alt="Hebrew"></a>
  <a href="./i18n/ar/"><img src="https://img.shields.io/badge/语言-العربية-brown?style=for-the-badge" alt="Arabic"></a>
  <a href="./i18n/bn/"><img src="https://img.shields.io/badge/语言-বাংলা-orange?style=for-the-badge" alt="Bengali"></a>
  <a href="./i18n/de/"><img src="https://img.shields.io/badge/语言-Deutsch-black?style=for-the-badge" alt="Deutsch"></a>
  <a href="./i18n/es/"><img src="https://img.shields.io/badge/语言-Español-yellow?style=for-the-badge" alt="Español"></a>
  <a href="./i18n/fa/"><img src="https://img.shields.io/badge/语言-فارسی-purple?style=for-the-badge" alt="Farsi"></a>
  <a href="./i18n/fr/"><img src="https://img.shields.io/badge/语言-Français-blue?style=for-the-badge" alt="Français"></a>
  <a href="./i18n/ha/"><img src="https://img.shields.io/badge/语言-Hausa-darkgreen?style=for-the-badge" alt="Hausa"></a>
  <a href="./i18n/hi/"><img src="https://img.shields.io/badge/语言-हिन्दी-darkorange?style=for-the-badge" alt="Hindi"></a>
  <a href="./i18n/id/"><img src="https://img.shields.io/badge/语言-Bahasa%20Indonesia-teal?style=for-the-badge" alt="Bahasa Indonesia"></a>
  <a href="./i18n/it/"><img src="https://img.shields.io/badge/语言-Italiano-green?style=for-the-badge" alt="Italiano"></a>
  <a href="./i18n/ja/"><img src="https://img.shields.io/badge/语言-日本語-indigo?style=for-the-badge" alt="日本語"></a>
  <a href="./i18n/ko/"><img src="https://img.shields.io/badge/语言-한국어-slateblue?style=for-the-badge" alt="한국어"></a>
  <a href="./i18n/ms/"><img src="https://img.shields.io/badge/语言-Bahasa%20Melayu-seagreen?style=for-the-badge" alt="Bahasa Melayu"></a>
  <a href="./i18n/nl/"><img src="https://img.shields.io/badge/语言-Nederlands-darkred?style=for-the-badge" alt="Nederlands"></a>
  <a href="./i18n/pl/"><img src="https://img.shields.io/badge/语言-Polski-crimson?style=for-the-badge" alt="Polski"></a>
  <a href="./i18n/pt/"><img src="https://img.shields.io/badge/语言-Português-darkslategray?style=for-the-badge" alt="Português"></a>
  <a href="./i18n/ru/"><img src="https://img.shields.io/badge/语言-Русский-steelblue?style=for-the-badge" alt="Русский"></a>
  <a href="./i18n/sw/"><img src="https://img.shields.io/badge/语言-Kiswahili-forestgreen?style=for-the-badge" alt="Swahili"></a>
  <a href="./i18n/ta/"><img src="https://img.shields.io/badge/语言-தமிழ்-darkmagenta?style=for-the-badge" alt="Tamil"></a>
  <a href="./i18n/th/"><img src="https://img.shields.io/badge/语言-ไทย-royalblue?style=for-the-badge" alt="ภาษาไทย"></a>
  <a href="./i18n/tr/"><img src="https://img.shields.io/badge/语言-Türkçe-firebrick?style=for-the-badge" alt="Türkçe"></a>
  <a href="./i18n/uk/"><img src="https://img.shields.io/badge/语言-Українська-cornflowerblue?style=for-the-badge" alt="Українська"></a>
  <a href="./i18n/ur/"><img src="https://img.shields.io/badge/语言-اردو-darkslateblue?style=for-the-badge" alt="Urdu"></a>
  <a href="./i18n/vi/"><img src="https://img.shields.io/badge/语言-Tiếng%20Việt-darkgreen?style=for-the-badge" alt="Tiếng Việt"></a>
</p>

<!-- 资源直达 -->
<p>
  <a href="./i18n/zh/prompts/"><img src="https://img.shields.io/badge/提示词-精选-purple?style=for-the-badge" alt="提示词精选"></a>
  <a href="./i18n/zh/skills/"><img src="https://img.shields.io/badge/skills-技能大全-forestgreen?style=for-the-badge" alt="skills技能大全"></a>
  <a href="./libs/external/prompts-library/prompt_docs/"><img src="https://img.shields.io/badge/提示词-大全-orange?style=for-the-badge" alt="提示词大全"></a>
  <a href="https://docs.google.com/spreadsheets/d/1ngoQOhJqdguwNAilCl1joNwTje7FWWN9WiI2bo5VhpU/edit?gid=2093180351#gid=2093180351&range=A1"><img src="https://img.shields.io/badge/提示词-在线表格(推荐)-blue?style=for-the-badge" alt="提示词在线表格（推荐）"></a>
  <a href="https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools"><img src="https://img.shields.io/badge/系统提示词-仓库-slateblue?style=for-the-badge" alt="系统提示词仓库"></a>
</p>

[📚 相关文档](#-相关文档与资源)
[🚀 入门指南](#-入门指南)
[⚙️ 完整设置流程](#️-完整设置流程)
[📞 联系方式](#-联系方式)
[✨ 支持项目](#-支持项目)
[🤝 参与贡献](#-参与贡献)

本仓库的 AI 解读链接：[zread.ai/tukuaiai/vibe-coding-cn](https://zread.ai/tukuaiai/vibe-coding-cn/1-overview)

</div>

---

## 🖼️ 概览

**Vibe Coding** 是一个与 AI 结对编程的终极工作流程，旨在帮助开发者丝滑地将想法变为现实。本指南详细介绍了从项目构思、技术选型、实施规划到具体开发、调试和扩展的全过程，强调以**规划驱动**和**模块化**为核心，避免让 AI 失控导致项目混乱。

> **核心理念**: *规划就是一切。* 谨慎让 AI 自主规划，否则你的代码库会变成一团无法管理的乱麻。

**注意**：以下经验分享并非普遍适用，请在具体实践中结合场景，辩证采纳。

## 🔑 元方法论 (Meta-Methodology)

该思想的核心是构建一个能够**自我优化**的 AI 系统。其递归本质可分解为以下步骤：

> 延伸阅读：[A Formalization of Recursive Self-Optimizing Generative Systems](./i18n/zh/documents/Methodology%20and%20Principles/A%20Formalization%20of%20Recursive%20Self-Optimizing%20Generative%20Systems.md)

#### 1. 定义核心角色：

*   **α-提示词 (生成器)**: 一个“母体”提示词，其唯一职责是**生成**其他提示词或技能。
*   **Ω-提示词 (优化器)**: 另一个“母体”提示词，其唯一职责是**优化**其他提示词或技能。

#### 2. 描述递归的生命周期：

1.  **创生 (Bootstrap)**:
    *   使用 AI 生成 `α-提示词` 和 `Ω-提示词` 的初始版本 (v1)。

2.  **自省与进化 (Self-Correction & Evolution)**:
    *   使用 `Ω-提示词 (v1)` **优化** `α-提示词 (v1)`，从而得到一个更强大的 `α-提示词 (v2)`。

3.  **创造 (Generation)**:
    *   使用**进化后的** `α-提示词 (v2)` 生成所有需要的目标提示词和技能。

4.  **循环与飞跃 (Recursive Loop)**:
    *   将新生成的、更强大的产物（甚至包括新版本的 `Ω-提示词`）反馈给系统，再次用于优化 `α-提示词`，从而启动持续进化。

#### 3. 终极目标：

通过此持续的**递归优化循环**，系统在每次迭代中实现**自我超越**，无限逼近预设的**预期状态**。

## 🧭 道

* **凡是 ai 能做的，就不要人工做**
* **一切问题问 ai**
* **目的主导：开发过程中的一切动作围绕"目的"展开**
* **上下文是 vibe coding 的第一性要素，垃圾进，垃圾出**
* **系统性思考，实体，链接，功能/目的，三个维度**
* **数据与函数即是编程的一切**
* **输入，处理，输出刻画整个过程**
* **多问 ai 是什么？，为什么？，怎么做？**
* **先结构，后代码，一定要规划好框架，不然后面技术债还不完**
* **奥卡姆剃刀定理，如无必要，勿增代码**
* **帕累托法则，关注重要的那20%**
* **逆向思考，先明确你的需求，从需求逆向构建代码**
* **重复，多试几次，实在不行重新开个窗口，**
* **专注，极致的专注可以击穿代码，一次只做一件事（神人除外）**

## 🧩 法

* **一句话目标 + 非目标**
* **正交性，功能不要太重复了，（这个分场景）**
* **能抄不写，不重复造轮子，先问 ai 有没有合适的仓库，下载下来改**
* **一定要看官方文档，先把官方文档爬下来喂给 ai**
* **按职责拆模块**
* **接口先行，实现后补**
* **一次只改一个模块**
* **文档即上下文，不是事后补**

## 🛠️ 术

* 明确写
```
