mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-03 06:07:46 +00:00
chore: skills - remove deprecated skill packs
This commit is contained in:
@@ -165,8 +165,7 @@ git push origin develop
|
||||
│ ├── README.md # skills 总览与索引
|
||||
│ ├── AGENTS.md # skills/ 目录规则
|
||||
│ ├── auto-skill/ # 元技能核心
|
||||
│ ├── sop-generator/ # SOP 生成
|
||||
│ └── ... # 更多技能
|
||||
│ └── claude-official-skills/ # Claude 官方 skills 软链接入口
|
||||
│
|
||||
├── assets/ # 静态资产与外部资源入口
|
||||
│ ├── README.md # 外部资源在线表格入口
|
||||
@@ -227,8 +226,7 @@ git push origin develop
|
||||
- `docs/playbooks/GEO与SEO优化方法.md` - GEO / SEO 内容工程方法,承接 GEOFlow 的知识库、结构化内容、审核与分发思路
|
||||
- `docs/concepts/问题求解能力.md` - 问题定义与求解路径底层模型
|
||||
- `docs/references/底层程序逻辑设计与工程优化项.md` - 底层程序逻辑与工程优化检查项
|
||||
- `skills/tmux-autopilot/` - tmux 自动化操控技能(基于 oh-my-tmux,含 capture-pane/send-keys/蜂群巡检脚本)
|
||||
- `skills/sop-generator/` - SOP 生成与规范化技能(输入资料/需求 -> 标准 SOP)
|
||||
- `skills/auto-skill/` - Skills 生成、重构与校验的元技能
|
||||
|
||||
---
|
||||
|
||||
@@ -255,7 +253,7 @@ feat|fix|docs|chore|refactor|test: scope - summary
|
||||
|
||||
示例:
|
||||
- `docs: prompts - add new coding prompt`
|
||||
- `feat: skills - add postgresql skill`
|
||||
- `feat: skills - add custom skill`
|
||||
- `fix: readme - correct broken link`
|
||||
|
||||
### PR 必填内容
|
||||
|
||||
@@ -11,3 +11,5 @@
|
||||
- 清退 `tools/external/my-nvim/nvim-config/nvim` 二进制运行时,改为文档说明从官方渠道安装 Neovim。
|
||||
- 修复 `tools/prompts-library/main.py` 中 Excel(JSONL) -> JSONL 转换的行号偏移,保持导出记录与 Excel 原始行号一致。
|
||||
- 清退 `tools/chat-vault/monitoring/grafana/monitor-tui/` 中误提交的第三方 btop 源码镜像,降低仓库噪音与语言统计污染。
|
||||
- 创建 `baseline-skill-cleanup-20260502-041941` 基线标签,开始清理领域型/工具型 Skills。
|
||||
- 清退 `ccxt`、`claude-code-guide`、`claude-cookbooks`、`coingecko`、`cryptofeed`、`ddd-doc-steward`、`headless-cli`、`hummingbot`、`markdown-to-epub`、`polymarket`、`postgresql`、`proxychains`、`snapdom`、`sop-generator`、`telegram-dev`、`timescaledb`、`tmux-autopilot`、`twscrape` 等 Skill 目录,仅保留 `auto-skill` 与 Claude 官方 skills 软链接入口。
|
||||
|
||||
@@ -394,7 +394,6 @@ pip install -r tools/prompts-library/scripts/requirements.txt
|
||||
* [**元提示词**](https://docs.google.com/spreadsheets/d/1Ifk_dLF25ULSxcfGem1hXzJsi7_RBUNAki8SBCuvkJA/edit?gid=1254297203#gid=1254297203): 用于生成提示词的高级提示词。
|
||||
* [**通用项目架构模板**](docs/references/通用项目架构模板.md): 可用于快速搭建标准化的项目目录结构。
|
||||
* [**元技能:Auto Skill**](./skills/auto-skill/SKILL.md): 用于生成、重构与校验 Skills 的元技能。
|
||||
* [**SOP 生成 Skill**](./skills/sop-generator/SKILL.md): 将资料/需求整理为可执行 SOP 的技能。
|
||||
* [**tmux快捷键大全**](docs/playbooks/tmux快捷键大全.md): tmux 的快捷键参考文档。
|
||||
* [**LazyVim快捷键大全**](docs/playbooks/LazyVim快捷键大全.md): LazyVim 的快捷键参考文档。
|
||||
* [**手机远程 Vibe Coding**](docs/playbooks/关于手机ssh任意位置链接本地计算机,基于frp实现的方法.md): 基于 frp 实现手机 SSH 远程控制本地电脑进行 Vibe Coding。
|
||||
@@ -480,8 +479,7 @@ pip install -r tools/prompts-library/scripts/requirements.txt
|
||||
│ │ ├── README.md # skills 总览与索引
|
||||
│ │ ├── AGENTS.md # skills/ 目录规则
|
||||
│ │ ├── auto-skill/ # 元技能核心
|
||||
│ │ ├── sop-generator/ # SOP 生成
|
||||
│ │ └── ... # 更多技能
|
||||
│ │ └── claude-official-skills/ # Claude 官方 skills 软链接入口
|
||||
│ └── repos/ # 外部工具与依赖镜像(含 Git submodule)
|
||||
│ ├── README.md # 外部工具索引
|
||||
│ ├── prompts-library/ # Excel ↔ Markdown 互转工具,含内部 JSONL Excel 拆分导出
|
||||
|
||||
@@ -87,8 +87,7 @@
|
||||
|
||||
1. [Skills 技能大全](../../../skills/README.md)
|
||||
2. [auto-skill](../../../skills/auto-skill/SKILL.md)
|
||||
3. [sop-generator](../../../skills/sop-generator/SKILL.md)
|
||||
4. [tmux-autopilot](../../../skills/tmux-autopilot/SKILL.md)
|
||||
3. [Claude 官方 Skills](../../../skills/claude-official-skills/)
|
||||
|
||||
完成标准:
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ tags:
|
||||
- `C:\Users\lenovo\Downloads\逻辑 - 孟自黄.md`
|
||||
- `C:\Users\lenovo\Downloads\逻辑 - 孟自黄.epub`
|
||||
- `C:\Users\lenovo\Downloads\build_epub\report.json`
|
||||
- `C:\Users\lenovo\.codex\skills\markdown-to-epub\scripts\build_epub.py`
|
||||
- 历史脚本:原 `markdown-to-epub` skill 已从本仓库清退;如需稳健构建脚本,需从历史提交恢复或以独立工具重新引入。
|
||||
|
||||
#### 2.3.4 Git 状态/变更/提交历史(按需)
|
||||
|
||||
@@ -74,7 +74,7 @@ tags:
|
||||
- 工具:Calibre `ebook-convert`(证据:`ebook-convert --version` 输出 `calibre 8.16.2`)
|
||||
- 运行时:Python(证据:`python --version` 输出 `Python 3.14.2`)
|
||||
- 可选工具:Pandoc(证据:`pandoc --version` 在本会话环境中不可用/未安装)
|
||||
- 构建脚本(可选但推荐):`C:\Users\lenovo\.codex\skills\markdown-to-epub\scripts\build_epub.py`(对本地图片与证据报告更友好;底层仍调用 `ebook-convert`)
|
||||
- 构建脚本:原 `markdown-to-epub` skill 已从本仓库清退;当前可复现路径以 Calibre `ebook-convert` 为准。
|
||||
|
||||
#### 2.3.6 外部来源使用规则(按需)
|
||||
|
||||
@@ -183,8 +183,7 @@ tags:
|
||||
- 动作(命令/读文件/搜索):
|
||||
- 路径 A(直接转换)示例:
|
||||
- `ebook-convert "<输入 Markdown 路径>" "<输出 EPUB 路径>" --title "<标题>" --authors "<作者>" --language "<语言>"`
|
||||
- 路径 B(稳健转换,底层仍用 ebook-convert;推荐用于留证与处理本地资源)示例:
|
||||
- `python "C:/Users/lenovo/.codex/skills/markdown-to-epub/scripts/build_epub.py" --input-md "<输入 Markdown 路径>" --output-epub "<输出 EPUB 路径>" --title "<标题>" --authors "<作者>" --language "<语言>" --clean-build-dir`
|
||||
- 路径 B(稳健转换):原 `markdown-to-epub` skill 已清退;如需该路径,先恢复或重新引入脚本,再记录脚本来源与验证命令。
|
||||
- 注意:`--clean-build-dir` 会删除构建目录,属于不可逆动作;执行前必须有用户批准
|
||||
- 证据:
|
||||
- 记录完整命令行(含所有参数)
|
||||
|
||||
@@ -45,11 +45,6 @@ skills/
|
||||
|
||||
## 快速定位(常用技能)
|
||||
|
||||
- `skills/tmux-autopilot/`:tmux 自动化操控与多 Agent 协作
|
||||
- `skills/sop-generator/`:SOP 生成与规范化
|
||||
- `skills/markdown-to-epub/`:Markdown → EPUB 稳定构建
|
||||
- `skills/auto-skill/`:元技能(技能生成/校验/脚手架)
|
||||
- `skills/claude-official-skills/`:Claude 官方 skills 仓库(Anthropic)的软链接入口
|
||||
- `skills/auto-skill/scripts/Skill_Seekers-development`:Skill Seekers submodule 的软链接入口
|
||||
- `skills/tmux-autopilot/assets/oh-my-tmux`:oh-my-tmux submodule 的软链接入口
|
||||
- `skills/tmux-autopilot/assets/tmux-src`:tmux submodule 的软链接入口
|
||||
|
||||
+17
-62
@@ -1,71 +1,29 @@
|
||||
# 🎯 AI Skills 技能库
|
||||
# AI Skills 技能库
|
||||
|
||||
`skills/` 目录存放 AI 技能(Skills),这些是比提示词更高级的能力封装,可以让 AI 在特定领域表现出专家级水平。当前包含 **19 个**专业技能。
|
||||
`skills/` 目录只保留当前仓库仍需要维护和展示的 Skill 入口。清理原则是:主仓库只维护元技能与必要入口,领域型/工具型大包优先移出主仓库,避免文档噪音、体积膨胀和重复维护。
|
||||
|
||||
## Skills 一览表
|
||||
|
||||
### 🔮 元技能(生成与维护 Skills)
|
||||
## 当前保留
|
||||
|
||||
| 技能 | 说明 |
|
||||
|:---|:---|
|
||||
| [auto-skill](./auto-skill/SKILL.md) | ⭐ 生成、重构与校验 Skills |
|
||||
| [sop-generator](./sop-generator/SKILL.md) | SOP 生成与规范化 |
|
||||
| [auto-skill](./auto-skill/SKILL.md) | 生成、重构与校验 Skills 的元技能 |
|
||||
| [claude-official-skills](./claude-official-skills/) | Claude 官方 skills 仓库的软链接入口,事实来源在 `tools/external/claude-official-skills/` |
|
||||
|
||||
### 🤖 AI 工具
|
||||
## 清理口径
|
||||
|
||||
| 技能 | 说明 |
|
||||
|:---|:---|
|
||||
| [headless-cli](./headless-cli/SKILL.md) | 无头模式 AI CLI 调用(Gemini/Claude/Codex) |
|
||||
| [claude-code-guide](./claude-code-guide/SKILL.md) | Claude Code CLI 使用指南 |
|
||||
| [claude-cookbooks](./claude-cookbooks/SKILL.md) | Claude API 最佳实践 |
|
||||
- `auto-skill/` 是本仓库的 Skill 生产与升级入口,继续保留。
|
||||
- `claude-official-skills/` 是外部官方仓库展示入口,通过 submodule 管理事实来源。
|
||||
- 领域型/工具型 Skill 如交易、数据库、代理、Telegram、tmux、EPUB 等已从主仓库清退;如需恢复,优先以独立仓库、submodule 或重新生成的方式引入。
|
||||
|
||||
### 🗄️ 数据库
|
||||
## 外部技能仓库
|
||||
|
||||
| 技能 | 说明 |
|
||||
|:---|:---|
|
||||
| [postgresql](./postgresql/SKILL.md) | ⭐ PostgreSQL 完整专家技能 |
|
||||
| [timescaledb](./timescaledb/SKILL.md) | PostgreSQL 时序扩展 |
|
||||
|
||||
### 💰 加密货币 / 量化交易
|
||||
|
||||
| 技能 | 说明 |
|
||||
|:---|:---|
|
||||
| [ccxt](./ccxt/SKILL.md) | 加密货币交易所统一 API |
|
||||
| [coingecko](./coingecko/SKILL.md) | CoinGecko 行情 API |
|
||||
| [cryptofeed](./cryptofeed/SKILL.md) | 加密货币实时数据流 |
|
||||
| [hummingbot](./hummingbot/SKILL.md) | 量化交易机器人框架 |
|
||||
| [polymarket](./polymarket/SKILL.md) | 预测市场 API |
|
||||
|
||||
### 🛠️ 开发工具
|
||||
|
||||
| 技能 | 说明 |
|
||||
|:---|:---|
|
||||
| [ddd-doc-steward](./ddd-doc-steward/SKILL.md) | 文档驱动开发(DDD)文档管家 |
|
||||
| [telegram-dev](./telegram-dev/SKILL.md) | Telegram Bot 开发 |
|
||||
| [twscrape](./twscrape/SKILL.md) | Twitter/X 数据抓取 |
|
||||
| [snapdom](./snapdom/SKILL.md) | DOM 快照与测试 |
|
||||
| [proxychains](./proxychains/SKILL.md) | 代理链配置与使用 |
|
||||
| [tmux-autopilot](./tmux-autopilot/SKILL.md) | tmux 自动化操控(AI蜂群协作) |
|
||||
|
||||
### ⚡ 生产力
|
||||
|
||||
| 技能 | 说明 |
|
||||
|:---|:---|
|
||||
| [markdown-to-epub](./markdown-to-epub/SKILL.md) | Markdown 转 EPUB 电子书 |
|
||||
|
||||
## 外部技能仓库(软链接)
|
||||
|
||||
- `skills/claude-official-skills/`:来自 Claude 官方 skills 仓库(Anthropic)。
|
||||
本仓库以 Git submodule 的形式落在 `tools/external/claude-official-skills/`,
|
||||
并通过软链接暴露到 `skills/` 下便于浏览与复用。
|
||||
- 初始化/更新方式:`git submodule update --init --recursive`
|
||||
- Skills 大全网站:`https://skills.sh/`
|
||||
|
||||
## Repo 软链接入口
|
||||
|
||||
- `skills/claude-official-skills/`:指向 `tools/external/claude-official-skills/`。
|
||||
- `skills/auto-skill/scripts/Skill_Seekers-development`:指向 `tools/external/Skill_Seekers-development` submodule,作为 Skill Seekers 工具来源。
|
||||
- `skills/tmux-autopilot/assets/oh-my-tmux`:指向 `tools/external/.tmux`,作为 oh-my-tmux 配置来源。
|
||||
- `skills/tmux-autopilot/assets/tmux-src`:指向 `tools/external/tmux`,作为 tmux 上游源码入口。
|
||||
|
||||
## 快速使用
|
||||
|
||||
@@ -73,23 +31,20 @@
|
||||
# 查看元技能
|
||||
cat skills/auto-skill/SKILL.md
|
||||
|
||||
# 查看无头 CLI 技能
|
||||
cat skills/headless-cli/SKILL.md
|
||||
|
||||
# 查看 PostgreSQL 技能
|
||||
cat skills/postgresql/SKILL.md
|
||||
# 初始化外部 skills 仓库
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## 创建自定义 Skill
|
||||
|
||||
使用元技能生成:
|
||||
1. 准备领域资料(文档、代码、规范)
|
||||
2. 将资料和 `auto-skill/SKILL.md` 一起提供给 AI
|
||||
3. AI 会生成针对该领域的专用 Skill
|
||||
|
||||
1. 准备领域资料(文档、代码、规范)。
|
||||
2. 将资料和 `auto-skill/SKILL.md` 一起提供给 AI。
|
||||
3. AI 会生成针对该领域的专用 Skill。
|
||||
|
||||
## 相关资源
|
||||
|
||||
- [元技能文件](./auto-skill/SKILL.md) - 生成、重构与校验 Skills
|
||||
- [提示词库](../prompts/) - 更细粒度的提示词集合
|
||||
- [文档库](../docs/) - 方法论与开发经验
|
||||
- [skills.sh](https://skills.sh/) - Skill 大全网站
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# CCXT Manual(外链)
|
||||
|
||||
本仓库未内置 CCXT 的完整 Manual 原文;请使用官方文档:
|
||||
|
||||
- Docs(推荐):https://docs.ccxt.com/
|
||||
- GitHub Wiki Manual:https://github.com/ccxt/ccxt/wiki/Manual
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
---
|
||||
name: ccxt
|
||||
description: "CCXT crypto exchange API skill: unified market data, order books, balances, order creation, sandbox mode, rate limits, verbose debugging, and exchange capability checks for JavaScript/Python/PHP trading automation."
|
||||
---
|
||||
|
||||
# ccxt Skill
|
||||
|
||||
Use this skill to implement or debug CCXT integrations against cryptocurrency exchanges while keeping exchange-specific behavior explicit and testable.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Trigger when any of these applies:
|
||||
- Fetching tickers, order books, trades, OHLCV, balances, markets, or exchange metadata through CCXT.
|
||||
- Creating, cancelling, or inspecting orders with the unified CCXT API.
|
||||
- Checking exchange capabilities with `exchange.has`, `exchange.features`, `loadMarkets()`, or market metadata.
|
||||
- Handling sandbox/testnet mode, rate limits, authentication, precision, contract size, or market-buy cost semantics.
|
||||
- Producing minimal reproducible debug reports with verbose HTTP request/response output.
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
- Not financial advice, strategy validation, custody guidance, or a guarantee that an exchange supports a specific feature.
|
||||
- Never run live orders before sandbox or dry-run validation; call `set_sandbox_mode(True)` immediately after exchange construction when supported.
|
||||
- Do not log, commit, or paste API keys, secrets, passphrases, cookies, or private wallet information.
|
||||
- Required inputs: language/runtime, exchange id, market symbol, operation type, sandbox/live mode, auth status, and exact error/verbose output.
|
||||
- Exchange APIs change independently; verify feature support against `exchange.has`, `exchange.features`, and the relevant reference file before production use.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Common Patterns
|
||||
|
||||
**Install CCXT for Python**
|
||||
```bash
|
||||
pip install ccxt
|
||||
```
|
||||
|
||||
**Create an exchange with built-in rate limiting**
|
||||
```python
|
||||
import ccxt
|
||||
|
||||
exchange = ccxt.binance({"enableRateLimit": True})
|
||||
```
|
||||
|
||||
**Enable sandbox mode before any other call**
|
||||
```python
|
||||
exchange = ccxt.binance({"apiKey": "KEY", "secret": "SECRET"})
|
||||
exchange.set_sandbox_mode(True)
|
||||
```
|
||||
|
||||
**Load and inspect markets**
|
||||
```python
|
||||
markets = exchange.load_markets()
|
||||
market = exchange.market("BTC/USDT")
|
||||
```
|
||||
|
||||
**Fetch one ticker instead of all tickers**
|
||||
```python
|
||||
ticker = exchange.fetch_ticker("BTC/USDT")
|
||||
```
|
||||
|
||||
**Fetch an order book for bid/ask work**
|
||||
```python
|
||||
book = exchange.fetch_order_book("BTC/USDT", limit=20)
|
||||
best_bid = book["bids"][0] if book["bids"] else None
|
||||
best_ask = book["asks"][0] if book["asks"] else None
|
||||
```
|
||||
|
||||
**Check capability before using an endpoint**
|
||||
```python
|
||||
if exchange.has.get("fetchOHLCV"):
|
||||
candles = exchange.fetch_ohlcv("BTC/USDT", timeframe="1m", limit=100)
|
||||
```
|
||||
|
||||
**Create a reduce-only order when supported by the exchange**
|
||||
```python
|
||||
params = {"reduceOnly": True}
|
||||
order = exchange.create_order("BTC/USDT:USDT", "limit", "sell", 1, 70000, params)
|
||||
```
|
||||
|
||||
**Debug with verbose request/response output**
|
||||
```python
|
||||
exchange.verbose = True
|
||||
exchange.fetch_balance()
|
||||
```
|
||||
|
||||
**Use async support in Python**
|
||||
```python
|
||||
import ccxt.async_support as ccxt
|
||||
|
||||
exchange = ccxt.binance({"enableRateLimit": True})
|
||||
try:
|
||||
await exchange.load_markets()
|
||||
finally:
|
||||
await exchange.close()
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Market Data Collector
|
||||
|
||||
- Input: exchange `binance`, symbol `BTC/USDT`, timeframe `1m`.
|
||||
- Steps:
|
||||
1. Instantiate with `enableRateLimit=True`.
|
||||
2. Call `load_markets()` once and verify `exchange.has["fetchOHLCV"]`.
|
||||
3. Fetch candles and persist timestamp, open, high, low, close, volume.
|
||||
- Expected output / acceptance: one normalized candle batch and no repeated `load_markets()` calls inside the polling loop.
|
||||
|
||||
### Example 2: Sandbox Order Flow
|
||||
|
||||
- Input: exchange with sandbox support, symbol, side, amount, price.
|
||||
- Steps:
|
||||
1. Create the exchange with credentials and immediately call sandbox mode.
|
||||
2. Load markets and inspect precision/limits for the symbol.
|
||||
3. Place a tiny limit order, fetch it by id, then cancel it.
|
||||
- Expected output / acceptance: order lifecycle succeeds in sandbox and no live order endpoint is touched.
|
||||
|
||||
### Example 3: Debug a Failing Exchange Call
|
||||
|
||||
- Input: an exception from `create_order()` or `fetch_balance()`.
|
||||
- Steps:
|
||||
1. Reduce code to a 5-20 line reproduction including exchange construction.
|
||||
2. Set `exchange.verbose = True` immediately before the failing call.
|
||||
3. Capture language version, CCXT version, exchange id, symbol, method, request, response, and full stack trace.
|
||||
- Expected output / acceptance: a reproducible report without secrets and with enough evidence to distinguish CCXT misuse from exchange API failure.
|
||||
|
||||
## References
|
||||
|
||||
- `references/index.md`: navigation for the CCXT reference set.
|
||||
- `references/manual.md`: unified API, markets, rate limits, orders, sandbox, and debugging.
|
||||
- `references/faq.md`: common trading/order pitfalls and issue-reporting requirements.
|
||||
- `references/exchanges.md`: exchange support and capability notes.
|
||||
- `references/pro.md`: CCXT Pro and WebSocket-oriented material.
|
||||
- `references/cli.md`: CCXT CLI usage.
|
||||
- `references/specification.md`: generated API/spec material.
|
||||
|
||||
## Maintenance
|
||||
|
||||
- Sources: local `references/` extracted from CCXT documentation.
|
||||
- Last updated: 2026-04-28
|
||||
- Known limits: exchange-specific parameters and capabilities must be verified per exchange; examples intentionally avoid live credentials.
|
||||
@@ -1,7 +0,0 @@
|
||||
# CCXT Manual(外链)
|
||||
|
||||
本仓库未在 `skills/ccxt/references/` 内维护 CCXT Manual 的镜像文件;请使用官方文档:
|
||||
|
||||
- Docs(推荐):https://docs.ccxt.com/
|
||||
- GitHub Wiki Manual:https://github.com/ccxt/ccxt/wiki/Manual
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
# Ccxt - Cli
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki/CLI
|
||||
|
||||
**Contents:**
|
||||
- CCXT CLI (Command-Line Interface)
|
||||
- Install globally
|
||||
- Install
|
||||
- Usage
|
||||
- Inspecting Exchange Properties
|
||||
- Calling A Unified Method By Name
|
||||
- Calling An Exchange-Specific Method By Name
|
||||
- Authentication And Overrides
|
||||
- Unified API vs Exchange-Specific API
|
||||
- Run with jq
|
||||
|
||||
CCXT includes an example that allows calling all exchange methods and properties from command line. One doesn't even have to be a programmer or write code – any user can use it!
|
||||
|
||||
The CLI interface is a program in CCXT that takes the exchange name and some params from the command line and executes a corresponding call from CCXT printing the output of the call back to the user. Thus, with CLI you can use CCXT out of the box, not a single line of code needed.
|
||||
|
||||
CCXT command line interface is very handy and useful for:
|
||||
|
||||
For the CCXT library users – we highly recommend to try CLI at least a few times to get a feel of it. For the CCXT library developers – CLI is more than just a recommendation, it's a must.
|
||||
|
||||
The best way to learn and understand CCXT CLI – is by experimentation, trial and error. Warning: CLI executes your command and does not ask for a confirmation after you launch it, so be careful with numbers, confusing amounts with prices can cause a loss of funds.
|
||||
|
||||
The same CLI design is implemented in all supported languages, TypeScript, JavaScript, Python and PHP – for the purposes of example code for the developers. In other words, the existing CLI contains three implementations that are in many ways identical. The code in those three CLI examples is intended to be "easily understandable".
|
||||
|
||||
The source code of the CLI is available here:
|
||||
|
||||
Clone the CCXT repository:
|
||||
|
||||
Change directory to the cloned repository:
|
||||
|
||||
Install the dependencies:
|
||||
|
||||
The CLI script requires at least one argument, that is, the exchange id (the list of supported exchanges and their ids). If you don't specify the exchange id, the script will print the list of all exchange ids for reference.
|
||||
|
||||
Upon launch, CLI will create and initialize the exchange instance and will also call exchange.loadMarkets() on that exchange. If you don't specify any other command-line arguments to CLI except the exchange id argument, then the CLI script will print out all the contents of the exchange object, including the list of all the methods and properties and all the loaded markets (the output may be extremely long in that case).
|
||||
|
||||
Normally, following the exchange id argument one would specify a method name to call with its arguments or an exchange property to inspect on the exchange instance.
|
||||
|
||||
If the only parameter you specify to CLI is the exchange id, then it will print out the contents of the exchange instance including all properties, methods, markets, currencies, etc. Warning: exchange contents are HUGE and this will dump A LOT of output to your screen!
|
||||
|
||||
You can specify the name of the property of the exchange to narrow the output down to a reasonable size.
|
||||
|
||||
You can easily view which methods are supported on the various exchanges:
|
||||
|
||||
Calling unified methods is easy:
|
||||
|
||||
Exchange specific parameters can be set in the last argument of every unified method:
|
||||
|
||||
Here's an example of fetching the order book on okx in sandbox mode using the implicit API and the exchange specific instId and sz parameters:
|
||||
|
||||
Public exchange APIs don't require authentication. You can use the CLI to call any method of a public API. The difference between public APIs and private APIs is described in the Manual, here: Public/Private API.
|
||||
|
||||
For private API calls, by default the CLI script will look for API keys in the keys.local.json file in the root of the repository cloned to your working directory and will also look up exchange credentials in the environment variables. More details here: Adding Exchange Credentials.
|
||||
|
||||
CLI supports all possible methods and properties that exist on the exchange instance.
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
@@ -1,29 +0,0 @@
|
||||
# Ccxt - Exchanges
|
||||
|
||||
**Pages:** 2
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki/Exchange-Markets
|
||||
|
||||
**Contents:**
|
||||
- Supported Exchanges
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki/Exchange-Markets-By-Country
|
||||
|
||||
**Contents:**
|
||||
- Exchanges By Country
|
||||
|
||||
The ccxt library currently supports the following cryptocurrency exchange markets and trading APIs:
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
@@ -1,111 +0,0 @@
|
||||
# Ccxt - Faq
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki/FAQ
|
||||
|
||||
**Contents:**
|
||||
- Frequently Asked Questions
|
||||
- I'm trying to run the code, but it's not working, how do I fix it?
|
||||
- What is required to get help?
|
||||
- I am calling a method and I get an error, what am I doing wrong?
|
||||
- I got an incorrect result from a method call, can you help?
|
||||
- Can you implement feature foo in exchange bar?
|
||||
- When will you add feature foo for exchange bar ? What's the estimated time? When should we expect this?
|
||||
- When will you add the support for an exchange requested in the Issues?
|
||||
- How long should I wait for a feature to be added? I need to decide whether to implement it myself or to wait for the CCXT Dev Team to implement it for me.
|
||||
- What's your progress on adding the feature foo that was requested earlier? How do you do implementing exchange bar?
|
||||
|
||||
If your question is formulated in a short manner like the above, we won't help. We don't teach programming. If you're unable to read and understand the Manual or you can't follow precisely the guides from the CONTRIBUTING doc on how to report an issue, we won't help either. Read the CONTRIBUTING guides on how to report an issue and read the Manual. You should not risk anyone's money and time without reading the entire Manual very carefully. You should not risk anything if you're not used to a lot of reading with tons of details. Also, if you don't have the confidence with the programming language you're using, there are much better places for coding fundamentals and practice. Search for python tutorials, js videos, play with examples, this is how other people climb up the learning curve. No shortcuts, if you want to learn something.
|
||||
|
||||
When asking a question:
|
||||
|
||||
Use the search button for duplicates first!
|
||||
|
||||
Post your request and response in verbose mode! Add exchange.verbose = true right before the line you're having issues with, and copypaste what you see on your screen. It's written and mentioned everywhere, in the Troubleshooting section, in the README and in many answers to similar questions among previous issues and pull requests. No excuses. The verbose output should include both the request and response from the exchange.
|
||||
|
||||
Include the full error callstack!
|
||||
|
||||
Write your programming language and language version number
|
||||
|
||||
Write the CCXT / CCXT Pro library version number
|
||||
|
||||
Which method you're trying to call
|
||||
|
||||
Post your code to reproduce the problem. Make it a complete short runnable program, don't swallow the lines and make it as compact as you can (5-10 lines of code), including the exchange instantation code. Remove all irrelevant parts from it, leaving just the essence of the code to reproduce the issue.
|
||||
|
||||
DO NOT POST YOUR apiKey AND secret! Keep them safe (remove them before posting)!
|
||||
|
||||
You're not reporting the issue properly ) Please, help the community to help you ) Read this and follow the steps: https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue. Once again, your code to reproduce the issue and your verbose request and response ARE REQUIRED. Just the error traceback, or just the response, or just the request, or just the code – is not enough!
|
||||
|
||||
Basically the same answer as the previous question. Read and follow precisely: https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue. Once again, your code to reproduce the issue and your verbose request and response ARE REQUIRED. Just the error traceback, or just the response, or just the request, or just the code – is not enough!
|
||||
|
||||
Yes, we can. And we will, if nobody else does that before us. There's very little point in asking this type of questions, because the answer is always positive. When someone asks if we can do this or that, the question is not about our abilities, it all boils down to time and management needed for implementing all accumulated feature requests.
|
||||
|
||||
Moreover, this is an open-source library which is a work in progress. This means, that this project is intended to be developed by the community of users, who are using it. What you're asking is not whether we can or cannot implement it, in fact you're actually telling us to go do that particular task and this is not how we see a voluntary collaboration. Your contributions, PRs and commits are welcome: https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code.
|
||||
|
||||
We don't give promises or estimates on the free open-source work. If you wish to speed it up, feel free to reach out to us via info@ccxt.trade.
|
||||
|
||||
We don't give promises or estimates on the open-source work. The reasoning behind this is explained in the previous paragraph.
|
||||
|
||||
Again, we can't promise on the dates for adding this or that exchange, due to reasons outlined above. The answer will always remain the same: as soon as we can.
|
||||
|
||||
Please, go for implemeting it yourself, do not wait for us. We will add it as soon as we can. Also, your contributions are very welcome:
|
||||
|
||||
This type of questions is usually a waste of time, because answering it usually requires too much time for context-switching, and it often takes more time to answer this question, than to actually satisfy the request with code for a new feature or a new exchange. The progress of this open-source project is also open, so, whenever you're wondering how it is doing, take a look into commit history.
|
||||
|
||||
If it is not merged, it means that the PR contains errors, that should be fixed first. If it could be merged as is – we would merge it, and you wouldn't have asked this question in the first place. The most frequent reason for not merging a PR is a violation of any of the CONTRIBUTING guidelines. Those guidelines should be taken literally, cannot skip a single line or word from there if you want your PR to be merged quickly. Code contributions that do not break the guidelines get merged almost immediately (usually, within hours).
|
||||
|
||||
Unfortunately, we don't always have the time to quickly list out each and every single error in the code that prevents it from merging. It is often easier and faster to just go and fix the error rather than explain what one should do to fix it. Most of them are already outlined in the CONTRIBUTING guidelines. The main rule of thumb is to follow all guidelines literally.
|
||||
|
||||
Our build system generates exchange-specific JavaScript, Python and PHP code for us automatically, so it is transpiled from TypeScript, and there's no need to fix all languages separately one by one.
|
||||
|
||||
Thus, if it is fixed in TypeScript, it is fixed in JavaScript NPM, Python pip and PHP Composer as well. The automatic build usually takes 15-20 minutes. Just upgrade your version with npm, pip or composer after the new version arrives and you'll be fine.
|
||||
|
||||
Some exchanges support createOrder with the additional "attached" stopLoss & takeProfit sub-orders - view StopLoss And TakeProfit Orders Attached To A Position. However, some exchanges might not support that feature and you will need to run separate createOrder methods to add conditional order (e.g. *trigger order | stoploss order | takeprofit order) to the already open position - view [Conditional orders](Manual.md#Conditional Orders). You can also check them by looking at exchange.has['createOrderWithTakeProfitAndStopLoss'], exchange.has['createStopLossOrder'] and exchange.has['createTakeProfitOrder'], however they are not as precise as .features property.
|
||||
|
||||
To create a market-buy order with cost, first, you need to check if the exchange supports that feature (exchange.has['createMarketBuyOrderWithCost']). If it does, then you can use the createMarketBuyOrderWithCost` method. Example:
|
||||
|
||||
Many exchanges require the amount to be in the quote currency (they don't accept the base amount) when placing spot-market buy orders. In those cases, the exchange will have the option createMarketBuyRequiresPrice set to true.
|
||||
|
||||
Example: If you wanted to buy BTC/USDT with a market buy-order, you would need to provide an amount = 5 USDT instead of 0.000X. We have a check to prevent errors that explicitly require the price because users will usually provide the amount in the base currency.
|
||||
|
||||
So by default, if you do, create_order(symbol, 'market,' 'buy,' 10) will throw an error if the exchange has that option (createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false...).
|
||||
|
||||
If the exchange requires the cost and the user provided the base amount, we need to request an extra parameter price and multiply them to get the cost. If you're aware of this behavior, you can simply disable createMarketBuyOrderRequiresPrice and pass the cost in the amount parameter, but disabling it does not mean you can place the order using the base amount instead of the quote.
|
||||
|
||||
If you do create_order(symbol, 'market', 'buy', 0.001, 20000) ccxt will use the required price to calculate the cost by doing 0.01*20000 and send that value to the exchange.
|
||||
|
||||
If you want to provide the cost directly in the amount argument, you can do exchange.options['createMarketBuyOrderRequiresPrice'] = False (you acknowledge that the amount will be the cost for market-buy) and then you can do create_order(symbol, 'market', 'buy', 10)
|
||||
|
||||
This is basically to avoid a user doing this: create_order('SHIB/USDT', market, buy, 1000000) and thinking he's trying to buy 1kk of shib but in reality he's buying 1kk USDT worth of SHIB. For that reason, by default ccxt always accepts the base currency in the amount parameter.
|
||||
|
||||
Alternatively, you can use the functions createMarketBuyOrderWithCost/ createMarketSellOrderWithCost if they are available.
|
||||
|
||||
See more: Market Buys
|
||||
|
||||
Spot trading involves buying or selling a financial instrument (like a cryptocurrency) for immediate delivery. It's straightforward, involving the direct exchange of assets.
|
||||
|
||||
Swap trading, on the other hand, involves derivative contracts where two parties exchange financial instruments or cash flows at a set date in the future, based on the underlying asset. Swaps are often used for leverage, speculation, or hedging and do not necessarily involve the exchange of the underlying asset until the contract expires.
|
||||
|
||||
Besides that, you will be handling contracts if you're trading swaps and not the base currency (e.g., BTC) directly, so if you create an order with amount = 1, the amount in BTC will vary depending on the contractSize. You can check the contract size by doing:
|
||||
|
||||
A reduceOnly order is a type of order that can only reduce a position, not increase it. To place a reduceOnly order, you typically use the createOrder method with a reduceOnly parameter set to true. This ensures that the order will only execute if it decreases the size of an open position, and it will either partially fill or not fill at all if executing it would increase the position size.
|
||||
|
||||
See more: Trailing Orders
|
||||
|
||||
To check the endpoint used by a unified method in the CCXT library, you would typically need to refer to the source code of the library for the specific exchange implementation you're interested in. The unified methods in CCXT abstract away the details of the specific endpoints they interact with, so this information is not directly exposed via the library's API. For detailed inspection, you can look at the implementation of the method for the particular exchange in the CCXT library's source code on GitHub.
|
||||
|
||||
See more: Unified API
|
||||
|
||||
The funding rate structure has three different funding rate values that can be returned:
|
||||
|
||||
As an example, say it is 12:30. The previousFundingRate happened at 12:00 and we're looking to see what the upcoming funding rate will be by checking the fundingRate value. In this example, given 4-hour intervals, the fundingRate will happen in the future at 4:00 and the nextFundingRate is the predicted rate that will happen at 8:00.
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
@@ -1,72 +0,0 @@
|
||||
# Ccxt - Getting Started
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki/Install
|
||||
|
||||
**Contents:**
|
||||
- Install
|
||||
- JavaScript (NPM)
|
||||
- JavaScript (for use with the <script> tag):
|
||||
- Custom JavaScript Builds
|
||||
- Python
|
||||
- PHP
|
||||
- .net/C#
|
||||
- Docker
|
||||
- Proxy
|
||||
|
||||
The easiest way to install the ccxt library is to use builtin package managers:
|
||||
|
||||
This library is shipped as an all-in-one module implementation with minimalistic dependencies and requirements:
|
||||
|
||||
You can also clone it into your project directory from ccxt GitHub repository and copy files manually into your working directory with language extension appropriate for your environment.
|
||||
|
||||
An alternative way of installing this library is to build a custom bundle from source. Choose exchanges you need in exchanges.cfg.
|
||||
|
||||
JavaScript version of ccxt works both in Node and web browsers. Requires ES6 and async/await syntax support (Node 15+). When compiling with Webpack and Babel, make sure it is not excluded in your babel-loader config.
|
||||
|
||||
ccxt crypto trading library in npm
|
||||
|
||||
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
||||
|
||||
You can obtain a live-updated version of the bundle by removing the version number from the URL (the @a.b.c thing) or the /latest/ on our cdn — however, we do not recommend to do that, as it may break your app eventually. Also, please keep in mind that we are not responsible for the correct operation of those CDN servers.
|
||||
|
||||
We also provide webpack minified and tree-shaken versions of the library starting from version 3.0.35 - Visit https://cdn.ccxt.com to browse the prebundled versions we distribute.
|
||||
|
||||
Note: the file sizes are subject to change.
|
||||
|
||||
Here is an example using a custom bybit bundle from our cdn in the browser
|
||||
|
||||
The default entry point for the browser is window.ccxt and it creates a global ccxt object:
|
||||
|
||||
It takes time to load all scripts and resources. The problem with in-browser usage is that the entire CCXT library weighs a few megabytes which is a lot for a web application. Sometimes it is also critical for a Node app. Therefore to lower the loading time you might want to make your own custom build of CCXT for your app with just the exchanges you need. CCXT uses webpack to remove dead code paths to make the package smaller.
|
||||
|
||||
ccxt algotrading library in PyPI
|
||||
|
||||
The library supports concurrent asynchronous mode with asyncio and async/await in Python 3.5.3+
|
||||
|
||||
The autoloadable version of ccxt can be installed with Packagist/Composer (PHP 8.1+).
|
||||
|
||||
It can also be installed from the source code: ccxt.php
|
||||
|
||||
It requires common PHP modules:
|
||||
|
||||
The library supports concurrent asynchronous mode using tools from ReactPHP in PHP 8.1+. Read the Manual for more details.
|
||||
|
||||
ccxt in C# with Nugget (netstandard 2.0 and netstandard 2.1)
|
||||
|
||||
You can get CCXT installed in a container along with all the supported languages and dependencies. This may be useful if you want to contribute to CCXT (e.g. run the build scripts and tests — please see the Contributing document for the details on that).
|
||||
|
||||
You don't need the Docker image if you're not going to develop CCXT. If you just want to use CCXT – just install it as a regular package into your project.
|
||||
|
||||
Using docker-compose (in the cloned CCXT repository):
|
||||
|
||||
If you are unable to obtain data from exchanges due to location restrictions read the proxy section.
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
@@ -1,35 +0,0 @@
|
||||
# Ccxt Documentation Index
|
||||
|
||||
## Categories
|
||||
|
||||
### Cli
|
||||
**File:** `cli.md`
|
||||
**Pages:** 1
|
||||
|
||||
### Exchanges
|
||||
**File:** `exchanges.md`
|
||||
**Pages:** 2
|
||||
|
||||
### Faq
|
||||
**File:** `faq.md`
|
||||
**Pages:** 1
|
||||
|
||||
### Getting Started
|
||||
**File:** `getting_started.md`
|
||||
**Pages:** 1
|
||||
|
||||
### Manual
|
||||
**File:** `manual.md`
|
||||
**Pages:** 2
|
||||
|
||||
### Other
|
||||
**File:** `other.md`
|
||||
**Pages:** 1
|
||||
|
||||
### Pro
|
||||
**File:** `pro.md`
|
||||
**Pages:** 1
|
||||
|
||||
### Specification
|
||||
**File:** `specification.md`
|
||||
**Pages:** 2
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
# Ccxt - Other
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki
|
||||
|
||||
**Contents:**
|
||||
- General Information
|
||||
- How To Install
|
||||
- How To Use
|
||||
- WebSocket Support
|
||||
- Troubleshooting
|
||||
- Examples
|
||||
- New Exchanges
|
||||
- API Reference
|
||||
|
||||
Welcome to the ccxt wiki!
|
||||
|
||||
We recommend to visit our full documentation at https://docs.ccxt.com
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
@@ -1,18 +0,0 @@
|
||||
# Ccxt - Pro
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki/ccxt.pro
|
||||
|
||||
**Contents:**
|
||||
- CCXT Pro
|
||||
|
||||
CCXT supports WebSockets (Pro part) for many exchanges.
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
@@ -1,44 +0,0 @@
|
||||
# Ccxt - Specification
|
||||
|
||||
**Pages:** 2
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki/Requirements
|
||||
|
||||
**Contents:**
|
||||
- CCXT Integration Requirements
|
||||
- Public API
|
||||
- Exchange Information, Fee Schedule and Trading Rules
|
||||
- Market Data
|
||||
- Private API
|
||||
- Trading
|
||||
- Trading History
|
||||
- Funding
|
||||
|
||||
The exchange is required to implement the following list of methods and structures in order to get integrated with CCXT.
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
|
||||
## Search code, repositories, users, issues, pull requests...
|
||||
|
||||
**URL:** https://github.com/ccxt/ccxt/wiki/Certification
|
||||
|
||||
**Contents:**
|
||||
- CCXT Certification Program ·
|
||||
- Requirements
|
||||
- Contact Us
|
||||
|
||||
The structure of CCXT defines a good, portable and cross-compatible standard for exchanges' API interfaces, that is implemented in the CCXT Unified API. Exchanges are welcome to apply for our certification program. Certification is technically supervised and quality-assured by members of the CCXT Dev Team. That implies that an exchange having a "certified" badge is properly implemented and tested by the authors of CCXT. Certification means less bugs, more functionality, priority support and a much more stable and efficient implementation in general.
|
||||
|
||||
Getting integrated and certified requires the exchange to implement a quality API. Please, see the full list of technical requirements here: https://github.com/ccxt/ccxt/wiki/Requirements
|
||||
|
||||
For inquiries on getting your exchange integrated, listed and certified: info@ccxt.trade
|
||||
|
||||
(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
|
||||
|
||||
---
|
||||
@@ -1,106 +0,0 @@
|
||||
---
|
||||
name: claude-code-guide
|
||||
description: "Claude Code guide skill: CLI workflows, project context, tool permissions, slash commands, hooks, MCP, large-file analysis, debugging, and advanced coding-agent operating patterns."
|
||||
---
|
||||
|
||||
# claude-code-guide Skill
|
||||
|
||||
Use this skill to answer Claude Code workflow questions and to turn the long Chinese guide in `references/README.md` into focused operating steps.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Trigger when any of these applies:
|
||||
- Learning or explaining Claude Code CLI workflows, command habits, or project-context handling.
|
||||
- Designing slash commands, hooks, MCP integrations, memory/context conventions, or task workflows.
|
||||
- Debugging Claude Code permission, tool-use, file analysis, or large-context problems.
|
||||
- Comparing interactive coding-agent patterns such as explore-plan-edit-verify, review loops, or multi-agent coordination.
|
||||
- Extracting a compact answer from the full Claude Code guide in `references/README.md`.
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
- Not the source of truth for current Claude product availability, pricing, or model names; verify those with official Anthropic docs when exact current behavior matters.
|
||||
- Not for bypassing tool permissions, sandbox rules, repository policies, or higher-priority system/developer instructions.
|
||||
- Do not treat the long guide as automatically correct for every Claude Code version; use it as local project reference material.
|
||||
- Required inputs: target workflow, OS/shell, Claude Code version if relevant, current repository constraints, and the exact error or behavior observed.
|
||||
- If a command may mutate files or external systems, identify the blast radius and validation path before recommending it.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Common Patterns
|
||||
|
||||
**Start with project context**
|
||||
```text
|
||||
Read README/AGENTS/CONTRIBUTING, inspect git status, then search for local patterns before editing.
|
||||
```
|
||||
|
||||
**Large-file triage**
|
||||
```bash
|
||||
wc -l path/to/file.md
|
||||
rg -n '^#{1,6} ' path/to/file.md
|
||||
sed -n '1,120p' path/to/file.md
|
||||
```
|
||||
|
||||
**Slash command authoring shape**
|
||||
```text
|
||||
.claude/commands/<command-name>.md
|
||||
```
|
||||
|
||||
**Hook design checklist**
|
||||
```text
|
||||
event -> allowed command -> timeout -> logging -> rollback/disable path
|
||||
```
|
||||
|
||||
**MCP integration checklist**
|
||||
```text
|
||||
server name -> command/env -> auth source -> minimal permission -> smoke test
|
||||
```
|
||||
|
||||
**Debug a Claude Code failure**
|
||||
```text
|
||||
Capture: command, working directory, permission mode, exact error, relevant config, and smallest reproduction.
|
||||
```
|
||||
|
||||
**Context hygiene rule**
|
||||
```text
|
||||
Keep entry prompts short; move long references to files and load only the needed section.
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Add a Custom Slash Command
|
||||
|
||||
- Input: user wants a repeatable `/review-pr` workflow.
|
||||
- Steps:
|
||||
1. Create or update `.claude/commands/review-pr.md` with scope, required inputs, and output format.
|
||||
2. Reference repository review rules instead of duplicating stale policy text.
|
||||
3. Test the command on a small diff and refine ambiguous steps.
|
||||
- Expected output / acceptance: command is discoverable, deterministic, and does not bypass repo review constraints.
|
||||
|
||||
### Example 2: Diagnose a Permission Problem
|
||||
|
||||
- Input: Claude Code refuses to run or edit a file.
|
||||
- Steps:
|
||||
1. Identify whether the blocker is tool permission, filesystem sandbox, repository policy, or OS permissions.
|
||||
2. Capture the exact path, command, and error.
|
||||
3. Propose the least-permissive fix and a smoke test.
|
||||
- Expected output / acceptance: user gets a concrete unblock path without granting broad unnecessary access.
|
||||
|
||||
### Example 3: Summarize a Long Guide Section
|
||||
|
||||
- Input: need the MCP section from `references/README.md`.
|
||||
- Steps:
|
||||
1. Use heading search to locate the section.
|
||||
2. Read only the relevant slice.
|
||||
3. Return a short operator checklist plus links back to the local reference file.
|
||||
- Expected output / acceptance: answer is actionable and avoids dumping the full long document.
|
||||
|
||||
## References
|
||||
|
||||
- `references/index.md`: structured navigation for the guide.
|
||||
- `references/README.md`: long-form Claude Code Chinese guide.
|
||||
|
||||
## Maintenance
|
||||
|
||||
- Sources: local `references/README.md` and `references/index.md`.
|
||||
- Last updated: 2026-04-28
|
||||
- Known limits: Claude Code behavior can change; verify current CLI flags, hooks, and MCP details against official docs when precision matters.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,328 +0,0 @@
|
||||
# Claude Code 高级开发指南文档索引
|
||||
|
||||
## 文档概览
|
||||
|
||||
### README.md
|
||||
**文件:** `README.md`
|
||||
**行数:** 9,594 行
|
||||
**语言:** 中文
|
||||
|
||||
这是一份极其详细和全面的 Claude Code 学习指南,涵盖从基础到高级的所有内容。
|
||||
|
||||
## 主要章节
|
||||
|
||||
### 1. 快速导航与参考
|
||||
- 即时命令参考
|
||||
- 功能快速参考
|
||||
- 高级用户快捷方式
|
||||
- 任务状态参考
|
||||
- 常见工作流卡片
|
||||
|
||||
### 2. 核心智能系统
|
||||
- Claude 工具的关键发现
|
||||
- 高级 REPL 协同模式
|
||||
- 专用内核架构集成
|
||||
- 元待办事项系统
|
||||
- 高级协同实现
|
||||
|
||||
### 3. 核心概念
|
||||
- 7 个核心工具详解
|
||||
- 权限系统
|
||||
- 项目上下文
|
||||
- 内存管理
|
||||
- 文件操作
|
||||
|
||||
### 4. 斜杠命令系统
|
||||
- 系统命令
|
||||
- 自定义命令
|
||||
- 命令模板
|
||||
- 命令组织
|
||||
|
||||
### 5. 钩子系统
|
||||
- 钩子类型
|
||||
- 事件触发
|
||||
- 安全模式
|
||||
- 自动化工作流
|
||||
|
||||
### 6. MCP 集成
|
||||
- MCP 服务器配置
|
||||
- OAuth 认证
|
||||
- 外部系统集成
|
||||
- 子代理使用
|
||||
|
||||
### 7. 开发工作流
|
||||
- 文件分析工作流
|
||||
- 算法验证工作流
|
||||
- 数据探索工作流
|
||||
- 任务管理模式
|
||||
|
||||
### 8. 质量保证
|
||||
- 自动化测试
|
||||
- 代码审查
|
||||
- 多代理协作
|
||||
- 验证策略
|
||||
|
||||
### 9. 错误恢复
|
||||
- 常见错误模式
|
||||
- 渐进式修复
|
||||
- 调试技巧
|
||||
- 问题诊断
|
||||
|
||||
### 10. 实用示例
|
||||
- 数据分析
|
||||
- 文件处理
|
||||
- API 集成
|
||||
- 可视化创建
|
||||
- 测试自动化
|
||||
|
||||
### 11. 高级模式
|
||||
- 研究系统
|
||||
- Smart Flows
|
||||
- 认知方法
|
||||
- 多代理编排
|
||||
|
||||
### 12. 最佳实践
|
||||
- 开发原则
|
||||
- 工具使用
|
||||
- 性能优化
|
||||
- 代码质量
|
||||
|
||||
### 13. 故障排除
|
||||
- 常见问题
|
||||
- 解决方案
|
||||
- 诊断步骤
|
||||
- 工具调试
|
||||
|
||||
### 14. 安全考虑
|
||||
- 沙箱模型
|
||||
- 权限管理
|
||||
- 安全审计
|
||||
- 最佳安全实践
|
||||
|
||||
### 15. 工具协同掌握
|
||||
- 工具组合模式
|
||||
- 高级集成
|
||||
- 性能优化
|
||||
- 实战案例
|
||||
|
||||
## 核心工具详解
|
||||
|
||||
### 1. REPL (JavaScript 运行时)
|
||||
- 完整 ES6+ 支持
|
||||
- 预加载 5 个库:
|
||||
- D3.js (数据可视化)
|
||||
- MathJS (数学计算)
|
||||
- Lodash (实用工具)
|
||||
- Papaparse (CSV 解析)
|
||||
- SheetJS (Excel 处理)
|
||||
- 异步支持 (async/await)
|
||||
- BigInt 支持
|
||||
- WebAssembly 支持
|
||||
- 文件读取能力
|
||||
|
||||
### 2. Artifacts (可视化输出)
|
||||
- React 组件
|
||||
- Three.js 3D 渲染
|
||||
- HTML/SVG 生成
|
||||
- 图表和可视化
|
||||
- 交互式界面
|
||||
|
||||
### 3. Web Search (网络搜索)
|
||||
- 搜索网络内容
|
||||
- 域名过滤
|
||||
- 仅美国可用
|
||||
|
||||
### 4. Web Fetch (内容获取)
|
||||
- 获取网页内容
|
||||
- HTML 转 Markdown
|
||||
- 内容提取
|
||||
|
||||
### 5. Conversation Search (对话搜索)
|
||||
- 搜索历史对话
|
||||
- 上下文检索
|
||||
|
||||
### 6. Recent Chats (最近对话)
|
||||
- 访问最近会话
|
||||
- 对话历史管理
|
||||
|
||||
### 7. End Conversation (结束对话)
|
||||
- 会话清理
|
||||
- 对话总结
|
||||
|
||||
## 大文件分析方法论
|
||||
|
||||
指南提供系统化的大文件处理方法:
|
||||
|
||||
### 第一阶段:定量评估
|
||||
使用 `wc` 命令确定文件规模
|
||||
|
||||
### 第二阶段:结构分析
|
||||
使用 `grep` 提取结构信息
|
||||
|
||||
### 第三阶段:内容提取
|
||||
使用 `Read` 工具战略性采样
|
||||
|
||||
## REPL 高级用法
|
||||
|
||||
### 数据科学能力
|
||||
- 处理 100,000+ 元素数组
|
||||
- 统计分析
|
||||
- 数据转换
|
||||
- 可视化准备
|
||||
|
||||
### 预加载库示例
|
||||
```javascript
|
||||
// Lodash
|
||||
_.chunk([1,2,3,4], 2)
|
||||
|
||||
// MathJS
|
||||
math.sqrt(16)
|
||||
|
||||
// D3.js
|
||||
d3.range(10)
|
||||
|
||||
// Papaparse
|
||||
Papa.parse(csvData)
|
||||
|
||||
// SheetJS
|
||||
XLSX.read(data)
|
||||
```
|
||||
|
||||
## 工作流模式
|
||||
|
||||
### 文件分析工作流
|
||||
探索 → 理解 → 实现
|
||||
|
||||
### 算法验证工作流
|
||||
设计 → 验证 → 实现
|
||||
|
||||
### 数据探索工作流
|
||||
检查 → 分析 → 可视化
|
||||
|
||||
### 质量保证工作流
|
||||
测试 → 审查 → 优化
|
||||
|
||||
## MCP 集成详解
|
||||
|
||||
### 配置文件位置
|
||||
`~/.config/claude/mcp_config.json`
|
||||
|
||||
### MCP 服务器类型
|
||||
- API 集成服务器
|
||||
- 数据库连接服务器
|
||||
- 文件系统服务器
|
||||
- 自定义工具服务器
|
||||
|
||||
### 认证方式
|
||||
- API 密钥
|
||||
- OAuth 2.0
|
||||
- 环境变量
|
||||
- 配置文件
|
||||
|
||||
## 钩子系统
|
||||
|
||||
### 钩子触发时机
|
||||
- 工具使用前/后
|
||||
- 用户提示提交
|
||||
- 文件修改
|
||||
- 命令执行
|
||||
|
||||
### 钩子用途
|
||||
- 代码格式化
|
||||
- 自动测试
|
||||
- Git 操作
|
||||
- 日志记录
|
||||
- 通知发送
|
||||
|
||||
## 高级模式
|
||||
|
||||
### 多代理协作
|
||||
- 主代理编排
|
||||
- 子代理专门化
|
||||
- 结果聚合
|
||||
- 任务分解
|
||||
|
||||
### 智能任务管理
|
||||
- 任务创建
|
||||
- 状态追踪
|
||||
- 进度报告
|
||||
- 优先级管理
|
||||
|
||||
### 认知增强
|
||||
- 记忆利用
|
||||
- 上下文管理
|
||||
- 知识整合
|
||||
- 推理优化
|
||||
|
||||
## 最佳实践总结
|
||||
|
||||
### 开发原则
|
||||
1. 清晰优先
|
||||
2. 渐进实现
|
||||
3. 持续验证
|
||||
4. 适当抽象
|
||||
|
||||
### 工具使用原则
|
||||
1. 选择正确工具
|
||||
2. 组合工具能力
|
||||
3. 最小化权限
|
||||
4. 处理错误
|
||||
|
||||
### 性能优化原则
|
||||
1. 批量操作
|
||||
2. 增量处理
|
||||
3. 缓存结果
|
||||
4. 异步优先
|
||||
|
||||
## 安全注意事项
|
||||
|
||||
### 沙箱隔离
|
||||
每个工具在独立沙箱中运行
|
||||
|
||||
### 权限管理
|
||||
- 自动授予权限的工具
|
||||
- 需要授权的工具
|
||||
- 权限最小化原则
|
||||
|
||||
### 敏感数据处理
|
||||
- 不要共享 API 密钥
|
||||
- 不要提交密码
|
||||
- 使用环境变量
|
||||
- 定期审计配置
|
||||
|
||||
## 快速链接
|
||||
|
||||
- **GitHub**: https://github.com/karminski/claude-code-guide-study
|
||||
- **原始版本**: https://github.com/Cranot/claude-code-guide
|
||||
- **Star 数**: 444+
|
||||
- **Fork 数**: 174+
|
||||
|
||||
## 使用建议
|
||||
|
||||
这份指南内容极其丰富(9,594 行),建议:
|
||||
|
||||
1. **初学者**: 从核心概念开始
|
||||
2. **中级用户**: 关注开发工作流
|
||||
3. **高级用户**: 深入高级模式
|
||||
4. **问题解决**: 查看故障排除章节
|
||||
|
||||
## 特色内容
|
||||
|
||||
### 系统化大文件分析
|
||||
详细的三阶段方法论
|
||||
|
||||
### REPL 深度解析
|
||||
超越基础的高级用法
|
||||
|
||||
### MCP 完整指南
|
||||
从配置到实战
|
||||
|
||||
### 多代理编排
|
||||
高级协作模式
|
||||
|
||||
### 认知增强策略
|
||||
提升 Claude 能力的方法
|
||||
|
||||
---
|
||||
|
||||
**这是目前最全面的 Claude Code 中文学习资源!**
|
||||
@@ -1,127 +0,0 @@
|
||||
---
|
||||
name: claude-cookbooks
|
||||
description: "Claude cookbooks skill: Claude API examples for messages, tool use, vision, RAG, summarization, text-to-SQL, prompt caching, agents, multimodal workflows, and third-party integrations."
|
||||
---
|
||||
|
||||
# claude-cookbooks Skill
|
||||
|
||||
Use this skill to turn cookbook material into runnable Claude API integration patterns while keeping model/version assumptions explicit.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Trigger when any of these applies:
|
||||
- Building applications that call the Claude API.
|
||||
- Implementing tool use/function calling, structured outputs, RAG, summarization, classification, or text-to-SQL.
|
||||
- Working with multimodal inputs such as images and document extraction.
|
||||
- Exploring prompt caching, agents, sub-agent patterns, or third-party integrations.
|
||||
- Looking up cookbook examples stored in `references/` and adapting them to a project.
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
- Not the source of truth for latest Anthropic models, pricing, limits, or API changes; verify current API details with official docs when exact current behavior matters.
|
||||
- Do not hard-code API keys or leak prompts containing private user data.
|
||||
- Cookbook examples are starting points, not production architecture; add retries, timeouts, observability, evals, and security checks.
|
||||
- Required inputs: language/runtime, use case, model policy from the project, data sensitivity, expected output schema, and failure handling requirements.
|
||||
- If local references conflict with current official docs, prefer the official docs and update the reference notes.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Common Patterns
|
||||
|
||||
**Basic Messages API shape**
|
||||
```python
|
||||
import anthropic
|
||||
|
||||
client = anthropic.Anthropic(api_key="YOUR_API_KEY")
|
||||
response = client.messages.create(
|
||||
model="YOUR_APPROVED_MODEL",
|
||||
max_tokens=1024,
|
||||
messages=[{"role": "user", "content": "Hello"}],
|
||||
)
|
||||
```
|
||||
|
||||
**Tool definition shape**
|
||||
```python
|
||||
tools = [{
|
||||
"name": "get_weather",
|
||||
"description": "Get current weather for a location.",
|
||||
"input_schema": {
|
||||
"type": "object",
|
||||
"properties": {"location": {"type": "string"}},
|
||||
"required": ["location"],
|
||||
},
|
||||
}]
|
||||
```
|
||||
|
||||
**Vision content shape**
|
||||
```python
|
||||
content = [
|
||||
{"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": base64_image}},
|
||||
{"type": "text", "text": "Describe the image."},
|
||||
]
|
||||
```
|
||||
|
||||
**Prompt caching shape**
|
||||
```python
|
||||
system = [{
|
||||
"type": "text",
|
||||
"text": "Large stable system prompt...",
|
||||
"cache_control": {"type": "ephemeral"},
|
||||
}]
|
||||
```
|
||||
|
||||
**RAG pipeline skeleton**
|
||||
```text
|
||||
ingest -> chunk -> embed/index -> retrieve -> rerank/filter -> answer with citations -> evaluate
|
||||
```
|
||||
|
||||
**Production hardening checklist**
|
||||
```text
|
||||
timeouts, retries, redaction, structured logging, eval set, cost guard, rate-limit handling
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Add Tool Use to an App
|
||||
|
||||
- Input: user asks for weather lookup through Claude.
|
||||
- Steps:
|
||||
1. Define a JSON schema for `get_weather`.
|
||||
2. Send the user request with the tool definition.
|
||||
3. Execute only validated tool calls and return tool results to the model.
|
||||
- Expected output / acceptance: tool arguments pass schema validation and no unapproved function is called.
|
||||
|
||||
### Example 2: Build a RAG Answerer
|
||||
|
||||
- Input: local product docs and user questions.
|
||||
- Steps:
|
||||
1. Chunk and index documents with stable IDs.
|
||||
2. Retrieve relevant chunks for each question.
|
||||
3. Ask Claude to answer only from retrieved evidence and cite chunk IDs.
|
||||
- Expected output / acceptance: unsupported claims are refused or marked unknown, and answers include source references.
|
||||
|
||||
### Example 3: Vision Extraction
|
||||
|
||||
- Input: screenshot or document image.
|
||||
- Steps:
|
||||
1. Convert image to supported media type and base64.
|
||||
2. Send image plus extraction instructions.
|
||||
3. Validate returned fields against the expected schema.
|
||||
- Expected output / acceptance: extracted data is structured, missing fields are explicit, and raw sensitive images are not logged.
|
||||
|
||||
## References
|
||||
|
||||
- `references/index.md`: navigation for cookbook topics.
|
||||
- `references/main_readme.md` and `references/README.md`: upstream overview material.
|
||||
- `references/tool_use.md`: tool-use examples.
|
||||
- `references/capabilities.md`: classification, RAG, summarization, and text-to-SQL.
|
||||
- `references/multimodal.md`: image and multimodal examples.
|
||||
- `references/patterns.md`: agents, caching, and advanced patterns.
|
||||
- `references/third_party.md`: vector DB and external integrations.
|
||||
- `scripts/memory_tool.py`: local helper script retained from the cookbook material.
|
||||
|
||||
## Maintenance
|
||||
|
||||
- Sources: local `references/` extracted from Anthropic cookbook material.
|
||||
- Last updated: 2026-04-28
|
||||
- Known limits: examples may carry older model names; replace with the project-approved current model before use.
|
||||
@@ -1,225 +0,0 @@
|
||||
# Contributing to Claude Cookbooks
|
||||
|
||||
Thank you for your interest in contributing to the Claude Cookbooks! This guide will help you get started with development and ensure your contributions meet our quality standards.
|
||||
|
||||
## Development Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Python 3.11 or higher
|
||||
- [uv](https://docs.astral.sh/uv/) package manager (recommended) or pip
|
||||
|
||||
### Quick Start
|
||||
|
||||
1. **Install uv** (recommended package manager):
|
||||
```bash
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
```
|
||||
|
||||
Or with Homebrew:
|
||||
```bash
|
||||
brew install uv
|
||||
```
|
||||
|
||||
2. **Clone the repository**:
|
||||
```bash
|
||||
git clone https://github.com/anthropics/anthropic-cookbook.git
|
||||
cd anthropic-cookbook
|
||||
```
|
||||
|
||||
3. **Set up the development environment**:
|
||||
```bash
|
||||
# Create virtual environment and install dependencies
|
||||
uv sync --all-extras
|
||||
|
||||
# Or with pip:
|
||||
pip install -e ".[dev]"
|
||||
```
|
||||
|
||||
4. **Install pre-commit hooks**:
|
||||
```bash
|
||||
uv run pre-commit install
|
||||
# Or: pre-commit install
|
||||
```
|
||||
|
||||
5. **Set up your API key**:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env and add your Claude API key
|
||||
```
|
||||
|
||||
## Quality Standards
|
||||
|
||||
This repository uses automated tools to maintain code quality:
|
||||
|
||||
### The Notebook Validation Stack
|
||||
|
||||
- **[nbconvert](https://nbconvert.readthedocs.io/)**: Notebook execution for testing
|
||||
- **[ruff](https://docs.astral.sh/ruff/)**: Fast Python linter and formatter with native Jupyter support
|
||||
- **Claude AI Review**: Intelligent code review using Claude
|
||||
|
||||
**Note**: Notebook outputs are intentionally kept in this repository as they demonstrate expected results for users.
|
||||
|
||||
### Claude Code Slash Commands
|
||||
|
||||
This repository includes slash commands that work in both Claude Code (for local development) and GitHub Actions CI. These commands are automatically available when you work in this repository with Claude Code.
|
||||
|
||||
**Available Commands**:
|
||||
- `/link-review` - Validate links in markdown and notebooks
|
||||
- `/model-check` - Verify Claude model usage is current
|
||||
- `/notebook-review` - Comprehensive notebook quality check
|
||||
|
||||
**Usage in Claude Code**:
|
||||
```bash
|
||||
# Run the same validations that CI will run
|
||||
/notebook-review skills/my-notebook.ipynb
|
||||
/model-check
|
||||
/link-review README.md
|
||||
```
|
||||
|
||||
These commands use the exact same validation logic as our CI pipeline, helping you catch issues before pushing. The command definitions are stored in `.claude/commands/` for both local and CI use.
|
||||
|
||||
### Before Committing
|
||||
|
||||
1. **Run quality checks**:
|
||||
```bash
|
||||
uv run ruff check skills/ --fix
|
||||
uv run ruff format skills/
|
||||
|
||||
uv run python scripts/validate_notebooks.py
|
||||
```
|
||||
|
||||
3. **Test notebook execution** (optional, requires API key):
|
||||
```bash
|
||||
uv run jupyter nbconvert --to notebook \
|
||||
--execute skills/classification/guide.ipynb \
|
||||
--ExecutePreprocessor.kernel_name=python3 \
|
||||
--output test_output.ipynb
|
||||
```
|
||||
|
||||
### Pre-commit Hooks
|
||||
|
||||
Pre-commit hooks will automatically run before each commit to ensure code quality:
|
||||
|
||||
- Format code with ruff
|
||||
- Validate notebook structure
|
||||
|
||||
If a hook fails, fix the issues and try committing again.
|
||||
|
||||
## Contribution Guidelines
|
||||
|
||||
### Notebook Best Practices
|
||||
|
||||
1. **Use environment variables for API keys**:
|
||||
```python
|
||||
import os
|
||||
api_key = os.environ.get("ANTHROPIC_API_KEY")
|
||||
```
|
||||
|
||||
2. **Use current Claude models**:
|
||||
- Use model aliases for better maintainability when available
|
||||
- Latest Haiku model: `claude-haiku-4-5-20251001` (Haiku 4.5)
|
||||
- Check current models at: https://docs.claude.com/en/docs/about-claude/models/overview
|
||||
- Claude will automatically validate model usage in PR reviews
|
||||
|
||||
3. **Keep notebooks focused**:
|
||||
- One concept per notebook
|
||||
- Clear explanations and comments
|
||||
- Include expected outputs as markdown cells
|
||||
|
||||
4. **Test your notebooks**:
|
||||
- Ensure they run from top to bottom without errors
|
||||
- Use minimal tokens for example API calls
|
||||
- Include error handling
|
||||
|
||||
### Git Workflow
|
||||
|
||||
1. **Create a feature branch**:
|
||||
```bash
|
||||
git checkout -b <your-name>/<feature-description>
|
||||
# Example: git checkout -b alice/add-rag-example
|
||||
```
|
||||
|
||||
2. **Use conventional commits**:
|
||||
```bash
|
||||
# Format: <type>(<scope>): <subject>
|
||||
|
||||
# Types:
|
||||
feat # New feature
|
||||
fix # Bug fix
|
||||
docs # Documentation
|
||||
style # Formatting
|
||||
refactor # Code restructuring
|
||||
test # Tests
|
||||
chore # Maintenance
|
||||
ci # CI/CD changes
|
||||
|
||||
# Examples:
|
||||
git commit -m "feat(skills): add text-to-sql notebook"
|
||||
git commit -m "fix(api): use environment variable for API key"
|
||||
git commit -m "docs(readme): update installation instructions"
|
||||
```
|
||||
|
||||
3. **Keep commits atomic**:
|
||||
- One logical change per commit
|
||||
- Write clear, descriptive messages
|
||||
- Reference issues when applicable
|
||||
|
||||
4. **Push and create PR**:
|
||||
```bash
|
||||
git push -u origin your-branch-name
|
||||
gh pr create # Or use GitHub web interface
|
||||
```
|
||||
|
||||
### Pull Request Guidelines
|
||||
|
||||
1. **PR Title**: Use conventional commit format
|
||||
2. **Description**: Include:
|
||||
- What changes you made
|
||||
- Why you made them
|
||||
- How to test them
|
||||
- Related issue numbers
|
||||
3. **Keep PRs focused**: One feature/fix per PR
|
||||
4. **Respond to feedback**: Address review comments promptly
|
||||
|
||||
## Testing
|
||||
|
||||
### Local Testing
|
||||
|
||||
Run the validation suite:
|
||||
|
||||
```bash
|
||||
# Check all notebooks
|
||||
uv run python scripts/validate_notebooks.py
|
||||
|
||||
# Run pre-commit on all files
|
||||
uv run pre-commit run --all-files
|
||||
```
|
||||
|
||||
### CI/CD
|
||||
|
||||
Our GitHub Actions workflows will automatically:
|
||||
|
||||
- Validate notebook structure
|
||||
- Lint code with ruff
|
||||
- Test notebook execution (for maintainers)
|
||||
- Check links
|
||||
- Claude reviews code and model usage
|
||||
|
||||
External contributors will have limited API testing to conserve resources.
|
||||
|
||||
## Getting Help
|
||||
|
||||
- **Issues**: [GitHub Issues](https://github.com/anthropics/anthropic-cookbook/issues)
|
||||
- **Discussions**: [GitHub Discussions](https://github.com/anthropics/anthropic-cookbook/discussions)
|
||||
- **Discord**: [Anthropic Discord](https://www.anthropic.com/discord)
|
||||
|
||||
## Security
|
||||
|
||||
- Never commit API keys or secrets
|
||||
- Use environment variables for sensitive data
|
||||
- Report security issues privately to security@anthropic.com
|
||||
|
||||
## License
|
||||
|
||||
By contributing, you agree that your contributions will be licensed under the same license as the project (MIT License).
|
||||
@@ -1,68 +0,0 @@
|
||||
# Claude Cookbooks
|
||||
|
||||
The Claude Cookbooks provide code and guides designed to help developers build with Claude, offering copy-able code snippets that you can easily integrate into your own projects.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To make the most of the examples in this cookbook, you'll need an Claude API key (sign up for free [here](https://www.anthropic.com)).
|
||||
|
||||
While the code examples are primarily written in Python, the concepts can be adapted to any programming language that supports interaction with the Claude API.
|
||||
|
||||
If you're new to working with the Claude API, we recommend starting with our [Claude API Fundamentals course](https://github.com/anthropics/courses/tree/master/anthropic_api_fundamentals) to get a solid foundation.
|
||||
|
||||
## Explore Further
|
||||
|
||||
Looking for more resources to enhance your experience with Claude and AI assistants? Check out these helpful links:
|
||||
|
||||
- [Anthropic developer documentation](https://docs.claude.com/claude/docs/guide-to-anthropics-prompt-engineering-resources)
|
||||
- [Anthropic support docs](https://support.anthropic.com)
|
||||
- [Anthropic Discord community](https://www.anthropic.com/discord)
|
||||
|
||||
## Contributing
|
||||
|
||||
The Claude Cookbooks thrives on the contributions of the developer community. We value your input, whether it's submitting an idea, fixing a typo, adding a new guide, or improving an existing one. By contributing, you help make this resource even more valuable for everyone.
|
||||
|
||||
To avoid duplication of efforts, please review the existing issues and pull requests before contributing.
|
||||
|
||||
If you have ideas for new examples or guides, share them on the [issues page](https://github.com/anthropics/anthropic-cookbook/issues).
|
||||
|
||||
## Table of recipes
|
||||
|
||||
### Capabilities
|
||||
- [Classification](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/classification): Explore techniques for text and data classification using Claude.
|
||||
- [Retrieval Augmented Generation](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/retrieval_augmented_generation): Learn how to enhance Claude's responses with external knowledge.
|
||||
- [Summarization](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/summarization): Discover techniques for effective text summarization with Claude.
|
||||
|
||||
### Tool Use and Integration
|
||||
- [Tool use](https://github.com/anthropics/anthropic-cookbook/tree/main/tool_use): Learn how to integrate Claude with external tools and functions to extend its capabilities.
|
||||
- [Customer service agent](https://github.com/anthropics/anthropic-cookbook/blob/main/tool_use/customer_service_agent.ipynb)
|
||||
- [Calculator integration](https://github.com/anthropics/anthropic-cookbook/blob/main/tool_use/calculator_tool.ipynb)
|
||||
- [SQL queries](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/how_to_make_sql_queries.ipynb)
|
||||
|
||||
### Third-Party Integrations
|
||||
- [Retrieval augmented generation](https://github.com/anthropics/anthropic-cookbook/tree/main/third_party): Supplement Claude's knowledge with external data sources.
|
||||
- [Vector databases (Pinecone)](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/Pinecone/rag_using_pinecone.ipynb)
|
||||
- [Wikipedia](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/Wikipedia/wikipedia-search-cookbook.ipynb/)
|
||||
- [Web pages](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/read_web_pages_with_haiku.ipynb)
|
||||
- [Embeddings with Voyage AI](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/VoyageAI/how_to_create_embeddings.md)
|
||||
|
||||
### Multimodal Capabilities
|
||||
- [Vision with Claude](https://github.com/anthropics/anthropic-cookbook/tree/main/multimodal):
|
||||
- [Getting started with images](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/getting_started_with_vision.ipynb)
|
||||
- [Best practices for vision](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/best_practices_for_vision.ipynb)
|
||||
- [Interpreting charts and graphs](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/reading_charts_graphs_powerpoints.ipynb)
|
||||
- [Extracting content from forms](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/how_to_transcribe_text.ipynb)
|
||||
- [Generate images with Claude](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/illustrated_responses.ipynb): Use Claude with Stable Diffusion for image generation.
|
||||
|
||||
### Advanced Techniques
|
||||
- [Sub-agents](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/using_sub_agents.ipynb): Learn how to use Haiku as a sub-agent in combination with Opus.
|
||||
- [Upload PDFs to Claude](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/pdf_upload_summarization.ipynb): Parse and pass PDFs as text to Claude.
|
||||
- [Automated evaluations](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/building_evals.ipynb): Use Claude to automate the prompt evaluation process.
|
||||
- [Enable JSON mode](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/how_to_enable_json_mode.ipynb): Ensure consistent JSON output from Claude.
|
||||
- [Create a moderation filter](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/building_moderation_filter.ipynb): Use Claude to create a content moderation filter for your application.
|
||||
- [Prompt caching](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/prompt_caching.ipynb): Learn techniques for efficient prompt caching with Claude.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Anthropic on AWS](https://github.com/aws-samples/anthropic-on-aws): Explore examples and solutions for using Claude on AWS infrastructure.
|
||||
- [AWS Samples](https://github.com/aws-samples/): A collection of code samples from AWS which can be adapted for use with Claude. Note that some samples may require modification to work optimally with Claude.
|
||||
@@ -1,19 +0,0 @@
|
||||
# Claude Capabilities
|
||||
|
||||
Welcome to the Capabilities section of the Claude Cookbooks! This directory contains a collection of guides that showcase specific capabilities where Claude excels. Each guide provides an in-depth exploration of a particular capability, discussing potential use cases, prompt engineering techniques to optimize results, and approaches for evaluating Claude's performance.
|
||||
|
||||
## Guides
|
||||
|
||||
- **[Classification with Claude](https://github.com/anthropics/claude-cookbooks/tree/main/capabilities/classification)**: Discover how Claude can revolutionize classification tasks, especially in scenarios with complex business rules and limited training data. This guide walks you through data preparation, prompt engineering with retrieval-augmented generation (RAG), testing, and evaluation.
|
||||
|
||||
- **[Retrieval Augmented Generation with Claude](https://github.com/anthropics/claude-cookbooks/tree/main/capabilities/retrieval_augmented_generation)**: Learn how to enhance Claude's capabilities with domain-specific knowledge using RAG. This guide demonstrates how to build a RAG system from scratch, optimize its performance, and create an evaluation suite. You'll learn how techniques like summary indexing and re-ranking can significantly improve precision, recall, and overall accuracy in question-answering tasks.
|
||||
|
||||
- **[Retrieval Augmented Generation with Contextual Embeddings](https://github.com/anthropics/claude-cookbooks/tree/main/capabilities/contextual-embeddings)**: Learn how to use a new technique to improve the performance of your RAG system. In traditional RAG, documents are typically split into smaller chunks for efficient retrieval. While this approach works well for many applications, it can lead to problems when individual chunks lack sufficient context. Contextual Embeddings solve this problem by adding relevant context to each chunk before embedding. You'll learn how to use contextual embeddings with semantic search, BM25 search, and reranking to improve performance.
|
||||
|
||||
- **[Summarization with Claude](https://github.com/anthropics/claude-cookbooks/tree/main/capabilities/summarization)**: Explore Claude's ability to summarize and synthesize information from multiple sources. This guide covers a variety of summarization techniques, including multi-shot, domain-based, and chunking methods, as well as strategies for handling long-form content and multiple documents. We also explore evaluating summaries, which can be a balance of art, subjectivity, and the right approach!
|
||||
|
||||
- **[Text-to-SQL with Claude](https://github.com/anthropics/claude-cookbooks/tree/main/capabilities/text_to_sql)**: This guide covers how to generate complex SQL queries from natural language using prompting techniques, self-improvement, and RAG. We'll also explore how to evaluate and improve the accuracy of generated SQL queries, with evals that test for syntax, data correctness, row count, and more.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To get started with these guides, simply navigate to the desired guide's directory and follow the instructions provided in the `guide.ipynb` file. Each guide is self-contained and includes all the necessary code, data, and evaluation scripts to reproduce the examples and experiments.
|
||||
@@ -1,31 +0,0 @@
|
||||
# Claude Cookbooks - Reference Index
|
||||
|
||||
This skill contains code and guides for building with Claude AI.
|
||||
|
||||
## Categories
|
||||
|
||||
### Capabilities
|
||||
- [Classification](capabilities.md#classification)
|
||||
- [Retrieval Augmented Generation](capabilities.md#rag)
|
||||
- [Summarization](capabilities.md#summarization)
|
||||
- [Text to SQL](capabilities.md#text-to-sql)
|
||||
|
||||
### Tool Use and Integration
|
||||
- [Tool Use Basics](tool_use.md#basics)
|
||||
- [Customer Service Agent](tool_use.md#customer-service)
|
||||
- [Calculator Integration](tool_use.md#calculator)
|
||||
|
||||
### Multimodal
|
||||
- [Vision with Claude](multimodal.md#vision)
|
||||
- [Image Generation](multimodal.md#generation)
|
||||
- [Charts and Graphs](multimodal.md#charts)
|
||||
|
||||
### Advanced Patterns
|
||||
- [Agents](patterns.md#agents)
|
||||
- [Sub-agents](patterns.md#sub-agents)
|
||||
- [Prompt Caching](patterns.md#caching)
|
||||
|
||||
### Third Party Integrations
|
||||
- [Vector Databases](third_party.md#vector-db)
|
||||
- [Embeddings](third_party.md#embeddings)
|
||||
- [LlamaIndex](third_party.md#llamaindex)
|
||||
@@ -1,68 +0,0 @@
|
||||
# Claude Cookbooks
|
||||
|
||||
The Claude Cookbooks provide code and guides designed to help developers build with Claude, offering copy-able code snippets that you can easily integrate into your own projects.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To make the most of the examples in this cookbook, you'll need an Claude API key (sign up for free [here](https://www.anthropic.com)).
|
||||
|
||||
While the code examples are primarily written in Python, the concepts can be adapted to any programming language that supports interaction with the Claude API.
|
||||
|
||||
If you're new to working with the Claude API, we recommend starting with our [Claude API Fundamentals course](https://github.com/anthropics/courses/tree/master/anthropic_api_fundamentals) to get a solid foundation.
|
||||
|
||||
## Explore Further
|
||||
|
||||
Looking for more resources to enhance your experience with Claude and AI assistants? Check out these helpful links:
|
||||
|
||||
- [Anthropic developer documentation](https://docs.claude.com/claude/docs/guide-to-anthropics-prompt-engineering-resources)
|
||||
- [Anthropic support docs](https://support.anthropic.com)
|
||||
- [Anthropic Discord community](https://www.anthropic.com/discord)
|
||||
|
||||
## Contributing
|
||||
|
||||
The Claude Cookbooks thrives on the contributions of the developer community. We value your input, whether it's submitting an idea, fixing a typo, adding a new guide, or improving an existing one. By contributing, you help make this resource even more valuable for everyone.
|
||||
|
||||
To avoid duplication of efforts, please review the existing issues and pull requests before contributing.
|
||||
|
||||
If you have ideas for new examples or guides, share them on the [issues page](https://github.com/anthropics/anthropic-cookbook/issues).
|
||||
|
||||
## Table of recipes
|
||||
|
||||
### Capabilities
|
||||
- [Classification](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/classification): Explore techniques for text and data classification using Claude.
|
||||
- [Retrieval Augmented Generation](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/retrieval_augmented_generation): Learn how to enhance Claude's responses with external knowledge.
|
||||
- [Summarization](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/summarization): Discover techniques for effective text summarization with Claude.
|
||||
|
||||
### Tool Use and Integration
|
||||
- [Tool use](https://github.com/anthropics/anthropic-cookbook/tree/main/tool_use): Learn how to integrate Claude with external tools and functions to extend its capabilities.
|
||||
- [Customer service agent](https://github.com/anthropics/anthropic-cookbook/blob/main/tool_use/customer_service_agent.ipynb)
|
||||
- [Calculator integration](https://github.com/anthropics/anthropic-cookbook/blob/main/tool_use/calculator_tool.ipynb)
|
||||
- [SQL queries](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/how_to_make_sql_queries.ipynb)
|
||||
|
||||
### Third-Party Integrations
|
||||
- [Retrieval augmented generation](https://github.com/anthropics/anthropic-cookbook/tree/main/third_party): Supplement Claude's knowledge with external data sources.
|
||||
- [Vector databases (Pinecone)](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/Pinecone/rag_using_pinecone.ipynb)
|
||||
- [Wikipedia](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/Wikipedia/wikipedia-search-cookbook.ipynb/)
|
||||
- [Web pages](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/read_web_pages_with_haiku.ipynb)
|
||||
- [Embeddings with Voyage AI](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/VoyageAI/how_to_create_embeddings.md)
|
||||
|
||||
### Multimodal Capabilities
|
||||
- [Vision with Claude](https://github.com/anthropics/anthropic-cookbook/tree/main/multimodal):
|
||||
- [Getting started with images](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/getting_started_with_vision.ipynb)
|
||||
- [Best practices for vision](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/best_practices_for_vision.ipynb)
|
||||
- [Interpreting charts and graphs](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/reading_charts_graphs_powerpoints.ipynb)
|
||||
- [Extracting content from forms](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/how_to_transcribe_text.ipynb)
|
||||
- [Generate images with Claude](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/illustrated_responses.ipynb): Use Claude with Stable Diffusion for image generation.
|
||||
|
||||
### Advanced Techniques
|
||||
- [Sub-agents](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/using_sub_agents.ipynb): Learn how to use Haiku as a sub-agent in combination with Opus.
|
||||
- [Upload PDFs to Claude](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/pdf_upload_summarization.ipynb): Parse and pass PDFs as text to Claude.
|
||||
- [Automated evaluations](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/building_evals.ipynb): Use Claude to automate the prompt evaluation process.
|
||||
- [Enable JSON mode](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/how_to_enable_json_mode.ipynb): Ensure consistent JSON output from Claude.
|
||||
- [Create a moderation filter](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/building_moderation_filter.ipynb): Use Claude to create a content moderation filter for your application.
|
||||
- [Prompt caching](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/prompt_caching.ipynb): Learn techniques for efficient prompt caching with Claude.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Anthropic on AWS](https://github.com/aws-samples/anthropic-on-aws): Explore examples and solutions for using Claude on AWS infrastructure.
|
||||
- [AWS Samples](https://github.com/aws-samples/): A collection of code samples from AWS which can be adapted for use with Claude. Note that some samples may require modification to work optimally with Claude.
|
||||
@@ -1,66 +0,0 @@
|
||||
# Multimodal Capabilities with Claude
|
||||
|
||||
Source: anthropics/claude-cookbooks/multimodal
|
||||
|
||||
## Vision Capabilities
|
||||
|
||||
### Getting Started with Images
|
||||
- **Location**: `multimodal/getting_started_with_vision.ipynb`
|
||||
- **Topics**: Image upload, analysis, OCR, visual question answering
|
||||
|
||||
### Best Practices for Vision
|
||||
- **Location**: `multimodal/best_practices_for_vision.ipynb`
|
||||
- **Topics**: Image quality, prompt engineering for vision, error handling
|
||||
|
||||
### Charts and Graphs
|
||||
- **Location**: `multimodal/reading_charts_graphs_powerpoints.ipynb`
|
||||
- **Topics**: Data extraction from charts, graph interpretation, PowerPoint analysis
|
||||
|
||||
### Form Extraction
|
||||
- **Location**: `multimodal/how_to_transcribe_text.ipynb`
|
||||
- **Topics**: OCR, structured data extraction, form processing
|
||||
|
||||
## Image Generation
|
||||
|
||||
### Illustrated Responses
|
||||
- **Location**: `misc/illustrated_responses.ipynb`
|
||||
- **Topics**: Integration with Stable Diffusion, image generation prompts
|
||||
|
||||
## Code Examples
|
||||
|
||||
```python
|
||||
# Vision API example
|
||||
import anthropic
|
||||
|
||||
client = anthropic.Anthropic()
|
||||
|
||||
# Analyze an image
|
||||
response = client.messages.create(
|
||||
model="claude-3-5-sonnet-20241022",
|
||||
max_tokens=1024,
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "image",
|
||||
"source": {
|
||||
"type": "base64",
|
||||
"media_type": "image/jpeg",
|
||||
"data": image_base64
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "What's in this image?"
|
||||
}
|
||||
]
|
||||
}]
|
||||
)
|
||||
```
|
||||
|
||||
## Tips
|
||||
|
||||
1. **Image Quality**: Higher resolution images provide better results
|
||||
2. **Prompt Clarity**: Be specific about what you want to extract or analyze
|
||||
3. **Format Support**: JPEG, PNG, GIF, WebP supported
|
||||
4. **Size Limits**: Max 5MB per image
|
||||
@@ -1,20 +0,0 @@
|
||||
# Building Effective Agents Cookbook
|
||||
|
||||
Reference implementation for [Building Effective Agents](https://anthropic.com/research/building-effective-agents) by Erik Schluntz and Barry Zhang.
|
||||
|
||||
This repository contains example minimal implementations of common agent workflows discussed in the blog:
|
||||
|
||||
- Basic Building Blocks
|
||||
- Prompt Chaining
|
||||
- Routing
|
||||
- Multi-LLM Parallelization
|
||||
- Advanced Workflows
|
||||
- Orchestrator-Subagents
|
||||
- Evaluator-Optimizer
|
||||
|
||||
## Getting Started
|
||||
See the Jupyter notebooks for detailed examples:
|
||||
|
||||
- [Basic Workflows](https://github.com/anthropics/claude-cookbooks/blob/main/patterns/agents/basic_workflows.ipynb)
|
||||
- [Evaluator-Optimizer Workflow](https://github.com/anthropics/claude-cookbooks/blob/main/patterns/agents/evaluator_optimizer.ipynb)
|
||||
- [Orchestrator-Workers Workflow](https://github.com/anthropics/claude-cookbooks/blob/main/patterns/agents/orchestrator_workers.ipynb)
|
||||
@@ -1,39 +0,0 @@
|
||||
# Third Party Integrations
|
||||
|
||||
Source: anthropics/claude-cookbooks/third_party
|
||||
|
||||
## Vector Databases
|
||||
|
||||
### Pinecone
|
||||
- **Location**: `third_party/Pinecone/rag_using_pinecone.ipynb`
|
||||
- **Use Case**: Retrieval Augmented Generation with vector search
|
||||
- **Key Concepts**: Embeddings, similarity search, RAG pipeline
|
||||
|
||||
## Embeddings
|
||||
|
||||
### Voyage AI
|
||||
- **Location**: `third_party/VoyageAI/how_to_create_embeddings.md`
|
||||
- **Use Case**: Creating high-quality embeddings for semantic search
|
||||
- **Key Concepts**: Embedding models, dimensionality, similarity metrics
|
||||
|
||||
## Search Integrations
|
||||
|
||||
### Wikipedia
|
||||
- **Location**: `third_party/Wikipedia/wikipedia-search-cookbook.ipynb`
|
||||
- **Use Case**: Augment Claude with Wikipedia knowledge
|
||||
- **Key Concepts**: API integration, knowledge retrieval
|
||||
|
||||
### Web Pages
|
||||
- **Location**: `misc/read_web_pages_with_haiku.ipynb`
|
||||
- **Use Case**: Extract and analyze web page content
|
||||
- **Key Concepts**: Web scraping, content extraction
|
||||
|
||||
## LlamaIndex
|
||||
- **Location**: `third_party/LlamaIndex/`
|
||||
- **Use Case**: Advanced document indexing and retrieval
|
||||
- **Key Concepts**: Index creation, query engines, document loaders
|
||||
|
||||
## Deepgram
|
||||
- **Location**: `third_party/Deepgram/`
|
||||
- **Use Case**: Audio transcription integration
|
||||
- **Key Concepts**: Speech-to-text, audio processing
|
||||
@@ -1,55 +0,0 @@
|
||||
# Tool Use with Claude
|
||||
|
||||
Source: anthropics/claude-cookbooks/tool_use
|
||||
|
||||
## Overview
|
||||
|
||||
Learn how to integrate Claude with external tools and functions to extend its capabilities.
|
||||
|
||||
## Key Examples
|
||||
|
||||
### Customer Service Agent
|
||||
- **Location**: `tool_use/customer_service_agent.ipynb`
|
||||
- **Description**: Build an intelligent customer service agent using Claude with tool integration
|
||||
- **Key Concepts**: Function calling, state management, conversation flow
|
||||
|
||||
### Calculator Integration
|
||||
- **Location**: `tool_use/calculator_tool.ipynb`
|
||||
- **Description**: Integrate external calculation tools with Claude
|
||||
- **Key Concepts**: Tool definitions, parameter passing, result handling
|
||||
|
||||
### Memory Demo
|
||||
- **Location**: `tool_use/memory_demo/`
|
||||
- **Description**: Implement persistent memory for Claude conversations
|
||||
- **Key Concepts**: Context management, state persistence
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Tool Definition**: Define clear, specific tool schemas
|
||||
2. **Error Handling**: Implement robust error handling for tool calls
|
||||
3. **Validation**: Validate tool inputs and outputs
|
||||
4. **Context**: Maintain context across tool interactions
|
||||
|
||||
## Common Patterns
|
||||
|
||||
```python
|
||||
# Tool definition example
|
||||
tools = [{
|
||||
"name": "calculator",
|
||||
"description": "Performs basic arithmetic operations",
|
||||
"input_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"operation": {"type": "string"},
|
||||
"a": {"type": "number"},
|
||||
"b": {"type": "number"}
|
||||
},
|
||||
"required": ["operation", "a", "b"]
|
||||
}
|
||||
}]
|
||||
```
|
||||
|
||||
## Related Resources
|
||||
|
||||
- [Anthropic Tool Use Documentation](https://docs.claude.com/claude/docs/tool-use)
|
||||
- [API Reference](https://docs.claude.com/claude/reference)
|
||||
@@ -1,362 +0,0 @@
|
||||
"""
|
||||
Production-ready memory tool handler for Claude's memory_20250818 tool.
|
||||
|
||||
This implementation provides secure, client-side execution of memory operations
|
||||
with path validation, error handling, and comprehensive security measures.
|
||||
"""
|
||||
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
class MemoryToolHandler:
|
||||
"""
|
||||
Handles execution of Claude's memory tool commands.
|
||||
|
||||
The memory tool enables Claude to read, write, and manage files in a memory
|
||||
system through a standardized tool interface. This handler provides client-side
|
||||
implementation with security controls.
|
||||
|
||||
Attributes:
|
||||
base_path: Root directory for memory storage
|
||||
memory_root: The /memories directory within base_path
|
||||
"""
|
||||
|
||||
def __init__(self, base_path: str = "./memory_storage"):
|
||||
"""
|
||||
Initialize the memory tool handler.
|
||||
|
||||
Args:
|
||||
base_path: Root directory for all memory operations
|
||||
"""
|
||||
self.base_path = Path(base_path).resolve()
|
||||
self.memory_root = self.base_path / "memories"
|
||||
self.memory_root.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def _validate_path(self, path: str) -> Path:
|
||||
"""
|
||||
Validate and resolve memory paths to prevent directory traversal attacks.
|
||||
|
||||
Args:
|
||||
path: The path to validate (must start with /memories)
|
||||
|
||||
Returns:
|
||||
Resolved absolute Path object within memory_root
|
||||
|
||||
Raises:
|
||||
ValueError: If path is invalid or attempts to escape memory directory
|
||||
"""
|
||||
if not path.startswith("/memories"):
|
||||
raise ValueError(
|
||||
f"Path must start with /memories, got: {path}. "
|
||||
"All memory operations must be confined to the /memories directory."
|
||||
)
|
||||
|
||||
# Remove /memories prefix and any leading slashes
|
||||
relative_path = path[len("/memories") :].lstrip("/")
|
||||
|
||||
# Resolve to absolute path within memory_root
|
||||
if relative_path:
|
||||
full_path = (self.memory_root / relative_path).resolve()
|
||||
else:
|
||||
full_path = self.memory_root.resolve()
|
||||
|
||||
# Verify the resolved path is still within memory_root
|
||||
try:
|
||||
full_path.relative_to(self.memory_root.resolve())
|
||||
except ValueError as e:
|
||||
raise ValueError(
|
||||
f"Path '{path}' would escape /memories directory. "
|
||||
"Directory traversal attempts are not allowed."
|
||||
) from e
|
||||
|
||||
return full_path
|
||||
|
||||
def execute(self, **params: Any) -> dict[str, str]:
|
||||
"""
|
||||
Execute a memory tool command.
|
||||
|
||||
Args:
|
||||
**params: Command parameters from Claude's tool use
|
||||
|
||||
Returns:
|
||||
Dict with either 'success' or 'error' key
|
||||
|
||||
Supported commands:
|
||||
- view: Show directory contents or file contents
|
||||
- create: Create or overwrite a file
|
||||
- str_replace: Replace text in a file
|
||||
- insert: Insert text at a specific line
|
||||
- delete: Delete a file or directory
|
||||
- rename: Rename or move a file/directory
|
||||
"""
|
||||
command = params.get("command")
|
||||
|
||||
try:
|
||||
if command == "view":
|
||||
return self._view(params)
|
||||
elif command == "create":
|
||||
return self._create(params)
|
||||
elif command == "str_replace":
|
||||
return self._str_replace(params)
|
||||
elif command == "insert":
|
||||
return self._insert(params)
|
||||
elif command == "delete":
|
||||
return self._delete(params)
|
||||
elif command == "rename":
|
||||
return self._rename(params)
|
||||
else:
|
||||
return {
|
||||
"error": f"Unknown command: '{command}'. "
|
||||
"Valid commands are: view, create, str_replace, insert, delete, rename"
|
||||
}
|
||||
except ValueError as e:
|
||||
return {"error": str(e)}
|
||||
except Exception as e:
|
||||
return {"error": f"Unexpected error executing {command}: {e}"}
|
||||
|
||||
def _view(self, params: dict[str, Any]) -> dict[str, str]:
|
||||
"""View directory contents or file contents."""
|
||||
path = params.get("path")
|
||||
view_range = params.get("view_range")
|
||||
|
||||
if not path:
|
||||
return {"error": "Missing required parameter: path"}
|
||||
|
||||
full_path = self._validate_path(path)
|
||||
|
||||
# Handle directory listing
|
||||
if full_path.is_dir():
|
||||
try:
|
||||
items = []
|
||||
for item in sorted(full_path.iterdir()):
|
||||
if item.name.startswith("."):
|
||||
continue
|
||||
items.append(f"{item.name}/" if item.is_dir() else item.name)
|
||||
|
||||
if not items:
|
||||
return {"success": f"Directory: {path}\n(empty)"}
|
||||
|
||||
return {
|
||||
"success": f"Directory: {path}\n" + "\n".join([f"- {item}" for item in items])
|
||||
}
|
||||
except Exception as e:
|
||||
return {"error": f"Cannot read directory {path}: {e}"}
|
||||
|
||||
# Handle file reading
|
||||
elif full_path.is_file():
|
||||
try:
|
||||
content = full_path.read_text(encoding="utf-8")
|
||||
lines = content.splitlines()
|
||||
|
||||
# Apply view range if specified
|
||||
if view_range:
|
||||
start_line = max(1, view_range[0]) - 1 # Convert to 0-indexed
|
||||
end_line = len(lines) if view_range[1] == -1 else view_range[1]
|
||||
lines = lines[start_line:end_line]
|
||||
start_num = start_line + 1
|
||||
else:
|
||||
start_num = 1
|
||||
|
||||
# Format with line numbers
|
||||
numbered_lines = [f"{i + start_num:4d}: {line}" for i, line in enumerate(lines)]
|
||||
return {"success": "\n".join(numbered_lines)}
|
||||
|
||||
except UnicodeDecodeError:
|
||||
return {"error": f"Cannot read {path}: File is not valid UTF-8 text"}
|
||||
except Exception as e:
|
||||
return {"error": f"Cannot read file {path}: {e}"}
|
||||
|
||||
else:
|
||||
return {"error": f"Path not found: {path}"}
|
||||
|
||||
def _create(self, params: dict[str, Any]) -> dict[str, str]:
|
||||
"""Create or overwrite a file."""
|
||||
path = params.get("path")
|
||||
file_text = params.get("file_text", "")
|
||||
|
||||
if not path:
|
||||
return {"error": "Missing required parameter: path"}
|
||||
|
||||
full_path = self._validate_path(path)
|
||||
|
||||
# Don't allow creating directories directly
|
||||
if not path.endswith((".txt", ".md", ".json", ".py", ".yaml", ".yml")):
|
||||
return {
|
||||
"error": f"Cannot create {path}: Only text files are supported. "
|
||||
"Use file extensions: .txt, .md, .json, .py, .yaml, .yml"
|
||||
}
|
||||
|
||||
try:
|
||||
# Create parent directories if needed
|
||||
full_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Write the file
|
||||
full_path.write_text(file_text, encoding="utf-8")
|
||||
return {"success": f"File created successfully at {path}"}
|
||||
|
||||
except Exception as e:
|
||||
return {"error": f"Cannot create file {path}: {e}"}
|
||||
|
||||
def _str_replace(self, params: dict[str, Any]) -> dict[str, str]:
|
||||
"""Replace text in a file."""
|
||||
path = params.get("path")
|
||||
old_str = params.get("old_str")
|
||||
new_str = params.get("new_str", "")
|
||||
|
||||
if not path or old_str is None:
|
||||
return {"error": "Missing required parameters: path, old_str"}
|
||||
|
||||
full_path = self._validate_path(path)
|
||||
|
||||
if not full_path.is_file():
|
||||
return {"error": f"File not found: {path}"}
|
||||
|
||||
try:
|
||||
content = full_path.read_text(encoding="utf-8")
|
||||
|
||||
# Check if old_str exists
|
||||
count = content.count(old_str)
|
||||
if count == 0:
|
||||
return {
|
||||
"error": f"String not found in {path}. The exact text must exist in the file."
|
||||
}
|
||||
elif count > 1:
|
||||
return {
|
||||
"error": f"String appears {count} times in {path}. "
|
||||
"The string must be unique. Use more specific context."
|
||||
}
|
||||
|
||||
# Perform replacement
|
||||
new_content = content.replace(old_str, new_str, 1)
|
||||
full_path.write_text(new_content, encoding="utf-8")
|
||||
|
||||
return {"success": f"File {path} has been edited successfully"}
|
||||
|
||||
except Exception as e:
|
||||
return {"error": f"Cannot edit file {path}: {e}"}
|
||||
|
||||
def _insert(self, params: dict[str, Any]) -> dict[str, str]:
|
||||
"""Insert text at a specific line."""
|
||||
path = params.get("path")
|
||||
insert_line = params.get("insert_line")
|
||||
insert_text = params.get("insert_text", "")
|
||||
|
||||
if not path or insert_line is None:
|
||||
return {"error": "Missing required parameters: path, insert_line"}
|
||||
|
||||
full_path = self._validate_path(path)
|
||||
|
||||
if not full_path.is_file():
|
||||
return {"error": f"File not found: {path}"}
|
||||
|
||||
try:
|
||||
lines = full_path.read_text(encoding="utf-8").splitlines()
|
||||
|
||||
# Validate insert_line
|
||||
if insert_line < 0 or insert_line > len(lines):
|
||||
return {
|
||||
"error": f"Invalid insert_line {insert_line}. "
|
||||
f"Must be between 0 and {len(lines)}"
|
||||
}
|
||||
|
||||
# Insert the text
|
||||
lines.insert(insert_line, insert_text.rstrip("\n"))
|
||||
|
||||
# Write back
|
||||
full_path.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
||||
|
||||
return {"success": f"Text inserted at line {insert_line} in {path}"}
|
||||
|
||||
except Exception as e:
|
||||
return {"error": f"Cannot insert into {path}: {e}"}
|
||||
|
||||
def _delete(self, params: dict[str, Any]) -> dict[str, str]:
|
||||
"""Delete a file or directory."""
|
||||
path = params.get("path")
|
||||
|
||||
if not path:
|
||||
return {"error": "Missing required parameter: path"}
|
||||
|
||||
# Prevent deletion of root memories directory
|
||||
if path == "/memories":
|
||||
return {"error": "Cannot delete the /memories directory itself"}
|
||||
|
||||
full_path = self._validate_path(path)
|
||||
|
||||
# Verify the path is within /memories to prevent accidental deletion outside the memory directory
|
||||
# This provides an additional safety check beyond _validate_path
|
||||
try:
|
||||
full_path.relative_to(self.memory_root.resolve())
|
||||
except ValueError:
|
||||
return {
|
||||
"error": f"Invalid operation: Path '{path}' is not within /memories directory. "
|
||||
"Only paths within /memories can be deleted."
|
||||
}
|
||||
|
||||
if not full_path.exists():
|
||||
return {"error": f"Path not found: {path}"}
|
||||
|
||||
try:
|
||||
if full_path.is_file():
|
||||
full_path.unlink()
|
||||
return {"success": f"File deleted: {path}"}
|
||||
elif full_path.is_dir():
|
||||
shutil.rmtree(full_path)
|
||||
return {"success": f"Directory deleted: {path}"}
|
||||
|
||||
except Exception as e:
|
||||
return {"error": f"Cannot delete {path}: {e}"}
|
||||
|
||||
def _rename(self, params: dict[str, Any]) -> dict[str, str]:
|
||||
"""Rename or move a file/directory."""
|
||||
old_path = params.get("old_path")
|
||||
new_path = params.get("new_path")
|
||||
|
||||
if not old_path or not new_path:
|
||||
return {"error": "Missing required parameters: old_path, new_path"}
|
||||
|
||||
old_full_path = self._validate_path(old_path)
|
||||
new_full_path = self._validate_path(new_path)
|
||||
|
||||
if not old_full_path.exists():
|
||||
return {"error": f"Source path not found: {old_path}"}
|
||||
|
||||
if new_full_path.exists():
|
||||
return {
|
||||
"error": f"Destination already exists: {new_path}. "
|
||||
"Cannot overwrite existing files/directories."
|
||||
}
|
||||
|
||||
try:
|
||||
# Create parent directories if needed
|
||||
new_full_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Perform rename/move
|
||||
old_full_path.rename(new_full_path)
|
||||
|
||||
return {"success": f"Renamed {old_path} to {new_path}"}
|
||||
|
||||
except Exception as e:
|
||||
return {"error": f"Cannot rename {old_path} to {new_path}: {e}"}
|
||||
|
||||
def clear_all_memory(self) -> dict[str, str]:
|
||||
"""
|
||||
Clear all memory files (useful for testing or starting fresh).
|
||||
|
||||
⚠️ WARNING: This method is for demonstration and testing purposes only.
|
||||
In production, you should carefully consider whether you need to delete
|
||||
all memory files, as this will permanently remove all learned patterns
|
||||
and stored knowledge. Consider using selective deletion instead.
|
||||
|
||||
Returns:
|
||||
Dict with success message
|
||||
"""
|
||||
try:
|
||||
if self.memory_root.exists():
|
||||
shutil.rmtree(self.memory_root)
|
||||
self.memory_root.mkdir(parents=True, exist_ok=True)
|
||||
return {"success": "All memory cleared successfully"}
|
||||
except Exception as e:
|
||||
return {"error": f"Cannot clear memory: {e}"}
|
||||
@@ -1,116 +0,0 @@
|
||||
---
|
||||
name: coingecko
|
||||
description: "CoinGecko API skill: cryptocurrency prices, market data, coin IDs, historical charts, trending search, onchain endpoints, API-key authentication, and rate-limit-aware request design."
|
||||
---
|
||||
|
||||
# coingecko Skill
|
||||
|
||||
Use this skill to integrate CoinGecko market data into applications, agents, dashboards, and analysis pipelines with clear API-key and rate-limit handling.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Trigger when any of these applies:
|
||||
- Querying token prices, market cap, volume, historical charts, trending coins, NFTs, categories, or exchange data from CoinGecko.
|
||||
- Choosing Demo API vs Pro API root URLs and authentication headers.
|
||||
- Designing rate-limit-aware polling, cache refresh, or price freshness checks.
|
||||
- Building crypto dashboards, price alerts, analytics jobs, or market-data enrichers.
|
||||
- Navigating CoinGecko MCP, REST, or onchain/GeckoTerminal reference material.
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
- Not financial advice, token endorsement, trade execution, or market manipulation support.
|
||||
- Do not expose API keys in query strings unless unavoidable; prefer headers and backend proxy insertion.
|
||||
- Do not assume symbol uniqueness; resolve assets with CoinGecko coin IDs before price calls.
|
||||
- Required inputs: plan type, root URL, API key availability, coin IDs/symbols/contracts, quote currencies, date range, and freshness requirements.
|
||||
- CoinGecko endpoints and plan gates evolve; verify paid-only endpoints and rate limits in `references/` before production use.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Common Patterns
|
||||
|
||||
**Demo API ping with header auth**
|
||||
```bash
|
||||
curl -X GET "https://api.coingecko.com/api/v3/ping" \
|
||||
-H "x-cg-demo-api-key: YOUR_API_KEY"
|
||||
```
|
||||
|
||||
**Pro API ping with header auth**
|
||||
```bash
|
||||
curl -X GET "https://pro-api.coingecko.com/api/v3/ping" \
|
||||
-H "x-cg-pro-api-key: YOUR_API_KEY"
|
||||
```
|
||||
|
||||
**Simple price for coin IDs**
|
||||
```bash
|
||||
curl "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd"
|
||||
```
|
||||
|
||||
**Include freshness fields in price response**
|
||||
```bash
|
||||
curl "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_last_updated_at=true"
|
||||
```
|
||||
|
||||
**Market list by market cap**
|
||||
```bash
|
||||
curl "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=100&page=1"
|
||||
```
|
||||
|
||||
**Historical chart by coin ID**
|
||||
```bash
|
||||
curl "https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=30"
|
||||
```
|
||||
|
||||
**Trending search**
|
||||
```bash
|
||||
curl "https://api.coingecko.com/api/v3/search/trending"
|
||||
```
|
||||
|
||||
**Onchain trending pools**
|
||||
```bash
|
||||
curl "https://api.coingecko.com/api/v3/onchain/networks/trending_pools"
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Price Widget
|
||||
|
||||
- Input: coin IDs `bitcoin,ethereum`, quote `usd`, refresh interval.
|
||||
- Steps:
|
||||
1. Use `/simple/price` with `include_last_updated_at=true`.
|
||||
2. Cache responses according to product freshness needs and plan limits.
|
||||
3. Display stale-data warnings when `last_updated_at` is outside the allowed window.
|
||||
- Expected output / acceptance: a small response with current prices and explicit freshness handling.
|
||||
|
||||
### Example 2: Market-Cap Dashboard
|
||||
|
||||
- Input: quote currency `usd`, `per_page=100`, page number.
|
||||
- Steps:
|
||||
1. Query `/coins/markets`.
|
||||
2. Persist coin ID, symbol, name, price, market cap, and volume.
|
||||
3. Avoid treating symbols as primary keys because duplicates exist.
|
||||
- Expected output / acceptance: stable dashboard rows keyed by CoinGecko ID.
|
||||
|
||||
### Example 3: Trending Research Batch
|
||||
|
||||
- Input: need trending coins, NFTs, and categories in the last 24 hours.
|
||||
- Steps:
|
||||
1. Query `/search/trending`.
|
||||
2. Normalize returned entities by type.
|
||||
3. For coins that require prices, follow up with `/simple/price` using IDs.
|
||||
- Expected output / acceptance: a typed trending list with price enrichment only where IDs are available.
|
||||
|
||||
## References
|
||||
|
||||
- `references/index.md`: navigation for local CoinGecko docs.
|
||||
- `references/authentication.md`: Demo/Pro API keys, root URLs, and header names.
|
||||
- `references/coins.md`: coin IDs, markets, charts, simple price, and trending search.
|
||||
- `references/market_data.md`: NFT market data notes.
|
||||
- `references/exchanges.md`: exchange endpoints.
|
||||
- `references/trending.md`: onchain trending pool endpoints.
|
||||
- `references/llms.md` and `references/llms-full.md`: LLM-oriented reference exports.
|
||||
|
||||
## Maintenance
|
||||
|
||||
- Sources: local `references/` extracted from CoinGecko documentation.
|
||||
- Last updated: 2026-04-28
|
||||
- Known limits: plan availability and rate limits are account-specific; verify against the active CoinGecko plan before shipping.
|
||||
@@ -1,200 +0,0 @@
|
||||
# Coingecko - Authentication
|
||||
|
||||
**Pages:** 3
|
||||
|
||||
---
|
||||
|
||||
## Authentication (Public/Demo)
|
||||
|
||||
**URL:** llms-txt#authentication-(public/demo)
|
||||
|
||||
**Contents:**
|
||||
- CoinGecko API Authentication Method
|
||||
- API Key Usage Credits
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/authentication
|
||||
|
||||
Authentication method for CoinGecko Public API (Demo plan users)
|
||||
|
||||
<Note>
|
||||
### **Notes**
|
||||
|
||||
* Demo API Key is only available for CoinGecko Public Demo API Plan, the root URL for CoinGecko Public Demo API must be `https://api.coingecko.com/api/v3/`.
|
||||
* ⚠️ You are recommended to store the API key securely in your own backend and use a proxy to insert the key into the request URL.
|
||||
* The authentication method below is for CoinGecko Public Demo API only. For **paid plan users with Pro-API key**, please refer to [this page](https://docs.coingecko.com/reference/authentication) instead.
|
||||
* User Guide: [How to sign up for CoinGecko Demo API and generate an API key?](https://support.coingecko.com/hc/en-us/articles/21880397454233)
|
||||
* It's highly recommended to use the **Headers method** when making API requests for better security. Using query string parameters can risk exposing your API key.
|
||||
</Note>
|
||||
|
||||
## CoinGecko API Authentication Method
|
||||
|
||||
If this is your first time using the Demo API key, you can supply API Key to the root URL using one of these ways:
|
||||
|
||||
1. Header (Recommended): `x-cg-demo-api-key`
|
||||
2. Query String Parameter: `x_cg_demo_api_key`
|
||||
|
||||
| Authentication Method | Example using [Ping](https://docs.coingecko.com/v3.0.1/reference/ping-server) Endpoint |
|
||||
| ---------------------- | ------------------------------------------------------------------------------------------ |
|
||||
| Header (cURL) | `curl -X GET "https://api.coingecko.com/api/v3/ping" -H "x-cg-demo-api-key: YOUR_API_KEY"` |
|
||||
| Query String Parameter | `https://api.coingecko.com/api/v3/ping?x_cg_demo_api_key=YOUR_API_KEY` |
|
||||
|
||||
## API Key Usage Credits
|
||||
|
||||
* Each request made to any endpoint counts as a single call (1 call = 1 credit).
|
||||
* Your monthly credit & rate limit are determined by the paid plan to which you subscribe. For more details, please refer to this [page](https://www.coingecko.com/en/api/pricing).
|
||||
* To check the API usage, please go to the [developer dashboard](https://www.coingecko.com/en/developers/dashboard) or follow the guide [here](https://docs.coingecko.com/v3.0.1/reference/setting-up-your-api-key#4-api-usage-report).
|
||||
|
||||
---
|
||||
|
||||
## Authentication (Pro API)
|
||||
|
||||
**URL:** llms-txt#authentication-(pro-api)
|
||||
|
||||
**Contents:**
|
||||
- CoinGecko API Authentication Method
|
||||
- 🔥 Accessing Onchain DEX data
|
||||
- API Key Usage Credits
|
||||
|
||||
Source: https://docs.coingecko.com/reference/authentication
|
||||
|
||||
Authentication method for CoinGecko Pro API (Paid plan subscribers with Pro-API keys)
|
||||
|
||||
<Note>
|
||||
### **Notes**
|
||||
|
||||
* Pro API Key is only available for [CoinGecko API paid plan](https://www.coingecko.com/en/api/pricing) subscribers, the root URL for CoinGecko Pro API must be `https://pro-api.coingecko.com/api/v3/`.
|
||||
* You are recommended to store the API key securely in your own backend and use a proxy to insert the key into the request URL.
|
||||
* It's highly recommended to use the Headers method when making API requests for better security. Using query string parameters can risk exposing your API key.
|
||||
</Note>
|
||||
|
||||
## CoinGecko API Authentication Method
|
||||
|
||||
If this is your first time using the Pro API key, you can supply API Key to the root URL using one of these ways:
|
||||
|
||||
1. Header (Recommended): `x-cg-pro-api-key`
|
||||
2. Query String Parameter: `x_cg_pro_api_key`
|
||||
|
||||
| Authentication Method | Example using [Ping](https://docs.coingecko.com/reference/ping-server) Endpoint |
|
||||
| ---------------------- | --------------------------------------------------------------------------------------------- |
|
||||
| Header (cURL) | `curl -X GET "https://pro-api.coingecko.com/api/v3/ping" -H "x-cg-pro-api-key: YOUR_API_KEY"` |
|
||||
| Query String Parameter | `https://pro-api.coingecko.com/api/v3/ping?x_cg_pro_api_key=YOUR_API_KEY` |
|
||||
|
||||
## 🔥 Accessing Onchain DEX data
|
||||
|
||||
You can now use the Pro-API key (exclusive to any paid plan subscriber) to call onchain DEX data powered by [GeckoTerminal](https://www.geckoterminal.com/).
|
||||
|
||||
<Note>
|
||||
### **Notes**
|
||||
|
||||
* Authentication method for onchain endpoints is exactly same as other endpoints.
|
||||
* When using the CG Pro API to access onchain DEX data, include the `/onchain` endpoint path in the request.
|
||||
</Note>
|
||||
|
||||
| Authentication Method | Example using [Simple Token Price](https://docs.coingecko.com/reference/onchain-simple-price) Endpoint |
|
||||
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Header (cURL) | `curl -X GET "<https://pro-api.coingecko.com/api/v3/onchain/simple/networks/eth/token_price/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2>" -H "x-cg-pro-api-key: YOUR_API_KEY"` |
|
||||
| Query String Parameter | `https://pro-api.coingecko.com/api/v3/onchain/simple/networks/eth/token_price/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2?x_cg_pro_api_key=YOUR_API_KEY` |
|
||||
|
||||
## API Key Usage Credits
|
||||
|
||||
* Each request made to any endpoint counts as a single call (1 call = 1 credit).
|
||||
* Each successful API request (Status 200) will deduct 1 credit from your monthly credit allowance.
|
||||
* Unsuccessful Requests (Status 4xx, 5xx, etc) will not count towards credit deduction.
|
||||
* Regardless of the HTTP status code returned (including 4xx and 5xx errors), all API requests will count towards your **minute rate limit**.
|
||||
* Your monthly credit & rate limit are determined by the paid plan to which you subscribe. For more details, please refer to this [page](https://www.coingecko.com/en/api/pricing).
|
||||
* To check the API usage, please go to the [developer dashboard](https://www.coingecko.com/en/developers/dashboard) or follow the guide [here](https://docs.coingecko.com/reference/setting-up-your-api-key#4-api-usage-report)
|
||||
|
||||
---
|
||||
|
||||
## Setting Up Your API Key
|
||||
|
||||
**URL:** llms-txt#setting-up-your-api-key
|
||||
|
||||
**Contents:**
|
||||
- 1. Creating a new API Key
|
||||
- 2. Making API Request
|
||||
- 3. Edit or Delete API Key
|
||||
- 4. API Usage Report
|
||||
- 5. Others
|
||||
- Call Consumption Alerts
|
||||
- Overage Option (Beta)
|
||||
|
||||
Source: https://docs.coingecko.com/docs/setting-up-your-api-key
|
||||
|
||||
👋 **New to CoinGecko API?** Sign up for an account [here](https://www.coingecko.com/en/api/pricing)
|
||||
|
||||
## 1. Creating a new API Key
|
||||
|
||||
* Once you have signed up and logged in to your CoinGecko account, go to [Developer Dashboard](https://www.coingecko.com/en/developers/dashboard):
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/d5fdca3-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=01b58675fd1f038e4998877c0dde2cce" data-og-width="2535" width="2535" data-og-height="1454" height="1454" data-path="images/reference/d5fdca3-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/d5fdca3-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=73cd461df259d6584539d8fa4182e8c7 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/d5fdca3-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=b450ef8d7ff960560975cfbcf02c9cd8 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/d5fdca3-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=a712cb1278b923471296f9eff1a66bcb 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/d5fdca3-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=ad1648c3f6875aad6a69b7d885545f9f 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/d5fdca3-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=bb4f72d8c718de14aa95dc77195b1b6f 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/d5fdca3-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=a04a90a2ac24c43094ed536a92d6c125 2500w" />
|
||||
</Frame>
|
||||
|
||||
* Click on **+ Add New Key** button to create a new API key:
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/0e2f30d-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=49cf69a9b5ada9685301fe90281ec4ca" data-og-width="2380" width="2380" data-og-height="1695" height="1695" data-path="images/reference/0e2f30d-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/0e2f30d-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=dae015f221e2baf42b535213c492282d 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/0e2f30d-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=475c556a13a18691d600261b16f36c3f 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/0e2f30d-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=6c707c3bd727ef27a62a122c612f70af 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/0e2f30d-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=e575c119ac20eddb902be7eba947e8e3 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/0e2f30d-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=6543d53ea75c2f201ea1bd9e03bec784 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/0e2f30d-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=ef098f326f88369b848b496374bb90b6 2500w" />
|
||||
</Frame>
|
||||
|
||||
## 2. Making API Request
|
||||
|
||||
* **Root URLs:**
|
||||
* Pro API: `https://pro-api.coingecko.com/api/v3/`, refer to [Pro API Authentication](https://docs.coingecko.com/reference/authentication).
|
||||
* Demo API: `https://api.coingecko.com/api/v3/`, refer to [Demo API Authentication](https://docs.coingecko.com/v3.0.1/reference/authentication).
|
||||
* **Example using the `/ping` endpoint:**
|
||||
|
||||
* Pro API: `https://pro-api.coingecko.com/api/v3/ping?x_cg_pro_api_key=YOUR_API_KEY`
|
||||
* Demo API: `https://api.coingecko.com/api/v3/ping?x_cg_demo_api_key=YOUR_API_KEY`
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/27ff800-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=e3d99147f58fba36640e1bfe509349b1" data-og-width="1784" width="1784" data-og-height="604" height="604" data-path="images/reference/27ff800-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/27ff800-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=591078670f4f8bd13429f7fb18afaa90 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/27ff800-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=f5a27f6ae38522bb400bef3b620920ce 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/27ff800-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=a1aec54f1196f3f1b34f6f6124750fa7 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/27ff800-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=c69aba5a0e5cd26d4789a231d168eb05 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/27ff800-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=ce2ee82a0be4d2b2595b5a356995c8d2 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/27ff800-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=cf0d9441cf738541947802398d367d65 2500w" />
|
||||
</Frame>
|
||||
|
||||
## 3. Edit or Delete API Key
|
||||
|
||||
* Go to Developer's Dashboard and click “Edit” button on a specific API Key.
|
||||
* In case the API Key is compromised, you may delete the API Key by clicking the "Delete" button.
|
||||
* You may also update the label and save the changes by clicking "Save" button.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/cf29b58-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=106da6dd2c0954fdac0b343222bd47d0" data-og-width="2372" width="2372" data-og-height="1054" height="1054" data-path="images/reference/cf29b58-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/cf29b58-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=34459564277bfa0cad6f5a700ecf8eb3 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/cf29b58-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=54225845278952d0a07ccec89b21b045 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/cf29b58-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=4504c5e87fc757c04537e3684ee675af 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/cf29b58-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=8b2e7beb62498611215c9380911729e2 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/cf29b58-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=785b9d021240f872e1c5e94253ec59c0 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/cf29b58-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=d595ad19992b79691106f91ff2ef035c 2500w" />
|
||||
</Frame>
|
||||
|
||||
## 4. API Usage Report
|
||||
|
||||
* You can monitor your API usage in the Usage Report section, which provides details such as:
|
||||
|
||||
* Total Monthly API Calls.
|
||||
* Remaining Monthly API Calls.
|
||||
* Rate Limit (Request Per Minute) — maximum number of API requests allowed in one minute.
|
||||
* Last Used — the timestamp of the last used instance.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/c436404-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=731ada28dc58aa21345e3ad74f79638a" data-og-width="2373" width="2373" data-og-height="1047" height="1047" data-path="images/reference/c436404-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/c436404-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=2f15435343b765ff33590235b98bb9ab 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/c436404-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=844e00763035fb01d9b6daed2db54c1d 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/c436404-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=8e2d5ed4c8da42f24554c97051e92d86 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/c436404-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=ba78440ee678f4accc817e389c1b8928 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/c436404-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=403f14e82c4670b20f1440aa482d18c9 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/c436404-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=994b3e54b5d7d9327c4a23e6a28f6088 2500w" />
|
||||
</Frame>
|
||||
|
||||
* You can also check your full historical usage by specifying "API Keys", "timeframe" or "date range". You may export as CSV for more comprehensive view.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/ed3143e-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=fdebb203ab2f8c54dd4d2b57188131e6" data-og-width="2108" width="2108" data-og-height="1328" height="1328" data-path="images/reference/ed3143e-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/ed3143e-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=c396c9240b947a2380f40b4abf463208 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/ed3143e-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=8fc0778d14dad543359ee1f5e484ab2b 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/ed3143e-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=930dac6d510ce69c0261298b752c21c3 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/ed3143e-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=9d617276ba1552ba5053377231c0205c 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/ed3143e-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=b14b89d98e4426e80e8d85b73702f954 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/ed3143e-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=752bf481dc327a547568d4701cd5e531 2500w" />
|
||||
</Frame>
|
||||
|
||||
### Call Consumption Alerts
|
||||
|
||||
You may enable or disable call consumption alerts in the tab below to receive emails when specific credit usage thresholds are reached.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/752e839-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=0152d66e48fe99fe40f6738f1b9a196c" data-og-width="2112" width="2112" data-og-height="1044" height="1044" data-path="images/reference/752e839-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/752e839-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=7c1eb5850e0ed72d674e76be142a2e05 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/752e839-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=64e6884c71f6e9514b1a76fffccbc3ee 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/752e839-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=bec801fac3b85f6cfa6b662ae626eab3 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/752e839-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=d7b15b7e7df828c7872fa2a523138473 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/752e839-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=4787aae81682669a51ce54dd9d830941 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/752e839-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=09437ce25f2f9d9c42018967537b0d13 2500w" />
|
||||
</Frame>
|
||||
|
||||
### Overage Option (Beta)
|
||||
|
||||
* The overage option enables you to make API calls when your usage exceeds the monthly credits.
|
||||
* You can activate the overage option by clicking the "Turn On Overage" button, ensuring uninterrupted service and allowing you to continue making API calls or vice versa.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/b4711e6-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=6d293516eea9798436bd1a28fcf55cd8" data-og-width="2218" width="2218" data-og-height="1074" height="1074" data-path="images/reference/b4711e6-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/b4711e6-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=3fc7358d6a4b47e0ac5b9ab1170731ea 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/b4711e6-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=50aac137f52b5c6d3ff3c0dfbcf440ed 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/b4711e6-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=5c0a29a1fb4d1a16e588c2ab1d7725df 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/b4711e6-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=96aab6a665b736e7eff55b04f2202346 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/b4711e6-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=56b3971e1aaa69dc6ed99ee745fe6f7a 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/reference/b4711e6-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=a090e24c154fffcc39f4fc8c069840bb 2500w" />
|
||||
</Frame>
|
||||
|
||||
---
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
||||
# Coingecko - Contract
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## NFTs Collection Data by Contract Address
|
||||
|
||||
**URL:** llms-txt#nfts-collection-data-by-contract-address
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/nfts-contract-address
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /nfts/{asset_platform_id}/contract/{contract_address}
|
||||
This endpoint allows you to **query all the NFT data (name, floor price, 24hr volume ...) based on the NFT collection contract address and respective asset platform**
|
||||
|
||||
* You may also obtain the asset platform id and contract address through [/nfts/list](https://docs.coingecko.com/v3.0.1/reference/nfts-list) endpoint.
|
||||
</Tip>
|
||||
|
||||
* Solana NFT & Art Blocks are not supported for this endpoint, please use [/nfts/\{id}](https://docs.coingecko.com/v3.0.1/reference/nfts-id) endpoint instead.
|
||||
* Cache / Update Frequency: every 60 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
@@ -1,259 +0,0 @@
|
||||
# Coingecko - Exchanges
|
||||
|
||||
**Pages:** 14
|
||||
|
||||
---
|
||||
|
||||
## Exchange Volume Chart by ID
|
||||
|
||||
**URL:** llms-txt#exchange-volume-chart-by-id
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/exchanges-id-volume-chart
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /exchanges/{id}/volume_chart
|
||||
This endpoint allows you to **query the historical volume chart data with time in UNIX and trading volume data in BTC based on exchange's ID**
|
||||
|
||||
* You can use this endpoint to query the historical volume chart data of **derivatives exchanges** as well.
|
||||
* The exchange volume in the response is provided in BTC. To convert it to other currencies, please use [/exchange\_rates](https://docs.coingecko.com/v3.0.1/reference/exchange-rates) endpoint.
|
||||
* Data granularity is automatic (cannot be adjusted):
|
||||
* 1 day = 10-minutely
|
||||
* 7, 14 days = hourly
|
||||
* 30 days & above = daily
|
||||
* Cache / Update Frequency: every 60 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Derivatives Tickers List
|
||||
|
||||
**URL:** llms-txt#derivatives-tickers-list
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/derivatives-tickers
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /derivatives
|
||||
This endpoint allows you to **query all the tickers from derivatives exchanges on CoinGecko**
|
||||
|
||||
* Data for `open_interest` and `volume_24h` in the endpoint responses are in USD.
|
||||
* Cache / Update Frequency: every 30 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## 💼 Exchange Volume Chart within Time Range by ID
|
||||
|
||||
**URL:** llms-txt#💼-exchange-volume-chart-within-time-range-by-id
|
||||
|
||||
Source: https://docs.coingecko.com/reference/exchanges-id-volume-chart-range
|
||||
|
||||
reference/api-reference/coingecko-pro.json get /exchanges/{id}/volume_chart/range
|
||||
This endpoint allows you to **query the historical volume chart data in BTC by specifying date range in UNIX based on exchange's ID**
|
||||
|
||||
* You can query the historical volume chart data of **derivatives exchanges** with this endpoint as well.
|
||||
* The data interval for this endpoint is fixed at daily.
|
||||
* The date range between `from` and `to` must be within 31 days.
|
||||
* Cache/Update Frequency: 5 minutes
|
||||
* Exclusive for Paid Plan Subscribers (Analyst, Lite, Pro and Enterprise)
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Derivatives Exchange Data by ID
|
||||
|
||||
**URL:** llms-txt#derivatives-exchange-data-by-id
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges-id
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /derivatives/exchanges/{id}
|
||||
This endpoint allows you to **query the derivatives exchange's related data (ID, name, open interest, ...) based on the exchanges' ID**
|
||||
|
||||
* For `include_tickers` param, you may change the value to either `all` to include all the tickers or `unexpired` to include unexpired tickers in the responses. You may leave it blank to omit the tickers data.
|
||||
</Tip>
|
||||
|
||||
* Cache / Update Frequency: every 30 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Supported Dexes List by Network (ID Map)
|
||||
|
||||
**URL:** llms-txt#supported-dexes-list-by-network-(id-map)
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/dexes-list
|
||||
|
||||
v3.0.1/reference/api-reference/onchain-demo.json get /networks/{network}/dexes
|
||||
This endpoint allows you to **query all the supported decentralized exchanges (DEXs) based on the provided network on GeckoTerminal**
|
||||
|
||||
* You may use this endpoint to query the list of DEXs with DEX ID for other endpoints that contain params like `dex`.
|
||||
* You may include values such as `page` to specify which page of responses you would like to show.
|
||||
</Tip>
|
||||
|
||||
---
|
||||
|
||||
## Exchanges List with data
|
||||
|
||||
**URL:** llms-txt#exchanges-list-with-data
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/exchanges
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /exchanges
|
||||
This endpoint allows you to **query all the supported exchanges with exchanges' data (ID, name, country, ...) that have active trading volumes on CoinGecko**
|
||||
|
||||
* You may include values such as `per_page` and `page` to specify how many results you would like to show in the responses per page and which page of responses you would like to show.
|
||||
</Tip>
|
||||
|
||||
* All the exchanges in the responses are the exchanges with active trading volume on CoinGecko, any inactive or deactivated exchanges will be removed from the list.
|
||||
* Cache / Update Frequency: every 60 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Derivatives Exchanges List with Data
|
||||
|
||||
**URL:** llms-txt#derivatives-exchanges-list-with-data
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /derivatives/exchanges
|
||||
This endpoint allows you to **query all the derivatives exchanges with related data (ID, name, open interest, ...) on CoinGecko**
|
||||
|
||||
* You may include values such as `per_page` and `page` to specify how many results you would like to show in the responses per page and which page of responses you would like to show.
|
||||
</Tip>
|
||||
|
||||
* Cache / Update Frequency: every 60 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Exchanges List (ID Map)
|
||||
|
||||
**URL:** llms-txt#exchanges-list-(id-map)
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/exchanges-list
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /exchanges/list
|
||||
This endpoint allows you to **query all the exchanges with ID and name**
|
||||
|
||||
* You may use this endpoint to query the list of exchanges including **derivatives exchanges** for other endpoints that contain params like `id`(exchange ID).
|
||||
</Tip>
|
||||
|
||||
* There is no pagination required for this endpoint.
|
||||
* Cache / Update Frequency: every 5 minutes for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## 💼 Global Market Cap Chart Data
|
||||
|
||||
**URL:** llms-txt#💼-global-market-cap-chart-data
|
||||
|
||||
Source: https://docs.coingecko.com/reference/global-market-cap-chart
|
||||
|
||||
reference/api-reference/coingecko-pro.json get /global/market_cap_chart
|
||||
This endpoint allows you to **query historical global market cap and volume data by number of days away from now**
|
||||
|
||||
* CoinGecko equivalent page: [https://www.coingecko.com/en/global-charts](https://www.coingecko.com/en/global-charts).
|
||||
* Data Granularity (auto):
|
||||
* 1 day from now = **hourly** data
|
||||
* 2 days & above from now = **daily** data
|
||||
* Exclusive for all Paid Plan Subscribers (Analyst, Lite, Pro and Enterprise).
|
||||
* The last completed UTC day (00:00) is available 5 minutes after midnight on the next UTC day (00:05). The cache will **always expire at 00:05 UTC**. If you wish to get the latest daily data (00:00 UTC), you can make request at 00:05 UTC or later.
|
||||
* Cache / Update Frequency: every 1 minute.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## 💼 NFTs List with Market Data
|
||||
|
||||
**URL:** llms-txt#💼-nfts-list-with-market-data
|
||||
|
||||
Source: https://docs.coingecko.com/reference/nfts-markets
|
||||
|
||||
reference/api-reference/coingecko-pro.json get /nfts/markets
|
||||
This endpoint allows you to **query all the supported NFT collections with floor price, market cap, volume and market related data on CoinGecko**
|
||||
|
||||
* You may include values such as `per_page` and `page` to specify how many results you would like to show in the responses per page and which page of responses you would like to show.
|
||||
</Tip>
|
||||
|
||||
* Cache / Update Frequency: every 5 minutes.
|
||||
* Exclusive for Paid Plan Subscribers (Analyst, Lite, Pro and Enterprise).
|
||||
* CoinGecko equivalent page: [https://www.coingecko.com/en/nft](https://www.coingecko.com/en/nft).
|
||||
* Some collection with low liquidity may not be ranked by Market Cap value, learn more [here](https://support.coingecko.com/hc/en-us/articles/37226121227545-What-is-NFT-Market-Cap). Sorting by Mcap ranking will first prioritise Market Cap value of liquid NFT collections, then followed by trading volume of illiquid NFT collections.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Exchange Tickers by ID
|
||||
|
||||
**URL:** llms-txt#exchange-tickers-by-id
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/exchanges-id-tickers
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /exchanges/{id}/tickers
|
||||
This endpoint allows you to **query exchange's tickers based on exchange's ID**
|
||||
|
||||
* Responses are paginated and limited to 100 tickers per page. You may specify the page number using the `page` params to retrieve the tickers accordingly.
|
||||
* `order=base_target` sorts tickers by `base` symbol, then `target` symbol, in lexicographical order (`0 -> 9`, followed by `a -> z`).\
|
||||
This sorting method ensures stable pagination results, minimizing cases where cached responses might otherwise cause duplicate or missing tickers across paginated pages.
|
||||
* When `dex_pair_format=symbol`, the DEX pair `base` and `target` are displayed in symbol format (e.g. `WETH`, `USDC`) instead of as contract addresses.
|
||||
* Cache / Update Frequency: every 60 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## BTC-to-Currency Exchange Rates
|
||||
|
||||
**URL:** llms-txt#btc-to-currency-exchange-rates
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/exchange-rates
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /exchange_rates
|
||||
This endpoint allows you to **query BTC exchange rates with other currencies**
|
||||
|
||||
* You may use this endpoint to convert the response data, which is originally in BTC, to other currencies.
|
||||
</Tip>
|
||||
|
||||
* Cache / Update Frequency: every 5 minutes for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Exchange Data by ID
|
||||
|
||||
**URL:** llms-txt#exchange-data-by-id
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/exchanges-id
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /exchanges/{id}
|
||||
This endpoint allows you to **query exchange's data (name, year established, country, ...), exchange volume in BTC and top 100 tickers based on exchange's ID**
|
||||
|
||||
<Warning>
|
||||
### Notice
|
||||
|
||||
* Please note that the `trade_volume_24h_btc_normalized` data field will no longer be supported by our API starting on June 15, 2025. Please refer to [changelog](https://docs.coingecko.com/changelog#may-2025) for more details.
|
||||
</Warning>
|
||||
|
||||
* The exchange volume in the response is provided in BTC. To convert it to other currencies, please use [/exchange\_rates](https://docs.coingecko.com/v3.0.1/reference/exchange-rates) endpoint.
|
||||
* For derivatives (e.g. bitmex, binance\_futures), to get derivatives exchanges data, please go to [/derivatives/exchange/\{id}](https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges-id) endpoint.
|
||||
* Tickers are limited to 100 items, to get more tickers, please go to [/exchanges/\{id}/tickers](https://docs.coingecko.com/v3.0.1/reference/exchanges-id-tickers) endpoint.
|
||||
* When `dex_pair_format=symbol`, the DEX pair `base` and `target` are displayed in symbol format (e.g. `WETH`, `USDC`) instead of as contract addresses.
|
||||
* Cache / Update Frequency: every 60 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Derivatives Exchanges List (ID Map)
|
||||
|
||||
**URL:** llms-txt#derivatives-exchanges-list-(id-map)
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges-list
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /derivatives/exchanges/list
|
||||
This endpoint allows you to **query all the derivatives exchanges with ID and name on CoinGecko**
|
||||
|
||||
* You may use this endpoint to query the list of exchanges for other endpoints that contain params like `id` (derivatives exchange's ID)
|
||||
</Tip>
|
||||
|
||||
* Cache / Update Frequency: every 5 minutes for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
@@ -1,47 +0,0 @@
|
||||
# Coingecko Documentation Index
|
||||
|
||||
## Categories
|
||||
|
||||
### Authentication
|
||||
**File:** `authentication.md`
|
||||
**Pages:** 3
|
||||
|
||||
### Coins
|
||||
**File:** `coins.md`
|
||||
**Pages:** 65
|
||||
|
||||
### Contract
|
||||
**File:** `contract.md`
|
||||
**Pages:** 1
|
||||
|
||||
### Exchanges
|
||||
**File:** `exchanges.md`
|
||||
**Pages:** 14
|
||||
|
||||
### Introduction
|
||||
**File:** `introduction.md`
|
||||
**Pages:** 4
|
||||
|
||||
### Market Data
|
||||
**File:** `market_data.md`
|
||||
**Pages:** 3
|
||||
|
||||
### Nfts
|
||||
**File:** `nfts.md`
|
||||
**Pages:** 2
|
||||
|
||||
### Other
|
||||
**File:** `other.md`
|
||||
**Pages:** 16
|
||||
|
||||
### Pricing
|
||||
**File:** `pricing.md`
|
||||
**Pages:** 1
|
||||
|
||||
### Reference
|
||||
**File:** `reference.md`
|
||||
**Pages:** 9
|
||||
|
||||
### Trending
|
||||
**File:** `trending.md`
|
||||
**Pages:** 2
|
||||
@@ -1,392 +0,0 @@
|
||||
# Coingecko - Introduction
|
||||
|
||||
**Pages:** 4
|
||||
|
||||
---
|
||||
|
||||
## 🔥 Getting Started
|
||||
|
||||
**URL:** llms-txt#🔥-getting-started
|
||||
|
||||
**Contents:**
|
||||
- Which MCP Server Should You Use?
|
||||
- 🔗 Endpoint Options
|
||||
- Primary Endpoint (HTTP Streaming)
|
||||
- Alternative Endpoint (SSE — Server-Sent Events)
|
||||
- Remote Server (Public, Keyless)
|
||||
- Remote Server (Authenticated)
|
||||
- Step 1: Add the configuration
|
||||
- Step 2: Authorize your MCP access
|
||||
- Local Server (API Key Required)
|
||||
|
||||
Connecting your AI to CoinGecko is simple. We offer several MCP server options to fit your needs, from keyless access for testing to authenticated connections for production applications.
|
||||
|
||||
Most MCP-compatible clients, like Claude Desktop, Gemini CLI, and Cursor, can be configured using a simple JSON file (e.g., `claude_desktop_config.json`)
|
||||
|
||||
<Note>
|
||||
### Prerequisites
|
||||
|
||||
* Make sure your device has `node` installed. You can download it from [nodejs.org/download](https://nodejs.org/en/download)
|
||||
</Note>
|
||||
|
||||
## Which MCP Server Should You Use?
|
||||
|
||||
Here's a breakdown of the available options to help you choose the right one:
|
||||
|
||||
| MCP Server Type | Best For | Endpoints | Status | Setup Details |
|
||||
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ----------- | ----------------------------------------------------------------------------- |
|
||||
| Remote Server (Public, Keyless) | - First-time users, quick tests, and basic queries<br />- Connect instantly without any registration<br />- Subject to shared rate limits, not for heavy use | Primary: `/mcp`<br />Alternative: `/sse` | Public Beta | [mcp.api.coingecko.com](https://mcp.api.coingecko.com/) |
|
||||
| Remote Server (Authenticated) | - Scalable apps, AI agent integrations<br />- Unlocks 76+ tools available under your Demo/Pro plan<br />- Higher, reliable rate limits with 24/7 uptime. Get your API key [here](https://www.coingecko.com/en/api/pricing) | Primary: `/mcp`<br />Alternative: `/sse` | Public Beta | [mcp.pro-api.coingecko.com](https://mcp.pro-api.coingecko.com/) |
|
||||
| Local Server | - Ideal for local development, desktop AI apps<br />- Build/test your AI app even without an active internet connection<br />- Demo/Pro API key to access more tools. Get your API key [here](https://www.coingecko.com/en/api/pricing) | Local server instance | Beta | [npmjs/coingecko-mcp](https://www.npmjs.com/package/@coingecko/coingecko-mcp) |
|
||||
|
||||
## 🔗 Endpoint Options
|
||||
|
||||
Each remote server offers two connection methods to ensure compatibility with various MCP clients:
|
||||
|
||||
### Primary Endpoint (HTTP Streaming)
|
||||
|
||||
* **Public Server**: `https://mcp.api.coingecko.com/mcp`
|
||||
* **Pro Server**: `https://mcp.pro-api.coingecko.com/mcp`
|
||||
* Uses HTTP streaming protocol for real-time data transfer.
|
||||
* Recommended for most modern MCP clients.
|
||||
|
||||
### Alternative Endpoint (SSE — Server-Sent Events)
|
||||
|
||||
* **Public Server**: `https://mcp.api.coingecko.com/sse`
|
||||
* **Pro Server**: `https://mcp.pro-api.coingecko.com/sse`
|
||||
* Uses Server-Sent Events for compatibility.
|
||||
* Use this if you encounter connection issues with the primary endpoint.
|
||||
|
||||
<Note>
|
||||
Most clients work with either endpoint. The configuration examples below use the SSE endpoint by default for maximum compatibility.
|
||||
</Note>
|
||||
|
||||
## Remote Server (Public, Keyless)
|
||||
|
||||
The easiest way to get started. Just add the following to your client's `mcp_config.json` file.
|
||||
|
||||
<Note>
|
||||
### Client-Specific Config
|
||||
|
||||
The file name and location depend on your client. Find your config file here: [modelcontextprotocol.io/quickstart](https://modelcontextprotocol.io/quickstart/user#2-add-the-filesystem-mcp-server)
|
||||
</Note>
|
||||
|
||||
Add the following configuration to your `mcp_config.json`:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
Here's a quick 2-minute tutorial for setting up the public server with Claude Desktop:
|
||||
|
||||
<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/PDYJvtKok0E" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
|
||||
|
||||
## Remote Server (Authenticated)
|
||||
|
||||
To access more tools and higher rate limits, use your CoinGecko API key with our hosted "Bring Your Own Key" (BYOK) server. Get your API key [here](https://www.coingecko.com/en/api/pricing)
|
||||
|
||||
### Step 1: Add the configuration
|
||||
|
||||
Add the following configuration to your `mcp_config.json`:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### Step 2: Authorize your MCP access
|
||||
|
||||
After adding the config, the first time your client tries to use the CoinGecko MCP, a new browser tab will open, redirecting you to our authentication page:
|
||||
|
||||
<img src="https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=c40d3876ad3b12c0c3177231e8642bf7" alt="" data-og-width="1627" width="1627" data-og-height="1611" height="1611" data-path="images/reference/0fd54e7-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=280&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=b44038862f84320e55096acf29d704ab 280w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=560&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=d7518c452993e3c2191de720716fc28a 560w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=840&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=f4e361fa7c96759e52cf23b245e44bfc 840w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=1100&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=41d3e848470a50259a8aabd2f11f879d 1100w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=1650&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=4767ab92447bc5ba7a7f1ed2994945ea 1650w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=2500&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=686d5177b5697a4561eae0f10f157694 2500w" />
|
||||
|
||||
* Simply paste in your CoinGecko API key, and authorize to link your key to the MCP session.
|
||||
|
||||
✨ Don't have an API key yet? Upgrade to Pro today! Read more [here](https://www.coingecko.com/en/api/pricing).
|
||||
|
||||
* You can also toggle between dynamic/static tools here. Learn more about [Dynamic Tools](#dynamic-vs-static-tools).
|
||||
|
||||
## Local Server (API Key Required)
|
||||
|
||||
For local development and maximum control, run the MCP server directly on your machine. This method offers the rate limits based on your API plan.
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
✨ Don't have an API key yet? Get your free Demo key or upgrade to Pro! Read more [here](https://www.coingecko.com/en/api/pricing).
|
||||
|
||||
* Configure the `env` based on your API key tier:
|
||||
|
||||
* Pro API access:
|
||||
<CodeGroup>
|
||||
|
||||
</CodeGroup>
|
||||
* Demo API access:
|
||||
<CodeGroup>
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
</CodeGroup>
|
||||
|
||||
Here's a quick 2-minute tutorial for setting up the public server with Claude Desktop:
|
||||
|
||||
<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/PDYJvtKok0E" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
|
||||
|
||||
## Remote Server (Authenticated)
|
||||
|
||||
To access more tools and higher rate limits, use your CoinGecko API key with our hosted "Bring Your Own Key" (BYOK) server. Get your API key [here](https://www.coingecko.com/en/api/pricing)
|
||||
|
||||
### Step 1: Add the configuration
|
||||
|
||||
Add the following configuration to your `mcp_config.json`:
|
||||
|
||||
<CodeGroup>
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
</CodeGroup>
|
||||
|
||||
### Step 2: Authorize your MCP access
|
||||
|
||||
After adding the config, the first time your client tries to use the CoinGecko MCP, a new browser tab will open, redirecting you to our authentication page:
|
||||
|
||||
<img src="https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=c40d3876ad3b12c0c3177231e8642bf7" alt="" data-og-width="1627" width="1627" data-og-height="1611" height="1611" data-path="images/reference/0fd54e7-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=280&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=b44038862f84320e55096acf29d704ab 280w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=560&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=d7518c452993e3c2191de720716fc28a 560w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=840&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=f4e361fa7c96759e52cf23b245e44bfc 840w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=1100&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=41d3e848470a50259a8aabd2f11f879d 1100w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=1650&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=4767ab92447bc5ba7a7f1ed2994945ea 1650w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/0fd54e7-image.png?w=2500&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=686d5177b5697a4561eae0f10f157694 2500w" />
|
||||
|
||||
* Simply paste in your CoinGecko API key, and authorize to link your key to the MCP session.
|
||||
|
||||
✨ Don't have an API key yet? Upgrade to Pro today! Read more [here](https://www.coingecko.com/en/api/pricing).
|
||||
|
||||
* You can also toggle between dynamic/static tools here. Learn more about [Dynamic Tools](#dynamic-vs-static-tools).
|
||||
|
||||
## Local Server (API Key Required)
|
||||
|
||||
For local development and maximum control, run the MCP server directly on your machine. This method offers the rate limits based on your API plan.
|
||||
|
||||
<CodeGroup>
|
||||
```
|
||||
|
||||
Example 3 (unknown):
|
||||
```unknown
|
||||
</CodeGroup>
|
||||
|
||||
✨ Don't have an API key yet? Get your free Demo key or upgrade to Pro! Read more [here](https://www.coingecko.com/en/api/pricing).
|
||||
|
||||
* Configure the `env` based on your API key tier:
|
||||
|
||||
* Pro API access:
|
||||
<CodeGroup>
|
||||
```
|
||||
|
||||
Example 4 (unknown):
|
||||
```unknown
|
||||
</CodeGroup>
|
||||
* Demo API access:
|
||||
<CodeGroup>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Endpoint Overview
|
||||
|
||||
**URL:** llms-txt#endpoint-overview
|
||||
|
||||
**Contents:**
|
||||
- CoinGecko Endpoints: Coins
|
||||
- CoinGecko Endpoints: NFT
|
||||
- CoinGecko Endpoints: Exchanges & Derivatives
|
||||
- CoinGecko Endpoints: Public Treasuries
|
||||
- CoinGecko Endpoints: General
|
||||
- Onchain DEX Endpoints (GeckoTerminal)
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/endpoint-overview
|
||||
|
||||
Any exclusive endpoints for Pro-API users (any paid plan subscribers) will not be included here.
|
||||
|
||||
For a full list of endpoints, please visit [Pro API Documentation](https://docs.coingecko.com/reference/endpoint-overview) instead.
|
||||
</Note>
|
||||
|
||||
## CoinGecko Endpoints: Coins
|
||||
|
||||
| Endpoint | Description |
|
||||
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [/ping](https://docs.coingecko.com/v3.0.1/reference/ping-server) | Check the API server status |
|
||||
| [/simple/price](https://docs.coingecko.com/v3.0.1/reference/simple-price) | Query the prices of one or more coins by using their unique Coin API IDs |
|
||||
| [/simple/token\_price/\{id}](https://docs.coingecko.com/v3.0.1/reference/simple-token-price) | Query the prices of one or more coins by using their unique Coin API IDs |
|
||||
| [/simple/supported\_vs\_currencies](https://docs.coingecko.com/v3.0.1/reference/simple-supported-currencies) | Query all the supported currencies on CoinGecko |
|
||||
| [/coins/list](https://docs.coingecko.com/v3.0.1/reference/coins-list) | Query all the supported coins on CoinGecko with coins ID, name and symbol |
|
||||
| [/coins/markets](https://docs.coingecko.com/v3.0.1/reference/coins-markets) | Query all the supported coins with price, market cap, volume and market related data |
|
||||
| [/coins/\{id}](https://docs.coingecko.com/v3.0.1/reference/coins-id) | Query all the metadata (image, websites, socials, description, contract address, etc.) from the CoinGecko coin page based on a particular coin ID |
|
||||
| [/coins/\{id}/tickers](https://docs.coingecko.com/v3.0.1/reference/coins-id-tickers) | Query the coin tickers on both centralized exchange (CEX) and decentralized exchange (DEX) based on a particular coin ID |
|
||||
| [/coins/\{id}/history](https://docs.coingecko.com/v3.0.1/reference/coins-id-history) | Query the historical data (price, market cap, 24hr volume, ...) at a given date for a coin based on a particular coin ID |
|
||||
| [/coins/\{id}/market\_chart](https://docs.coingecko.com/v3.0.1/reference/coins-id-market-chart) | Get the historical chart data of a coin including time in UNIX, price, market cap and 24hr volume based on particular coin ID |
|
||||
| [/coins/\{id}/market\_chart/range](https://docs.coingecko.com/v3.0.1/reference/coins-id-market-chart-range) | Get the historical chart data of a coin within certain time range in UNIX along with price, market cap and 24hr volume based on particular coin ID |
|
||||
| [/coins-id-ohlc](https://docs.coingecko.com/v3.0.1/reference/coins-id-ohlc) | Get the OHLC chart (Open, High, Low, Close) of a coin based on particular coin ID |
|
||||
| [/coins/../contract/..](https://docs.coingecko.com/v3.0.1/reference/coins-contract-address) | Query all the metadata (image, websites, socials, description, contract address, etc.) from the CoinGecko coin page based on an asset platform and a particular token contract address |
|
||||
| [/coins/../contract/../market\_chart](https://docs.coingecko.com/v3.0.1/reference/contract-address-market-chart) | Get the historical chart data including time in UNIX, price, market cap and 24hr volume based on asset platform and particular token contract address |
|
||||
| [/coins/../contract/../market\_chart/range](https://docs.coingecko.com/v3.0.1/reference/contract-address-market-chart-range) | Get the historical chart data within certain time range in UNIX along with price, market cap and 24hr volume based on asset platform and particular token contract address |
|
||||
| [/coins/categories/list](https://docs.coingecko.com/v3.0.1/reference/coins-categories-list) | Query all the coins categories on CoinGecko |
|
||||
| [/coins/categories](https://docs.coingecko.com/v3.0.1/reference/coins-categories) | Query all the coins categories with market data (market cap, volume, ...) on CoinGecko |
|
||||
|
||||
## CoinGecko Endpoints: NFT
|
||||
|
||||
| Endpoint | Description |
|
||||
| --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [/nfts/list](https://docs.coingecko.com/v3.0.1/reference/nfts-list) | Query all supported NFTs with ID, contract address, name, asset platform ID and symbol on CoinGecko |
|
||||
| [/nfts/..](https://docs.coingecko.com/v3.0.1/reference/nfts-id) | Query all the NFT data (name, floor price, 24hr volume, ...) based on the NFT collection ID |
|
||||
| [/nfts/../contract/..](https://docs.coingecko.com/v3.0.1/reference/nfts-contract-address) | Query all the NFT data (name, floor price, 24hr volume, ...) based on the NFT collection contract address and respective asset platform |
|
||||
|
||||
## CoinGecko Endpoints: Exchanges & Derivatives
|
||||
|
||||
| Endpoint | Description |
|
||||
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [/exchanges](https://docs.coingecko.com/v3.0.1/reference/exchanges) | Query all the supported exchanges with exchanges' data (ID, name, country, ...) that have active trading volumes on CoinGecko |
|
||||
| [/exchanges/list](https://docs.coingecko.com/v3.0.1/reference/exchanges-list) | Query all the exchanges with ID and name |
|
||||
| [/exchanges/\{id}](https://docs.coingecko.com/v3.0.1/reference/exchanges-id) | Query exchange's data (name, year established, country, ...), exchange volume in BTC and tickers based on exchange's ID |
|
||||
| [/exchanges/\{id}/tickers](https://docs.coingecko.com/v3.0.1/reference/exchanges-id-tickers) | Query exchange's tickers based on exchange's ID |
|
||||
| [/exchanges/\{id}/volume\_chart](https://docs.coingecko.com/v3.0.1/reference/exchanges-id-volume-chart) | Query the historical volume chart data with time in UNIX and trading volume data in BTC based on exchange's ID |
|
||||
| [/derivatives](https://docs.coingecko.com/v3.0.1/reference/derivatives-tickers) | Query all the tickers from derivatives exchanges on CoinGecko |
|
||||
| [/derivatives/exchanges](https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges) | Query all the derivatives exchanges with related data (ID, name, open interest, ...) on CoinGecko |
|
||||
| [/derivatives/exchanges/\{id}](https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges-id) | Query the derivatives exchange's related data (ID, name, open interest, ...) based on the exchanges' ID |
|
||||
| [/derivatives/exchanges/list](https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges-list) | Query all the derivatives exchanges with ID and name on CoinGecko |
|
||||
|
||||
## CoinGecko Endpoints: Public Treasuries
|
||||
|
||||
| Endpoint | Description |
|
||||
| ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
||||
| [/\{entity}/public\_treasury/\{coin\_id}](https://docs.coingecko.com/reference/companies-public-treasury) | Query public companies & governments' cryptocurrency holdings by coin ID |
|
||||
| [/public\_treasury/\{entity\_id}](https://docs.coingecko.com/reference/public-treasury-entity) | Query public companies & governments' cryptocurrency holdings by entity ID |
|
||||
| [/entities/list](https://docs.coingecko.com/reference/entities-list) | Query all the supported entities on CoinGecko with entities ID, name, symbol, and country |
|
||||
|
||||
## CoinGecko Endpoints: General
|
||||
|
||||
| Endpoint | Description |
|
||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|
||||
| [/exchange\_rates](https://docs.coingecko.com/v3.0.1/reference/exchange-rates) | Query BTC exchange rates with other currencies |
|
||||
| [/asset\_platforms](https://docs.coingecko.com/v3.0.1/reference/asset-platforms-list) | Query all the asset platforms (blockchain networks) on CoinGecko |
|
||||
| [/token\_lists/\{asset\_platform\_id}/all.json](https://docs.coingecko.com/v3.0.1/reference/token-lists) | Get full list of tokens of a blockchain network (asset platform) that is supported by Ethereum token list standard |
|
||||
| [/search](https://docs.coingecko.com/v3.0.1/reference/search-data) | Search for coins, categories and markets listed on CoinGecko |
|
||||
| [/search/trending](https://docs.coingecko.com/v3.0.1/reference/trending-search) | Query trending search coins, NFTs and categories on CoinGecko in the last 24 hours |
|
||||
| [/global](https://docs.coingecko.com/v3.0.1/reference/crypto-global) | Query cryptocurrency global data including active cryptocurrencies, markets, total crypto market cap and etc. |
|
||||
| [/global/decentralized\_finance\_defi](https://docs.coingecko.com/v3.0.1/reference/global-defi) | Query cryptocurrency global decentralized finance (DeFi) data including DeFi market cap, trading volume |
|
||||
|
||||
## Onchain DEX Endpoints (GeckoTerminal)
|
||||
|
||||
| Endpoint | Description |
|
||||
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [/onchain/simple/networks/../token\_price/..](https://docs.coingecko.com/v3.0.1/reference/onchain-simple-price) | Get token price based on the provided token contract address on a network |
|
||||
| [/onchain/networks](https://docs.coingecko.com/v3.0.1/reference/networks-list) | Query all the supported networks on GeckoTerminal |
|
||||
| [/onchain/networks/../dexes](https://docs.coingecko.com/v3.0.1/reference/dexes-list) | Query all the supported decentralized exchanges (DEXs) based on the provided network on GeckoTerminal |
|
||||
| [/onchain/networks/trending\_pools](https://docs.coingecko.com/v3.0.1/reference/trending-pools-list) | Query all the trending pools across all networks on GeckoTerminal |
|
||||
| [/onchain/networks/../trending\_pools](https://docs.coingecko.com/v3.0.1/reference/trending-pools-network) | Query the trending pools based on the provided network |
|
||||
| [/onchain/networks/../pools/..](https://docs.coingecko.com/v3.0.1/reference/pool-address) | Query the specific pool based on the provided network and pool address |
|
||||
| [/onchain/networks/../pools/multi/..](https://docs.coingecko.com/v3.0.1/reference/pools-addresses) | Query multiple pools based on the provided network and pool address |
|
||||
| [/onchain/networks/../pools](https://docs.coingecko.com/v3.0.1/reference/top-pools-network) | Query all the top pools based on the provided network |
|
||||
| [/onchain/networks/../dexes/../pools](https://docs.coingecko.com/v3.0.1/reference/top-pools-dex) | Query all the top pools based on the provided network and decentralized exchange (DEX) |
|
||||
| [/onchain/networks/../new\_pools](https://docs.coingecko.com/v3.0.1/reference/latest-pools-network) | Query all the latest pools based on provided network |
|
||||
| [/onchain/networks/new\_pools](https://docs.coingecko.com/v3.0.1/reference/latest-pools-list) | Query all the latest pools across all networks on GeckoTerminal |
|
||||
| [/onchain/search/pools](https://docs.coingecko.com/v3.0.1/reference/search-pools) | Search for pools on a network |
|
||||
| [/onchain/networks/../tokens/../pools](https://docs.coingecko.com/v3.0.1/reference/top-pools-contract-address) | Query top pools based on the provided token contract address on a network |
|
||||
| [/onchain/networks/../tokens/..](https://docs.coingecko.com/v3.0.1/reference/token-data-contract-address) | Query specific token data based on the provided token contract address on a network |
|
||||
| [/onchain/networks/../tokens/multi/..](https://docs.coingecko.com/v3.0.1/reference/tokens-data-contract-addresses) | Query multiple tokens data based on the provided token contract addresses on a network |
|
||||
| [/onchain/networks/../tokens/../info](https://docs.coingecko.com/v3.0.1/reference/token-info-contract-address) | Query token metadata (name, symbol, CoinGecko ID, image, socials, websites, description, etc.) based on a provided token contract address on a network |
|
||||
| [/onchain/networks/../pools/../info](https://docs.coingecko.com/v3.0.1/reference/pool-token-info-contract-address) | Query pool metadata (base and quote token details, image, socials, websites, description, contract address, etc.) based on a provided pool contract address on a network |
|
||||
| [/onchain/tokens/info\_recently\_updated](https://docs.coingecko.com/v3.0.1/reference/tokens-info-recent-updated) | Query 100 most recently updated tokens info across all networks on GeckoTerminal |
|
||||
| [/onchain/networks/../pools/../ohlcv/..](https://docs.coingecko.com/v3.0.1/reference/pool-ohlcv-contract-address) | Get the OHLCV chart (Open, High, Low, Close, Volume) of a pool based on the provided pool address on a network |
|
||||
| [/onchain/networks/../pools/../trades](https://docs.coingecko.com/v3.0.1/reference/pool-trades-contract-address) | Query the last 300 trades in the past 24 hours based on the provided pool address |
|
||||
|
||||
⚡️ Need Real-time Data Streams? Try [WebSocket API](https://docs.coingecko.com/websocket)
|
||||
|
||||
<a href="/websocket">
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-2.png?fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=2c88f667113256b6285720c468fb53a1" noZoom data-og-width="2400" width="2400" data-og-height="470" height="470" data-path="images/wss-banner-2.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-2.png?w=280&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=d2eafb93fcd670d5df221d617fd6f6a7 280w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-2.png?w=560&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=24f635622a42c0ae03695cc940112699 560w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-2.png?w=840&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=82ef1c05b6f45d6d8ec0bcef0f19d49a 840w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-2.png?w=1100&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=b119e8746bb1a78b759e6d94d96b7c8b 1100w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-2.png?w=1650&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=95797e7366c7f280e3e4b570b6db2b49 1650w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-2.png?w=2500&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=2f120e8a31b5793213494d4ae2d46fb3 2500w" />
|
||||
</Frame>
|
||||
</a>
|
||||
|
||||
With WebSocket, you can now stream ultra-low latency, real-time prices, trades, and OHLCV chart data. <br />
|
||||
Subscribe to our [paid API plan](https://www.coingecko.com/en/api/pricing) (Analyst plan & above) to access WebSocket and REST API data delivery methods.
|
||||
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
**URL:** llms-txt#introduction
|
||||
|
||||
Source: https://docs.coingecko.com/index
|
||||
|
||||
Started in 2014, CoinGecko is the world's largest independent crypto data aggregator that is integrated with more than 1,000 crypto exchanges and lists more than 18,000 coins across 600+ categories. CoinGecko API offers the most comprehensive and reliable crypto market data through RESTful JSON endpoints.
|
||||
|
||||
CoinGecko API now serves **onchain DEX data** across 250+ blockchain networks, 1,700+ decentralized exchanges (DEXes), and 15M+ tokens, powered by GeckoTerminal.
|
||||
|
||||
Thousands of forward-thinking projects, Web3 developers, researchers, institutions, and enterprises use our API to obtain **price feeds, market data, metadata, and historical data of crypto assets, NFTs, and exchanges**.
|
||||
|
||||
Here are some of the **common use cases** for clients who use CoinGecko API:
|
||||
|
||||
* Crypto Exchanges (CEX, DEX), Trading Apps
|
||||
* Wallets (Hot, Cold)
|
||||
* Data Aggregator, Crypto Screener, Analytics Dashboard
|
||||
* AI Agents, DeFAI Apps
|
||||
* Block Explorer, Portfolio Tracker
|
||||
* DeFi Protocols, NFT Marketplaces, Digital Bank
|
||||
* Backtesting Trading Strategy
|
||||
* Accounting, Tax, Audit, HR Payroll
|
||||
* Research & Analysis: Media, Institution, Academic, VC, Financial
|
||||
* Oracles, Bots, Payments, E-commerce
|
||||
|
||||
🔥 New: [WebSocket API](https://docs.coingecko.com/websocket)
|
||||
|
||||
<a href="/websocket">
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-1.png?fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=bd74fb20a26084018272eb6b63010804" noZoom data-og-width="2400" width="2400" data-og-height="470" height="470" data-path="images/wss-banner-1.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-1.png?w=280&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=bc17e03ee25137fbcc1eaac0733e6781 280w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-1.png?w=560&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=d8439f50c69e11ba595b6c07d97eb65c 560w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-1.png?w=840&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=8c232633716268ced5b171e3e38acbf5 840w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-1.png?w=1100&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=3ac0be8afcc3e9fba5b4c4a961c5cda7 1100w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-1.png?w=1650&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=b8e71e426137d6f26642360aa8f1c347 1650w, https://mintcdn.com/coingecko/VlaOc2UnIs8mj72v/images/wss-banner-1.png?w=2500&fit=max&auto=format&n=VlaOc2UnIs8mj72v&q=85&s=eb7699818b518264b9c3c65c5ec5a633 2500w" />
|
||||
</Frame>
|
||||
</a>
|
||||
|
||||
With WebSocket, you can now stream ultra-low latency, real-time prices, trades, and OHLCV chart data. <br />
|
||||
Subscribe to our [paid API plan](https://www.coingecko.com/en/api/pricing) (Analyst plan & above) to access WebSocket and REST API data delivery methods.
|
||||
|
||||
<Columns cols={2}>
|
||||
<Card title="Setting Up Your API Key" icon="key" href="/docs/setting-up-your-api-key">
|
||||
Start by creating your CoinGecko API key
|
||||
</Card>
|
||||
|
||||
<Card title="Building with AI" icon="robot" href="/docs/building-with-ai">
|
||||
Bring CoinGecko data to your AI apps
|
||||
</Card>
|
||||
</Columns>
|
||||
|
||||
export const FooterFix = () => {
|
||||
React.useEffect(() => {
|
||||
const paginationElement = document.getElementById('pagination');
|
||||
if (paginationElement) paginationElement.remove();
|
||||
|
||||
const footerElement = document.getElementById('footer');
|
||||
if (footerElement) footerElement.style.marginTop = '-40px';
|
||||
|
||||
const feedbackToolbarClass = document.querySelector('.feedback-toolbar');
|
||||
if (feedbackToolbarClass) feedbackToolbarClass.style.paddingBottom = '0px';
|
||||
}, []);
|
||||
|
||||
---
|
||||
|
||||
## 📕 Overview
|
||||
|
||||
**URL:** llms-txt#📕-overview
|
||||
|
||||
The official CoinGecko MCP Server is now live, making CoinGecko data readily available to your AI models and applications. With the CoinGecko MCP, you can empower your agents to:
|
||||
|
||||
* **Access real-time market data**: Get aggregated prices, market cap, and trading volume for over 15k+ coins on CoinGecko, integrated across 1,000+ exchanges.
|
||||
* **Dive into onchain analytics**: Query onchain DEX price and liquidity data for more than 8M tokens across 200+ networks via GeckoTerminal.
|
||||
* **Discover market trends**: Instantly find trending coins, new token listings, top gainers/losers, and popular NFT collections.
|
||||
* **Retrieve rich metadata**: Pull essential details like project descriptions, logos, social links, contract addresses, security info, and more.
|
||||
* **Analyze historical performance**: Access historical price, market data, and OHLCV for any cryptocurrency.
|
||||
* **Explore crypto categories**: Effortlessly list coins within specific sectors like Meme, DeFi, Layer 1, AI agent, and more.
|
||||
|
||||
<Frame caption="MCP Demo with Claude Desktop">
|
||||
<img src="https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/8c45171-image.png?fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=a17e15d1b672940226da961086b986ed" data-og-width="2930" width="2930" data-og-height="1882" height="1882" data-path="images/reference/8c45171-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/8c45171-image.png?w=280&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=c026d75329f72ee001fafea1c6d35659 280w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/8c45171-image.png?w=560&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=e90eb94aa0cd98f9409042706e598703 560w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/8c45171-image.png?w=840&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=fd02d8b78f1e6b325e29b59795d1f84f 840w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/8c45171-image.png?w=1100&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=2ef4c5580ce4de3f5caae91b4c9be11d 1100w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/8c45171-image.png?w=1650&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=c9efb0e238afbfe0a3d7bf54ede0c3c1 1650w, https://mintcdn.com/coingecko/b3Fla9Sm0TsVrJN4/images/reference/8c45171-image.png?w=2500&fit=max&auto=format&n=b3Fla9Sm0TsVrJN4&q=85&s=2b8f2e6b387cd3c9f9c229a31c1efe12 2500w" />
|
||||
</Frame>
|
||||
|
||||
---
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,183 +0,0 @@
|
||||
# CoinGecko API
|
||||
|
||||
## Docs
|
||||
|
||||
- [Changelog](https://docs.coingecko.com/changelog.md): Product updates and announcements
|
||||
- [1. Get data by ID or Address](https://docs.coingecko.com/docs/1-get-data-by-id-or-address.md)
|
||||
- [10-mins Tutorial Guide](https://docs.coingecko.com/docs/10-mins-tutorial-guide.md): New to CoinGecko API? Fret not. Whether you're a programmer or someone with zero coding experience, we've got you covered!
|
||||
- [2. Get Historical Data](https://docs.coingecko.com/docs/2-get-historical-data.md)
|
||||
- [3. Get Exchanges & NFT Data](https://docs.coingecko.com/docs/3-get-exchanges-nft-data.md)
|
||||
- [4. Get On-chain Data](https://docs.coingecko.com/docs/4-get-on-chain-data.md)
|
||||
- [AI Prompts](https://docs.coingecko.com/docs/ai-prompts.md): CoinGecko API AI prompt library
|
||||
- [API Status](https://docs.coingecko.com/docs/api-status.md): CoinGecko's API status page provides information on the current status and incident history of CoinGecko API (Public & Pro)
|
||||
- [Best Practices](https://docs.coingecko.com/docs/best-practices.md): Wonder how to use different endpoints together? This is the perfect place for you
|
||||
- [Building with AI](https://docs.coingecko.com/docs/building-with-ai.md): Quick tips to empower your AI applications with CoinGecko API, and leverage our AI capabilities to help you build better and easier.
|
||||
- [Clients](https://docs.coingecko.com/docs/clients.md): Explore client resources, including official Swagger JSON and unofficial Python wrapper
|
||||
- [Common Errors & Rate Limit](https://docs.coingecko.com/docs/common-errors-rate-limit.md)
|
||||
- [Common Use Cases](https://docs.coingecko.com/docs/common-use-cases.md): Discover the common use cases of CoinGecko API by our users
|
||||
- [Endpoint Showcase](https://docs.coingecko.com/docs/endpoint-showcase.md): Discover how CoinGecko API is used at CoinGecko.com and GeckoTerminal.com
|
||||
- [CoinGecko MCP Server (Beta)](https://docs.coingecko.com/docs/mcp-server.md): MCP Server for Crypto Price & Market Data. MCP (Model Context Protocol) is an open standard that allows Large Language Model (LLM) and other AI agents to securely and intelligently interact with external data sources and tools.
|
||||
- [Python AI Prompts](https://docs.coingecko.com/docs/python-ai-prompts.md): A comprehensive AI prompt to guide coding assistants in correctly implementing the official CoinGecko Python SDK for reliable API integration.
|
||||
- [CoinGecko SDK (Beta)](https://docs.coingecko.com/docs/sdk.md): Official CoinGecko Typescript and Python SDKs — Crypto Price & Market Data API
|
||||
- [Setting Up Your API Key](https://docs.coingecko.com/docs/setting-up-your-api-key.md)
|
||||
- [Tutorials (Beginner-friendly)](https://docs.coingecko.com/docs/tutorials-beginner-friendly.md): Using CoinGecko API is super easy, even if you have no programming experience!
|
||||
- [TypeScript AI Prompts](https://docs.coingecko.com/docs/typescript-ai-prompts.md): A comprehensive AI prompt to guide coding assistants in correctly implementing the official CoinGecko TypeScript SDK.
|
||||
- [Useful Links](https://docs.coingecko.com/docs/useful-links.md): Some of the useful links to help you navigate while using the CoinGecko API
|
||||
- [Introduction](https://docs.coingecko.com/index.md)
|
||||
- [💼 API Usage](https://docs.coingecko.com/reference/api-usage.md): This endpoint allows you to **monitor your account's API usage, including rate limits, monthly total credits, remaining credits, and more**
|
||||
- [Asset Platforms List (ID Map)](https://docs.coingecko.com/reference/asset-platforms-list.md): This endpoint allows you to **query all the asset platforms on CoinGecko**
|
||||
- [Authentication (Pro API)](https://docs.coingecko.com/reference/authentication.md): Authentication method for CoinGecko Pro API (Paid plan subscribers with Pro-API keys)
|
||||
- [💼 Categories List](https://docs.coingecko.com/reference/categories-list.md): This endpoint allows you to **query all the supported categories on GeckoTerminal**
|
||||
- [Coins Categories List with Market Data](https://docs.coingecko.com/reference/coins-categories.md): This endpoint allows you to **query all the coins categories with market data (market cap, volume, ...) on CoinGecko**
|
||||
- [Coins Categories List (ID Map)](https://docs.coingecko.com/reference/coins-categories-list.md): This endpoint allows you to **query all the coins categories on CoinGecko**
|
||||
- [Coin Data by Token Address](https://docs.coingecko.com/reference/coins-contract-address.md): This endpoint allows you to **query all the metadata (image, websites, socials, description, contract address, etc.) and market data (price, ATH, exchange tickers, etc.) of a coin from the CoinGecko coin page based on an asset platform and a particular token contract address**
|
||||
- [Coin Data by ID](https://docs.coingecko.com/reference/coins-id.md): This endpoint allows you to **query all the metadata (image, websites, socials, description, contract address, etc.) and market data (price, ATH, exchange tickers, etc.) of a coin from the CoinGecko coin page based on a particular coin ID**
|
||||
- [👑 Circulating Supply Chart by ID](https://docs.coingecko.com/reference/coins-id-circulating-supply-chart.md): This endpoint allows you to **query historical circulating supply of a coin by number of days away from now based on provided coin ID**
|
||||
- [👑 Circulating Supply Chart within Time Range by ID](https://docs.coingecko.com/reference/coins-id-circulating-supply-chart-range.md): This endpoint allows you to **query historical circulating supply of a coin, within a range of timestamp based on the provided coin ID**
|
||||
- [Coin Historical Data by ID](https://docs.coingecko.com/reference/coins-id-history.md): This endpoint allows you to **query the historical data (price, market cap, 24hrs volume, ...) at a given date for a coin based on a particular coin ID**
|
||||
- [Coin Historical Chart Data by ID](https://docs.coingecko.com/reference/coins-id-market-chart.md): This endpoint allows you to **get the historical chart data of a coin including time in UNIX, price, market cap and 24hr volume based on particular coin ID**
|
||||
- [Coin Historical Chart Data within Time Range by ID](https://docs.coingecko.com/reference/coins-id-market-chart-range.md): This endpoint allows you to **get the historical chart data of a coin within certain time range in UNIX along with price, market cap and 24hr volume based on particular coin ID**
|
||||
- [Coin OHLC Chart by ID](https://docs.coingecko.com/reference/coins-id-ohlc.md): This endpoint allows you to **get the OHLC chart (Open, High, Low, Close) of a coin based on particular coin ID**
|
||||
- [💼 Coin OHLC Chart within Time Range by ID](https://docs.coingecko.com/reference/coins-id-ohlc-range.md): This endpoint allows you to **get the OHLC chart (Open, High, Low, Close) of a coin within a range of timestamp based on particular coin ID**
|
||||
- [Coin Tickers by ID](https://docs.coingecko.com/reference/coins-id-tickers.md): This endpoint allows you to **query the coin tickers on both centralized exchange (CEX) and decentralized exchange (DEX) based on a particular coin ID**
|
||||
- [👑 Total Supply Chart by ID](https://docs.coingecko.com/reference/coins-id-total-supply-chart.md): This endpoint allows you to **query historical total supply of a coin by number of days away from now based on provided coin ID**
|
||||
- [👑 Total Supply Chart within time range by ID](https://docs.coingecko.com/reference/coins-id-total-supply-chart-range.md): This endpoint allows you to **query historical total supply of a coin, within a range of timestamp based on the provided coin ID**
|
||||
- [Coins List (ID Map)](https://docs.coingecko.com/reference/coins-list.md): This endpoint allows you to **query all the supported coins on CoinGecko with coins ID, name and symbol**
|
||||
- [💼 Recently Added Coins](https://docs.coingecko.com/reference/coins-list-new.md): This endpoint allows you to **query the latest 200 coins that recently listed on CoinGecko**
|
||||
- [Coins List with Market Data](https://docs.coingecko.com/reference/coins-markets.md): This endpoint allows you to **query all the supported coins with price, market cap, volume and market related data**
|
||||
- [💼 Top Gainers & Losers](https://docs.coingecko.com/reference/coins-top-gainers-losers.md): This endpoint allows you to **query the top 30 coins with largest price gain and loss by a specific time duration**
|
||||
- [Crypto Treasury Holdings by Coin ID](https://docs.coingecko.com/reference/companies-public-treasury.md): This endpoint allows you **query public companies & governments' cryptocurrency holdings** by Coin ID
|
||||
- [Coin Historical Chart Data by Token Address](https://docs.coingecko.com/reference/contract-address-market-chart.md): This endpoint allows you to **get the historical chart data including time in UNIX, price, market cap and 24hr volume based on asset platform and particular token contract address**
|
||||
- [Coin Historical Chart Data within Time Range by Token Address](https://docs.coingecko.com/reference/contract-address-market-chart-range.md): This endpoint allows you to **get the historical chart data within certain time range in UNIX along with price, market cap and 24hr volume based on asset platform and particular token contract address**
|
||||
- [Crypto Global Market Data](https://docs.coingecko.com/reference/crypto-global.md): This endpoint allows you **query cryptocurrency global data including active cryptocurrencies, markets, total crypto market cap and etc**
|
||||
- [Derivatives Exchanges List with Data](https://docs.coingecko.com/reference/derivatives-exchanges.md): This endpoint allows you to **query all the derivatives exchanges with related data (ID, name, open interest, ...) on CoinGecko**
|
||||
- [Derivatives Exchange Data by ID](https://docs.coingecko.com/reference/derivatives-exchanges-id.md): This endpoint allows you to **query the derivatives exchange's related data (ID, name, open interest, ...) based on the exchanges' ID**
|
||||
- [Derivatives Exchanges List (ID Map)](https://docs.coingecko.com/reference/derivatives-exchanges-list.md): This endpoint allows you to **query all the derivatives exchanges with ID and name on CoinGecko**
|
||||
- [Derivatives Tickers List](https://docs.coingecko.com/reference/derivatives-tickers.md): This endpoint allows you to **query all the tickers from derivatives exchanges on CoinGecko**
|
||||
- [Supported Dexes List by Network (ID Map)](https://docs.coingecko.com/reference/dexes-list.md): This endpoint allows you to **query all the supported decentralized exchanges (DEXs) based on the provided network on GeckoTerminal**
|
||||
- [Endpoint Overview](https://docs.coingecko.com/reference/endpoint-overview.md)
|
||||
- [Entities List (ID Map)](https://docs.coingecko.com/reference/entities-list.md): This endpoint allows you to **query all the supported entities on CoinGecko with entities ID, name, symbol, and country**
|
||||
- [BTC-to-Currency Exchange Rates](https://docs.coingecko.com/reference/exchange-rates.md): This endpoint allows you to **query BTC exchange rates with other currencies**
|
||||
- [Exchanges List with data](https://docs.coingecko.com/reference/exchanges.md): This endpoint allows you to **query all the supported exchanges with exchanges' data (ID, name, country, ...) that have active trading volumes on CoinGecko**
|
||||
- [Exchange Data by ID](https://docs.coingecko.com/reference/exchanges-id.md): This endpoint allows you to **query exchange's data (name, year established, country, ...), exchange volume in BTC and top 100 tickers based on exchange's ID**
|
||||
- [Exchange Tickers by ID](https://docs.coingecko.com/reference/exchanges-id-tickers.md): This endpoint allows you to **query exchange's tickers based on exchange's ID**
|
||||
- [Exchange Volume Chart by ID](https://docs.coingecko.com/reference/exchanges-id-volume-chart.md): This endpoint allows you to **query the historical volume chart data with time in UNIX and trading volume data in BTC based on exchange's ID**
|
||||
- [💼 Exchange Volume Chart within Time Range by ID](https://docs.coingecko.com/reference/exchanges-id-volume-chart-range.md): This endpoint allows you to **query the historical volume chart data in BTC by specifying date range in UNIX based on exchange's ID**
|
||||
- [Exchanges List (ID Map)](https://docs.coingecko.com/reference/exchanges-list.md): This endpoint allows you to **query all the exchanges with ID and name**
|
||||
- [Global DeFi Market Data](https://docs.coingecko.com/reference/global-defi.md): This endpoint allows you **query top 100 cryptocurrency global decentralized finance (DeFi) data including DeFi market cap, trading volume**
|
||||
- [💼 Global Market Cap Chart Data](https://docs.coingecko.com/reference/global-market-cap-chart.md): This endpoint allows you to **query historical global market cap and volume data by number of days away from now**
|
||||
- [New Pools List](https://docs.coingecko.com/reference/latest-pools-list.md): This endpoint allows you to **query all the latest pools across all networks on GeckoTerminal**
|
||||
- [New Pools by Network](https://docs.coingecko.com/reference/latest-pools-network.md): This endpoint allows you to **query all the latest pools based on provided network**
|
||||
- [Supported Networks List (ID Map)](https://docs.coingecko.com/reference/networks-list.md): This endpoint allows you to **query all the supported networks on GeckoTerminal**
|
||||
- [NFTs Collection Data by Contract Address](https://docs.coingecko.com/reference/nfts-contract-address.md): This endpoint allows you to **query all the NFT data (name, floor price, 24hr volume ...) based on the NFT collection contract address and respective asset platform**
|
||||
- [💼 NFTs Collection Historical Chart Data by Contract Address](https://docs.coingecko.com/reference/nfts-contract-address-market-chart.md): This endpoint allows you **query historical market data of a NFT collection, including floor price, market cap, and 24hr volume, by number of days away from now based on the provided contract address**
|
||||
- [NFTs Collection Data by ID](https://docs.coingecko.com/reference/nfts-id.md): This endpoint allows you to **query all the NFT data (name, floor price, 24hr volume ...) based on the NFT collection ID**
|
||||
- [💼 NFTs Collection Historical Chart Data by ID](https://docs.coingecko.com/reference/nfts-id-market-chart.md): This endpoint allows you **query historical market data of a NFT collection, including floor price, market cap, and 24hr volume, by number of days away from now**
|
||||
- [💼 NFTs Collection Tickers by ID](https://docs.coingecko.com/reference/nfts-id-tickers.md): This endpoint allows you to **query the latest floor price and 24hr volume of a NFT collection, on each NFT marketplace, e.g. OpenSea and LooksRare**
|
||||
- [NFTs List (ID Map)](https://docs.coingecko.com/reference/nfts-list.md): This endpoint allows you to **query all supported NFTs with ID, contract address, name, asset platform ID and symbol on CoinGecko**
|
||||
- [💼 NFTs List with Market Data](https://docs.coingecko.com/reference/nfts-markets.md): This endpoint allows you to **query all the supported NFT collections with floor price, market cap, volume and market related data on CoinGecko**
|
||||
- [Token Price by Token Addresses](https://docs.coingecko.com/reference/onchain-simple-price.md): This endpoint allows you to **get token price based on the provided token contract address on a network**
|
||||
- [Check API server status](https://docs.coingecko.com/reference/ping-server.md): This endpoint allows you to **check the API server status**
|
||||
- [Specific Pool Data by Pool Address](https://docs.coingecko.com/reference/pool-address.md): This endpoint allows you to **query the specific pool based on the provided network and pool address**
|
||||
- [Pool OHLCV chart by Pool Address](https://docs.coingecko.com/reference/pool-ohlcv-contract-address.md): This endpoint allows you to **get the OHLCV chart (Open, High, Low, Close, Volume) of a pool based on the provided pool address on a network**
|
||||
- [Pool Tokens Info by Pool Address](https://docs.coingecko.com/reference/pool-token-info-contract-address.md): This endpoint allows you to **query pool metadata (base and quote token details, image, socials, websites, description, contract address, etc.) based on a provided pool contract address on a network**
|
||||
- [Past 24 Hour Trades by Pool Address](https://docs.coingecko.com/reference/pool-trades-contract-address.md): This endpoint allows you to **query the last 300 trades in the past 24 hours based on the provided pool address**
|
||||
- [Multiple Pools Data by Pool Addresses](https://docs.coingecko.com/reference/pools-addresses.md): This endpoint allows you to **query multiple pools based on the provided network and pool address**
|
||||
- [💼 Pools by Category ID](https://docs.coingecko.com/reference/pools-category.md): This endpoint allows you to **query all the pools based on the provided category ID**
|
||||
- [🔥 Megafilter for Pools](https://docs.coingecko.com/reference/pools-megafilter.md): This endpoint allows you to **query pools based on various filters across all networks on GeckoTerminal**
|
||||
- [Crypto Treasury Holdings by Entity ID](https://docs.coingecko.com/reference/public-treasury-entity.md): This endpoint allows you **query public companies & governments' cryptocurrency holdings** by Entity ID
|
||||
- [Search Queries](https://docs.coingecko.com/reference/search-data.md): This endpoint allows you to **search for coins, categories and markets listed on CoinGecko**
|
||||
- [Search Pools](https://docs.coingecko.com/reference/search-pools.md): This endpoint allows you to **search for pools on a network**
|
||||
- [Coin Price by IDs](https://docs.coingecko.com/reference/simple-price.md): This endpoint allows you to **query the prices of one or more coins by using their unique Coin API IDs**
|
||||
- [Supported Currencies List](https://docs.coingecko.com/reference/simple-supported-currencies.md): This endpoint allows you to **query all the supported currencies on CoinGecko**
|
||||
- [Coin Price by Token Addresses](https://docs.coingecko.com/reference/simple-token-price.md): This endpoint allows you to **query one or more token prices using their token contract addresses**
|
||||
- [Token Data by Token Address](https://docs.coingecko.com/reference/token-data-contract-address.md): This endpoint allows you to **query specific token data based on the provided token contract address on a network**
|
||||
- [💼 Historical Token Holders Chart by Token Address](https://docs.coingecko.com/reference/token-holders-chart-token-address.md): This endpoint allows you to **get the historical token holders chart based on the provided token contract address on a network**
|
||||
- [Token Info by Token Address](https://docs.coingecko.com/reference/token-info-contract-address.md): This endpoint allows you to **query token metadata (name, symbol, CoinGecko ID, image, socials, websites, description, etc.) based on a provided token contract address on a network**
|
||||
- [Token Lists by Asset Platform ID](https://docs.coingecko.com/reference/token-lists.md): This endpoint allows you to **get full list of tokens of a blockchain network (asset platform) that is supported by [Ethereum token list standard](https://tokenlists.org/)**
|
||||
- [💼 Token OHLCV chart by Token Address](https://docs.coingecko.com/reference/token-ohlcv-token-address.md): This endpoint allows you to **get the OHLCV chart (Open, High, Low, Close, Volume) of a token based on the provided token address on a network**
|
||||
- [💼 Past 24 Hour Trades by Token Address](https://docs.coingecko.com/reference/token-trades-contract-address.md): This endpoint allows you to **query the last 300 trades in the past 24 hours, across all pools, based on the provided token contract address on a network**
|
||||
- [Tokens Data by Token Addresses](https://docs.coingecko.com/reference/tokens-data-contract-addresses.md): This endpoint allows you to **query multiple tokens data based on the provided token contract addresses on a network**
|
||||
- [Most Recently Updated Tokens List](https://docs.coingecko.com/reference/tokens-info-recent-updated.md): This endpoint allows you to **query 100 most recently updated tokens info of a specific network or across all networks on GeckoTerminal**
|
||||
- [Top Pools by Token Address](https://docs.coingecko.com/reference/top-pools-contract-address.md): This endpoint allows you to **query top pools based on the provided token contract address on a network**
|
||||
- [Top Pools by Dex](https://docs.coingecko.com/reference/top-pools-dex.md): This endpoint allows you to **query all the top pools based on the provided network and decentralized exchange (DEX)**
|
||||
- [Top Pools by Network](https://docs.coingecko.com/reference/top-pools-network.md): This endpoint allows you to **query all the top pools based on the provided network**
|
||||
- [💼 Top Token Holders by Token Address](https://docs.coingecko.com/reference/top-token-holders-token-address.md): This endpoint allows you to **query top token holders based on the provided token contract address on a network**
|
||||
- [Trending Pools List](https://docs.coingecko.com/reference/trending-pools-list.md): This endpoint allows you to **query all the trending pools across all networks on GeckoTerminal**
|
||||
- [Trending Pools by Network](https://docs.coingecko.com/reference/trending-pools-network.md): This endpoint allows you to **query the trending pools based on the provided network**
|
||||
- [Trending Search List](https://docs.coingecko.com/reference/trending-search.md): This endpoint allows you **query trending search coins, NFTs and categories on CoinGecko in the last 24 hours**
|
||||
- [💼 Trending Search Pools](https://docs.coingecko.com/reference/trending-search-pools.md): This endpoint allows you to **query all the trending search pools across all networks on GeckoTerminal**
|
||||
- [Asset Platforms List (ID Map)](https://docs.coingecko.com/v3.0.1/reference/asset-platforms-list.md): This endpoint allows you to **query all the asset platforms on CoinGecko**
|
||||
- [Authentication (Public/Demo)](https://docs.coingecko.com/v3.0.1/reference/authentication.md): Authentication method for CoinGecko Public API (Demo plan users)
|
||||
- [Coins Categories List with Market Data](https://docs.coingecko.com/v3.0.1/reference/coins-categories.md): This endpoint allows you to **query all the coins categories with market data (market cap, volume, ...) on CoinGecko**
|
||||
- [Coins Categories List (ID Map)](https://docs.coingecko.com/v3.0.1/reference/coins-categories-list.md): This endpoint allows you to **query all the coins categories on CoinGecko**
|
||||
- [Coin Data by Token Address](https://docs.coingecko.com/v3.0.1/reference/coins-contract-address.md): This endpoint allows you to **query all the metadata (image, websites, socials, description, contract address, etc.) and market data (price, ATH, exchange tickers, etc.) of a coin from the CoinGecko coin page based on an asset platform and a particular token contract address**
|
||||
- [Coin Data by ID](https://docs.coingecko.com/v3.0.1/reference/coins-id.md): This endpoint allows you to **query all the metadata (image, websites, socials, description, contract address, etc.) and market data (price, ATH, exchange tickers, etc.) of a coin from the CoinGecko coin page based on a particular coin ID**
|
||||
- [Coin Historical Data by ID](https://docs.coingecko.com/v3.0.1/reference/coins-id-history.md): This endpoint allows you to **query the historical data (price, market cap, 24hrs volume, ...) at a given date for a coin based on a particular coin ID**
|
||||
- [Coin Historical Chart Data by ID](https://docs.coingecko.com/v3.0.1/reference/coins-id-market-chart.md): This endpoint allows you to **get the historical chart data of a coin including time in UNIX, price, market cap and 24hr volume based on particular coin ID**
|
||||
- [Coin Historical Chart Data within Time Range by ID](https://docs.coingecko.com/v3.0.1/reference/coins-id-market-chart-range.md): This endpoint allows you to **get the historical chart data of a coin within certain time range in UNIX along with price, market cap and 24hr volume based on particular coin ID**
|
||||
- [Coin OHLC Chart by ID](https://docs.coingecko.com/v3.0.1/reference/coins-id-ohlc.md): This endpoint allows you to **get the OHLC chart (Open, High, Low, Close) of a coin based on particular coin ID**
|
||||
- [Coin Tickers by ID](https://docs.coingecko.com/v3.0.1/reference/coins-id-tickers.md): This endpoint allows you to **query the coin tickers on both centralized exchange (CEX) and decentralized exchange (DEX) based on a particular coin ID**
|
||||
- [Coins List (ID Map)](https://docs.coingecko.com/v3.0.1/reference/coins-list.md): This endpoint allows you to **query all the supported coins on CoinGecko with coins ID, name and symbol**
|
||||
- [Coins List with Market Data](https://docs.coingecko.com/v3.0.1/reference/coins-markets.md): This endpoint allows you to **query all the supported coins with price, market cap, volume and market related data**
|
||||
- [Crypto Treasury Holdings by Coin ID](https://docs.coingecko.com/v3.0.1/reference/companies-public-treasury.md): This endpoint allows you **query public companies & governments' cryptocurrency holdings** by Coin ID
|
||||
- [Coin Historical Chart Data by Token Address](https://docs.coingecko.com/v3.0.1/reference/contract-address-market-chart.md): This endpoint allows you to **get the historical chart data including time in UNIX, price, market cap and 24hr volume based on asset platform and particular token contract address**
|
||||
- [Coin Historical Chart Data within Time Range by Token Address](https://docs.coingecko.com/v3.0.1/reference/contract-address-market-chart-range.md): This endpoint allows you to **get the historical chart data within certain time range in UNIX along with price, market cap and 24hr volume based on asset platform and particular token contract address**
|
||||
- [Crypto Global Market Data](https://docs.coingecko.com/v3.0.1/reference/crypto-global.md): This endpoint allows you **query cryptocurrency global data including active cryptocurrencies, markets, total crypto market cap and etc**
|
||||
- [Derivatives Exchanges List with Data](https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges.md): This endpoint allows you to **query all the derivatives exchanges with related data (ID, name, open interest, ...) on CoinGecko**
|
||||
- [Derivatives Exchange Data by ID](https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges-id.md): This endpoint allows you to **query the derivatives exchange's related data (ID, name, open interest, ...) based on the exchanges' ID**
|
||||
- [Derivatives Exchanges List (ID Map)](https://docs.coingecko.com/v3.0.1/reference/derivatives-exchanges-list.md): This endpoint allows you to **query all the derivatives exchanges with ID and name on CoinGecko**
|
||||
- [Derivatives Tickers List](https://docs.coingecko.com/v3.0.1/reference/derivatives-tickers.md): This endpoint allows you to **query all the tickers from derivatives exchanges on CoinGecko**
|
||||
- [Supported Dexes List by Network (ID Map)](https://docs.coingecko.com/v3.0.1/reference/dexes-list.md): This endpoint allows you to **query all the supported decentralized exchanges (DEXs) based on the provided network on GeckoTerminal**
|
||||
- [Endpoint Overview](https://docs.coingecko.com/v3.0.1/reference/endpoint-overview.md)
|
||||
- [Entities List (ID Map)](https://docs.coingecko.com/v3.0.1/reference/entities-list.md): This endpoint allows you to **query all the supported entities on CoinGecko with entities ID, name, symbol, and country**
|
||||
- [BTC-to-Currency Exchange Rates](https://docs.coingecko.com/v3.0.1/reference/exchange-rates.md): This endpoint allows you to **query BTC exchange rates with other currencies**
|
||||
- [Exchanges List with data](https://docs.coingecko.com/v3.0.1/reference/exchanges.md): This endpoint allows you to **query all the supported exchanges with exchanges' data (ID, name, country, ...) that have active trading volumes on CoinGecko**
|
||||
- [Exchange Data by ID](https://docs.coingecko.com/v3.0.1/reference/exchanges-id.md): This endpoint allows you to **query exchange's data (name, year established, country, ...), exchange volume in BTC and top 100 tickers based on exchange's ID**
|
||||
- [Exchange Tickers by ID](https://docs.coingecko.com/v3.0.1/reference/exchanges-id-tickers.md): This endpoint allows you to **query exchange's tickers based on exchange's ID**
|
||||
- [Exchange Volume Chart by ID](https://docs.coingecko.com/v3.0.1/reference/exchanges-id-volume-chart.md): This endpoint allows you to **query the historical volume chart data with time in UNIX and trading volume data in BTC based on exchange's ID**
|
||||
- [Exchanges List (ID Map)](https://docs.coingecko.com/v3.0.1/reference/exchanges-list.md): This endpoint allows you to **query all the exchanges with ID and name**
|
||||
- [Global DeFi Market Data](https://docs.coingecko.com/v3.0.1/reference/global-defi.md): This endpoint allows you **query top 100 cryptocurrency global decentralized finance (DeFi) data including DeFi market cap, trading volume**
|
||||
- [New Pools List](https://docs.coingecko.com/v3.0.1/reference/latest-pools-list.md): This endpoint allows you to **query all the latest pools across all networks on GeckoTerminal**
|
||||
- [New Pools by Network](https://docs.coingecko.com/v3.0.1/reference/latest-pools-network.md): This endpoint allows you to **query all the latest pools based on provided network**
|
||||
- [Supported Networks List (ID Map)](https://docs.coingecko.com/v3.0.1/reference/networks-list.md): This endpoint allows you to **query all the supported networks on GeckoTerminal**
|
||||
- [NFTs Collection Data by Contract Address](https://docs.coingecko.com/v3.0.1/reference/nfts-contract-address.md): This endpoint allows you to **query all the NFT data (name, floor price, 24hr volume ...) based on the NFT collection contract address and respective asset platform**
|
||||
- [NFTs Collection Data by ID](https://docs.coingecko.com/v3.0.1/reference/nfts-id.md): This endpoint allows you to **query all the NFT data (name, floor price, 24hr volume ...) based on the NFT collection ID**
|
||||
- [NFTs List (ID Map)](https://docs.coingecko.com/v3.0.1/reference/nfts-list.md): This endpoint allows you to **query all supported NFTs with ID, contract address, name, asset platform ID and symbol on CoinGecko**
|
||||
- [Token Price by Token Addresses](https://docs.coingecko.com/v3.0.1/reference/onchain-simple-price.md): This endpoint allows you to **get token price based on the provided token contract address on a network**
|
||||
- [Check API server status](https://docs.coingecko.com/v3.0.1/reference/ping-server.md): This endpoint allows you to **check the API server status**
|
||||
- [Specific Pool Data by Pool Address](https://docs.coingecko.com/v3.0.1/reference/pool-address.md): This endpoint allows you to **query the specific pool based on the provided network and pool address**
|
||||
- [Pool OHLCV chart by Pool Address](https://docs.coingecko.com/v3.0.1/reference/pool-ohlcv-contract-address.md): This endpoint allows you to **get the OHLCV chart (Open, High, Low, Close, Volume) of a pool based on the provided pool address on a network**
|
||||
- [Pool Tokens Info by Pool Address](https://docs.coingecko.com/v3.0.1/reference/pool-token-info-contract-address.md): This endpoint allows you to **query pool metadata (base and quote token details, image, socials, websites, description, contract address, etc.) based on a provided pool contract address on a network**
|
||||
- [Past 24 Hour Trades by Pool Address](https://docs.coingecko.com/v3.0.1/reference/pool-trades-contract-address.md): This endpoint allows you to **query the last 300 trades in the past 24 hours based on the provided pool address**
|
||||
- [Multiple Pools Data by Pool Addresses](https://docs.coingecko.com/v3.0.1/reference/pools-addresses.md): This endpoint allows you to **query multiple pools based on the provided network and pool address**
|
||||
- [Crypto Treasury Holdings by Entity ID](https://docs.coingecko.com/v3.0.1/reference/public-treasury-entity.md): This endpoint allows you **query public companies & governments' cryptocurrency holdings** by Entity ID
|
||||
- [Search Queries](https://docs.coingecko.com/v3.0.1/reference/search-data.md): This endpoint allows you to **search for coins, categories and markets listed on CoinGecko**
|
||||
- [Search Pools](https://docs.coingecko.com/v3.0.1/reference/search-pools.md): This endpoint allows you to **search for pools on a network**
|
||||
- [Coin Price by IDs](https://docs.coingecko.com/v3.0.1/reference/simple-price.md): This endpoint allows you to **query the prices of one or more coins by using their unique Coin API IDs**
|
||||
- [Supported Currencies List](https://docs.coingecko.com/v3.0.1/reference/simple-supported-currencies.md): This endpoint allows you to **query all the supported currencies on CoinGecko**
|
||||
- [Coin Price by Token Addresses](https://docs.coingecko.com/v3.0.1/reference/simple-token-price.md): This endpoint allows you to **query one or more token prices using their token contract addresses**
|
||||
- [Token Data by Token Address](https://docs.coingecko.com/v3.0.1/reference/token-data-contract-address.md): This endpoint allows you to **query specific token data based on the provided token contract address on a network**
|
||||
- [Token Info by Token Address](https://docs.coingecko.com/v3.0.1/reference/token-info-contract-address.md): This endpoint allows you to **query token metadata (name, symbol, CoinGecko ID, image, socials, websites, description, etc.) based on a provided token contract address on a network**
|
||||
- [Token Lists by Asset Platform ID](https://docs.coingecko.com/v3.0.1/reference/token-lists.md): This endpoint allows you to **get full list of tokens of a blockchain network (asset platform) that is supported by [Ethereum token list standard](https://tokenlists.org/)**
|
||||
- [Tokens Data by Token Addresses](https://docs.coingecko.com/v3.0.1/reference/tokens-data-contract-addresses.md): This endpoint allows you to **query multiple tokens data based on the provided token contract addresses on a network**
|
||||
- [Most Recently Updated Tokens List](https://docs.coingecko.com/v3.0.1/reference/tokens-info-recent-updated.md): This endpoint allows you to **query 100 most recently updated tokens info of a specific network or across all networks on GeckoTerminal**
|
||||
- [Top Pools by Token Address](https://docs.coingecko.com/v3.0.1/reference/top-pools-contract-address.md): This endpoint allows you to **query top pools based on the provided token contract address on a network**
|
||||
- [Top Pools by Dex](https://docs.coingecko.com/v3.0.1/reference/top-pools-dex.md): This endpoint allows you to **query all the top pools based on the provided network and decentralized exchange (DEX)**
|
||||
- [Top Pools by Network](https://docs.coingecko.com/v3.0.1/reference/top-pools-network.md): This endpoint allows you to **query all the top pools based on the provided network**
|
||||
- [Trending Pools List](https://docs.coingecko.com/v3.0.1/reference/trending-pools-list.md): This endpoint allows you to **query all the trending pools across all networks on GeckoTerminal**
|
||||
- [Trending Pools by Network](https://docs.coingecko.com/v3.0.1/reference/trending-pools-network.md): This endpoint allows you to **query the trending pools based on the provided network**
|
||||
- [Trending Search List](https://docs.coingecko.com/v3.0.1/reference/trending-search.md): This endpoint allows you **query trending search coins, NFTs and categories on CoinGecko in the last 24 hours**
|
||||
- [CGSimplePrice](https://docs.coingecko.com/websocket/cgsimpleprice.md): Subscribe to receive real-time price updates for tokens, as seen on CoinGecko.com
|
||||
- [WebSocket (Beta)](https://docs.coingecko.com/websocket/index.md): CoinGecko API: Stream Real-Time Crypto Data with WebSockets
|
||||
- [OnchainSimpleTokenPrice](https://docs.coingecko.com/websocket/onchainsimpletokenprice.md): Subscribe to receive real-time price updates for tokens, as seen on GeckoTerminal.com
|
||||
- [OnchainTrade](https://docs.coingecko.com/websocket/wss-onchain-trade.md): Subscribe to receive real-time transaction (trade/swap) updates for pools, as seen on GeckoTerminal.com
|
||||
- [OnchainOHLCV](https://docs.coingecko.com/websocket/wssonchainohlcv.md): Subscribe to receive real-time OHLCV updates for pools, as seen on GeckoTerminal.com
|
||||
|
||||
|
||||
## Optional
|
||||
|
||||
- [CoinGecko API](https://www.coingecko.com/en/api)
|
||||
- [Case Studies](https://www.coingecko.com/en/api/case-studies)
|
||||
- [Newsletter](https://newsletter.coingecko.com/landing/api_updates_subscribe)
|
||||
- [Feedback](https://docs.google.com/forms/d/e/1FAIpQLSeb7pnl_YaT17IWR5qnZrlmqmZ0xdYaT0JEyVz717Ergd5ptw/viewform)
|
||||
@@ -1,59 +0,0 @@
|
||||
# Coingecko - Market Data
|
||||
|
||||
**Pages:** 3
|
||||
|
||||
---
|
||||
|
||||
## 💼 NFTs Collection Historical Chart Data by ID
|
||||
|
||||
**URL:** llms-txt#💼-nfts-collection-historical-chart-data-by-id
|
||||
|
||||
Source: https://docs.coingecko.com/reference/nfts-id-market-chart
|
||||
|
||||
reference/api-reference/coingecko-pro.json get /nfts/{id}/market_chart
|
||||
This endpoint allows you **query historical market data of a NFT collection, including floor price, market cap, and 24hr volume, by number of days away from now**
|
||||
|
||||
* Data Granularity (auto):
|
||||
* 1-14 days from now = **5-minutely** data
|
||||
* 15 days & above from now = **daily** data (00:00 UTC)
|
||||
* Cache/Update Frequency: every 5 minutes
|
||||
* The last completed UTC day (00:00) is available 5 minutes after midnight on the next UTC day (00:05).
|
||||
* Exclusive for Paid Plan Subscribers (Analyst, Lite, Pro and Enterprise).
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## 💼 NFTs Collection Historical Chart Data by Contract Address
|
||||
|
||||
**URL:** llms-txt#💼-nfts-collection-historical-chart-data-by-contract-address
|
||||
|
||||
Source: https://docs.coingecko.com/reference/nfts-contract-address-market-chart
|
||||
|
||||
reference/api-reference/coingecko-pro.json get /nfts/{asset_platform_id}/contract/{contract_address}/market_chart
|
||||
This endpoint allows you **query historical market data of a NFT collection, including floor price, market cap, and 24hr volume, by number of days away from now based on the provided contract address**
|
||||
|
||||
* This endpoint doesn't support Solana NFT and Art Blocks, please use [/nfts/\{id}/market\_chart](https://docs.coingecko.com/reference/nfts-id-market-chart) endpoint instead.
|
||||
* Data Granularity (auto):
|
||||
* 1-14 days from now = **5-minutely** data
|
||||
* 15 days & above from now = **daily** data (00:00 UTC)
|
||||
* Cache/Update Frequency: every 5 minutes
|
||||
* The last completed UTC day (00:00) is available 5 minutes after midnight on the next UTC day (00:05).
|
||||
* Exclusive for Paid Plan Subscribers (Analyst, Lite, Pro and Enterprise).
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## 💼 NFTs Collection Tickers by ID
|
||||
|
||||
**URL:** llms-txt#💼-nfts-collection-tickers-by-id
|
||||
|
||||
Source: https://docs.coingecko.com/reference/nfts-id-tickers
|
||||
|
||||
reference/api-reference/coingecko-pro.json get /nfts/{id}/tickers
|
||||
This endpoint allows you to **query the latest floor price and 24hr volume of a NFT collection, on each NFT marketplace, e.g. OpenSea and LooksRare**
|
||||
|
||||
* Cache/Update Frequency: every 30 seconds.
|
||||
* Exclusive for Paid Plan Subscribers (Analyst, Lite, Pro and Enterprise).
|
||||
</Note>
|
||||
|
||||
---
|
||||
@@ -1,38 +0,0 @@
|
||||
# Coingecko - Nfts
|
||||
|
||||
**Pages:** 2
|
||||
|
||||
---
|
||||
|
||||
## NFTs Collection Data by ID
|
||||
|
||||
**URL:** llms-txt#nfts-collection-data-by-id
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/nfts-id
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /nfts/{id}
|
||||
This endpoint allows you to **query all the NFT data (name, floor price, 24hr volume ...) based on the NFT collection ID**
|
||||
|
||||
* Cache / Update Frequency: every 60 seconds for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## NFTs List (ID Map)
|
||||
|
||||
**URL:** llms-txt#nfts-list-(id-map)
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/nfts-list
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /nfts/list
|
||||
This endpoint allows you to **query all supported NFTs with ID, contract address, name, asset platform ID and symbol on CoinGecko**
|
||||
|
||||
* You may use this endpoint to query the list of NFTs for other endpoints that contain params like `id` (NFT collection's id) as well as `asset_platform_id` and `contract_address`.
|
||||
* You may include values such as `per_page` and `page` to specify how many results you would like to show in the responses per page and which page of responses you would like to show.
|
||||
</Tip>
|
||||
|
||||
* The responses are paginated to 100 items.
|
||||
* Cache / Update Frequency: every 5 minutes for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,52 +0,0 @@
|
||||
# Coingecko - Pricing
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## Tutorials (Beginner-friendly)
|
||||
|
||||
**URL:** llms-txt#tutorials-(beginner-friendly)
|
||||
|
||||
**Contents:**
|
||||
- 🔤 No Code
|
||||
- 💻 Low Code
|
||||
- 👨💻 Code
|
||||
|
||||
Source: https://docs.coingecko.com/docs/tutorials-beginner-friendly
|
||||
|
||||
Using CoinGecko API is super easy, even if you have no programming experience!
|
||||
|
||||
* [Import Crypto Prices in Google Sheets](https://www.coingecko.com/learn/import-crypto-prices-google-sheets)
|
||||
|
||||
<a href="https://www.coingecko.com/learn/import-crypto-prices-google-sheets" target="_blank" rel="noopener noreferrer">
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/906cac9-image.png?fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=c96bbea598140dba0164bbe3e4f61760" noZoom data-og-width="950" width="950" data-og-height="475" height="475" data-path="images/docs/906cac9-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/906cac9-image.png?w=280&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=d13a6c4da6429b209dae28775142ebe5 280w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/906cac9-image.png?w=560&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=b748519107cdd0675124d4d05f2da490 560w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/906cac9-image.png?w=840&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=0da19082bce7186cb4df2b8c67757994 840w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/906cac9-image.png?w=1100&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=33f43f5a4672be22b501a9c2c157e9ab 1100w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/906cac9-image.png?w=1650&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=fda02e234c3e0dcccef137eb1d0156cc 1650w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/906cac9-image.png?w=2500&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=dd24d20dd9bb7ae493d77aff4ec9b116 2500w" />
|
||||
</Frame>
|
||||
</a>
|
||||
|
||||
* [Import Crypto Prices in Microsoft Excel](https://www.coingecko.com/learn/import-crypto-prices-excel)
|
||||
|
||||
<a href="https://www.coingecko.com/learn/import-crypto-prices-excel" target="_blank" rel="noopener noreferrer">
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/3ee7dca-image.png?fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=461979ff4f88f526da4d96325c619a55" noZoom data-og-width="1472" width="1472" data-og-height="704" height="704" data-path="images/docs/3ee7dca-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/3ee7dca-image.png?w=280&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=8a81f02bb6c2f787523cf1975ab6b56b 280w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/3ee7dca-image.png?w=560&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=0fedcd8efc2090812749d817ae172ffb 560w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/3ee7dca-image.png?w=840&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=0a6e2faa6f8aea908c5dbc92cd9f60fe 840w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/3ee7dca-image.png?w=1100&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=30b96b3f0d6a76a46758d91a20366ff0 1100w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/3ee7dca-image.png?w=1650&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=75654d488e16b4309623cc91391ed614 1650w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/3ee7dca-image.png?w=2500&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=f8d8aa22a51b94adc04decc40ba41f78 2500w" />
|
||||
</Frame>
|
||||
</a>
|
||||
|
||||
* [Create Portfolio Tracker in Microsoft Excel](https://www.coingecko.com/learn/crypto-portfolio-tracker-google-sheets)
|
||||
|
||||
<a href="https://www.coingecko.com/learn/crypto-portfolio-tracker-google-sheets" target="_blank" rel="noopener noreferrer">
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/f4d47e2-image.png?fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=0820b04fd5f2d945e8618d88733a35a9" noZoom data-og-width="1200" width="1200" data-og-height="600" height="600" data-path="images/docs/f4d47e2-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/f4d47e2-image.png?w=280&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=ec9dc9ecacf4dea880bb9283043d54a5 280w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/f4d47e2-image.png?w=560&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=d8061f7df985a8e013b4f20b506ffcd1 560w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/f4d47e2-image.png?w=840&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=71545611aa35f6686853ff932713ec81 840w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/f4d47e2-image.png?w=1100&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=c563a701e58781f49d7db9020de3fa5c 1100w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/f4d47e2-image.png?w=1650&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=8ef6ecb51f3e8ecf5c0fe1d991bfc2e5 1650w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/f4d47e2-image.png?w=2500&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=74ab69e420239526560da774b35d35a4 2500w" />
|
||||
</Frame>
|
||||
</a>
|
||||
|
||||
* [Fetch Crypto Data Using Python](https://www.coingecko.com/learn/python-query-coingecko-api)
|
||||
|
||||
<a href="https://www.coingecko.com/learn/python-query-coingecko-api" target="_blank" rel="noopener noreferrer">
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/bf15f91-image.png?fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=595e24814ec97ede65a775347cee4bca" noZoom data-og-width="950" width="950" data-og-height="473" height="473" data-path="images/docs/bf15f91-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/bf15f91-image.png?w=280&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=4bf00666cc1d6121a705b48ae386a7a9 280w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/bf15f91-image.png?w=560&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=4a27c38c5a4a49b15c1081922fa526f0 560w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/bf15f91-image.png?w=840&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=da86d2d15d228dfa49e4c4ac7214df31 840w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/bf15f91-image.png?w=1100&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=d8547008839925194e0ac89bf1436127 1100w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/bf15f91-image.png?w=1650&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=ee7fc9d6444ca624f93fd0f78afc893c 1650w, https://mintcdn.com/coingecko/M02rMX2XJMwBGpCe/images/docs/bf15f91-image.png?w=2500&fit=max&auto=format&n=M02rMX2XJMwBGpCe&q=85&s=98f982d6ba198a370c7ac0a089ef673b 2500w" />
|
||||
</Frame>
|
||||
</a>
|
||||
|
||||
---
|
||||
@@ -1,154 +0,0 @@
|
||||
# Coingecko - Reference
|
||||
|
||||
**Pages:** 9
|
||||
|
||||
---
|
||||
|
||||
## 💼 API Usage
|
||||
|
||||
**URL:** llms-txt#💼-api-usage
|
||||
|
||||
Source: https://docs.coingecko.com/reference/api-usage
|
||||
|
||||
reference/api-reference/coingecko-pro.json get /key
|
||||
This endpoint allows you to **monitor your account's API usage, including rate limits, monthly total credits, remaining credits, and more**
|
||||
|
||||
For a more comprehensive overview of your API usage, please log in to [https://www.coingecko.com/en/developers/dashboard](https://www.coingecko.com/en/developers/dashboard).
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Supported Networks List (ID Map)
|
||||
|
||||
**URL:** llms-txt#supported-networks-list-(id-map)
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/networks-list
|
||||
|
||||
v3.0.1/reference/api-reference/onchain-demo.json get /networks
|
||||
This endpoint allows you to **query all the supported networks on GeckoTerminal**
|
||||
|
||||
* You may use this endpoint to query the list of networks with network ID for other endpoints that contain params like `network`.
|
||||
* You may include values such as `page` to specify which page of responses you would like to show.
|
||||
</Tip>
|
||||
|
||||
---
|
||||
|
||||
## Check API server status
|
||||
|
||||
**URL:** llms-txt#check-api-server-status
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/ping-server
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /ping
|
||||
This endpoint allows you to **check the API server status**
|
||||
|
||||
* You can also go to [status.coingecko.com](https://status.coingecko.com/) to check the API server status and further maintenance notices.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Supported Currencies List
|
||||
|
||||
**URL:** llms-txt#supported-currencies-list
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/simple-supported-currencies
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /simple/supported_vs_currencies
|
||||
This endpoint allows you to **query all the supported currencies on CoinGecko**
|
||||
|
||||
* You may use this endpoint to query the list of currencies for other endpoints that contain params like `vs_currencies`.
|
||||
</Tip>
|
||||
|
||||
* Cache/Update Frequency: every 60 seconds for Public API.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Asset Platforms List (ID Map)
|
||||
|
||||
**URL:** llms-txt#asset-platforms-list-(id-map)
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/asset-platforms-list
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /asset_platforms
|
||||
This endpoint allows you to **query all the asset platforms on CoinGecko**
|
||||
|
||||
* You may use this endpoint to query the list of asset platforms for other endpoints that contain params like `id` or`ids`(asset platforms).
|
||||
* You may include NFT at the `filter` params to get the list of NFT-support asset platforms on CoinGecko.
|
||||
</Tip>
|
||||
|
||||
---
|
||||
|
||||
## Past 24 Hour Trades by Pool Address
|
||||
|
||||
**URL:** llms-txt#past-24-hour-trades-by-pool-address
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/pool-trades-contract-address
|
||||
|
||||
v3.0.1/reference/api-reference/onchain-demo.json get /networks/{network}/pools/{pool_address}/trades
|
||||
This endpoint allows you to **query the last 300 trades in the past 24 hours based on the provided pool address**
|
||||
|
||||
* Cache/Update Frequency: every 60 seconds.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Entities List (ID Map)
|
||||
|
||||
**URL:** llms-txt#entities-list-(id-map)
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/entities-list
|
||||
|
||||
v3.0.1/reference/api-reference/coingecko-demo.json get /entities/list
|
||||
This endpoint allows you to **query all the supported entities on CoinGecko with entities ID, name, symbol, and country**
|
||||
|
||||
* Cache / Update Frequency: every 5 minutes for all the API plans.
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Top Pools by Network
|
||||
|
||||
**URL:** llms-txt#top-pools-by-network
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/top-pools-network
|
||||
|
||||
v3.0.1/reference/api-reference/onchain-demo.json get /networks/{network}/pools
|
||||
This endpoint allows you to **query all the top pools based on the provided network**
|
||||
|
||||
* You may include values such as `page` to specify which page of responses you would like to show.
|
||||
* For more flexibility in retrieving an exact list of pools that match your specific needs, consider using the [/pools/megafilter](https://docs.coingecko.com/reference/pools-megafilter) endpoint (available for [Paid Plan](https://www.coingecko.com/en/api/pricing) subscribers \[Analyst plan or above].)
|
||||
</Tip>
|
||||
|
||||
* If the token's market cap is not verified by the team, the API response will return `null` for its market cap value, even though it has a displayed value on GeckoTerminal, which might not be accurate as it often matches the Fully Diluted Valuation (FDV).
|
||||
* Attributes specified in the `include` param will be returned under the top-level "included" key.
|
||||
* This endpoint returns up to 20 pools per page. Use the `page` param to navigate more results.
|
||||
* `page`: Pagination beyond 10 pages is available for [Paid Plan](https://www.coingecko.com/en/api/pricing) subscribers (Analyst plan or above).
|
||||
* Cache/Update frequency: every 60 seconds.
|
||||
* GeckoTerminal equivalent page (example): [https://www.geckoterminal.com/solana/pools?sort=-24h\_transactions](https://www.geckoterminal.com/solana/pools?sort=-24h_transactions)
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Top Pools by Dex
|
||||
|
||||
**URL:** llms-txt#top-pools-by-dex
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/top-pools-dex
|
||||
|
||||
v3.0.1/reference/api-reference/onchain-demo.json get /networks/{network}/dexes/{dex}/pools
|
||||
This endpoint allows you to **query all the top pools based on the provided network and decentralized exchange (DEX)**
|
||||
|
||||
* You may include values such as `page` to specify which page of responses you would like to show.
|
||||
* For more flexibility in retrieving an exact list of pools that match your specific needs, consider using the [/pools/megafilter](https://docs.coingecko.com/reference/pools-megafilter) endpoint (available for [Paid Plan](https://www.coingecko.com/en/api/pricing) subscribers \[Analyst plan or above].)
|
||||
</Tip>
|
||||
|
||||
* If the token's market cap is not verified by the team, the API response will return `null` for its market cap value, even though it has a displayed value on GeckoTerminal, which might not be accurate as it often matches the Fully Diluted Valuation (FDV).
|
||||
* Attributes specified in the `include` param will be returned under the top-level "included" key.
|
||||
* This endpoint returns up to 20 pools per page. Use the `page` param to navigate more results.
|
||||
* `page`: Pagination beyond 10 pages is available for [Paid Plan](https://www.coingecko.com/en/api/pricing) subscribers (Analyst plan or above).
|
||||
* Cache/Update frequency: every 60 seconds.
|
||||
* GeckoTerminal equivalent page (example): [https://www.geckoterminal.com/base/uniswap-v3-base/pools?sort=-24h\_transactions](https://www.geckoterminal.com/base/uniswap-v3-base/pools?sort=-24h_transactions)
|
||||
</Note>
|
||||
|
||||
---
|
||||
@@ -1,51 +0,0 @@
|
||||
# Coingecko - Trending
|
||||
|
||||
**Pages:** 2
|
||||
|
||||
---
|
||||
|
||||
## Trending Pools by Network
|
||||
|
||||
**URL:** llms-txt#trending-pools-by-network
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/trending-pools-network
|
||||
|
||||
v3.0.1/reference/api-reference/onchain-demo.json get /networks/{network}/trending_pools
|
||||
This endpoint allows you to **query the trending pools based on the provided network**
|
||||
|
||||
* You may include values such as `page` to specify which page of responses you would like to show.
|
||||
* For more flexibility in retrieving an exact list of pools that match your specific needs, consider using the [/pools/megafilter](https://docs.coingecko.com/reference/pools-megafilter) endpoint (available for [Paid Plan](https://www.coingecko.com/en/api/pricing) subscribers \[Analyst plan or above].)
|
||||
</Tip>
|
||||
|
||||
* If the token's market cap is not verified by the team, the API response will return `null` for its market cap value, even though it has a displayed value on GeckoTerminal, which might not be accurate as it often matches the Fully Diluted Valuation (FDV).
|
||||
* Attributes specified in the `include` param will be returned under the top-level "included" key.
|
||||
* This endpoint returns up to 20 pools per page. Use the `page` param to navigate more results.
|
||||
* `page`: Pagination beyond 10 pages is available for [Paid Plan](https://www.coingecko.com/en/api/pricing) subscribers (Analyst plan or above).
|
||||
* Cache/Update frequency: every 60 seconds.
|
||||
* GeckoTerminal equivalent page (example): [https://www.geckoterminal.com/base/pools](https://www.geckoterminal.com/base/pools)
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Trending Pools List
|
||||
|
||||
**URL:** llms-txt#trending-pools-list
|
||||
|
||||
Source: https://docs.coingecko.com/v3.0.1/reference/trending-pools-list
|
||||
|
||||
v3.0.1/reference/api-reference/onchain-demo.json get /networks/trending_pools
|
||||
This endpoint allows you to **query all the trending pools across all networks on GeckoTerminal**
|
||||
|
||||
* You may include values such as `page` to specify which page of responses you would like to show.
|
||||
* For more flexibility in retrieving an exact list of pools that match your specific needs, consider using the [/pools/megafilter](https://docs.coingecko.com/reference/pools-megafilter) endpoint (available for [Paid Plan](https://www.coingecko.com/en/api/pricing) subscribers \[Analyst plan or above].)
|
||||
</Tip>
|
||||
|
||||
* If the token's market cap is not verified by the team, the API response will return `null` for its market cap value, even though it has a displayed value on GeckoTerminal, which might not be accurate as it often matches the Fully Diluted Valuation (FDV).
|
||||
* Attributes specified in the `include` param will be returned under the top-level "included" key.
|
||||
* This endpoint returns up to 20 pools per page. Use the `page` param to navigate more results.
|
||||
* `page`: Pagination beyond 10 pages is available for [Paid Plan](https://www.coingecko.com/en/api/pricing) subscribers (Analyst plan or above).
|
||||
* Cache/Update frequency: every 60 seconds.
|
||||
* GeckoTerminal equivalent page (example): [https://www.geckoterminal.com](https://www.geckoterminal.com)
|
||||
</Note>
|
||||
|
||||
---
|
||||
@@ -1,119 +0,0 @@
|
||||
---
|
||||
name: cryptofeed
|
||||
description: "Cryptofeed real-time crypto market data skill: WebSocket feeds, normalized tickers/trades/order books, NBBO, exchange subscriptions, authenticated channels, and backend streaming to Redis/Kafka/PostgreSQL."
|
||||
---
|
||||
|
||||
# cryptofeed Skill
|
||||
|
||||
Use this skill to build Python market-data pipelines with Cryptofeed across exchanges, channels, callbacks, NBBO aggregation, and storage backends.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Trigger when any of these applies:
|
||||
- Streaming real-time crypto market data from multiple exchanges.
|
||||
- Subscribing to tickers, trades, L1/L2/L3 order books, candles, funding, liquidations, balances, fills, or order updates.
|
||||
- Building NBBO, arbitrage monitors, market-data recorders, or backend writers.
|
||||
- Debugging symbol/channel support, callback shape, reconnection behavior, or backend configuration.
|
||||
- Comparing Cryptofeed with exchange-specific WebSocket clients.
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
- Not a trading strategy engine, order execution system, or persistence database by itself.
|
||||
- Authenticated channels require exchange credentials; never commit or print secrets.
|
||||
- Exchange support, symbols, and channel names vary; confirm against the exchange class and `references/README.md`.
|
||||
- Required inputs: exchange list, symbols, channels, callback/backend target, auth need, and failure mode.
|
||||
- For historical backfills, pair this with REST or a storage system; Cryptofeed is WebSocket-first.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Common Patterns
|
||||
|
||||
**Install Cryptofeed**
|
||||
```bash
|
||||
pip install cryptofeed
|
||||
```
|
||||
|
||||
**Create a simple feed handler**
|
||||
```python
|
||||
from cryptofeed import FeedHandler
|
||||
from cryptofeed.defines import TICKER
|
||||
from cryptofeed.exchanges import Coinbase
|
||||
|
||||
def ticker(data, receipt_timestamp):
|
||||
print(data)
|
||||
|
||||
fh = FeedHandler()
|
||||
fh.add_feed(Coinbase(symbols=["BTC-USD"], channels=[TICKER], callbacks={TICKER: ticker}))
|
||||
fh.run()
|
||||
```
|
||||
|
||||
**Subscribe to trades and L2 book**
|
||||
```python
|
||||
from cryptofeed.defines import TRADES, L2_BOOK
|
||||
from cryptofeed.exchanges import Gemini
|
||||
|
||||
fh.add_feed(Gemini(
|
||||
symbols=["BTC-USD", "ETH-USD"],
|
||||
channels=[TRADES, L2_BOOK],
|
||||
callbacks={TRADES: trade_callback, L2_BOOK: book_callback},
|
||||
))
|
||||
```
|
||||
|
||||
**Build NBBO across exchanges**
|
||||
```python
|
||||
from cryptofeed.exchanges import Coinbase, Gemini, Kraken
|
||||
|
||||
fh.add_nbbo([Coinbase, Kraken, Gemini], ["BTC-USD"], nbbo_callback)
|
||||
```
|
||||
|
||||
**Separate callback work from IO-heavy persistence**
|
||||
```python
|
||||
def trade_callback(data, receipt_timestamp):
|
||||
queue.put_nowait((data, receipt_timestamp))
|
||||
```
|
||||
|
||||
**Check supported channel names**
|
||||
```python
|
||||
from cryptofeed.defines import L1_BOOK, L2_BOOK, L3_BOOK, TRADES, TICKER
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Single-Exchange Ticker Stream
|
||||
|
||||
- Input: exchange `Coinbase`, symbol `BTC-USD`, channel `TICKER`.
|
||||
- Steps:
|
||||
1. Create `FeedHandler`.
|
||||
2. Add one exchange feed with a lightweight callback.
|
||||
3. Run the handler and observe normalized ticker objects.
|
||||
- Expected output / acceptance: ticker updates print with timestamps and no callback-blocking persistence work.
|
||||
|
||||
### Example 2: NBBO Monitor
|
||||
|
||||
- Input: exchanges `Coinbase`, `Kraken`, `Gemini`, symbol `BTC-USD`.
|
||||
- Steps:
|
||||
1. Define `nbbo_callback(symbol, bid, bid_size, ask, ask_size, bid_feed, ask_feed)`.
|
||||
2. Add NBBO with the exchange class list.
|
||||
3. Alert only when spread or venue changes cross configured thresholds.
|
||||
- Expected output / acceptance: best bid/ask updates include source venues.
|
||||
|
||||
### Example 3: Backend Recorder
|
||||
|
||||
- Input: symbols, channels, and a storage backend such as Redis/Kafka/PostgreSQL.
|
||||
- Steps:
|
||||
1. Confirm optional backend dependencies are installed.
|
||||
2. Configure the backend callback instead of writing inside a custom callback.
|
||||
3. Run a small symbol set before scaling to many exchanges.
|
||||
- Expected output / acceptance: records arrive in the backend with normalized exchange and symbol fields.
|
||||
|
||||
## References
|
||||
|
||||
- `references/index.md`: navigation for the local Cryptofeed references.
|
||||
- `references/README.md`: supported exchanges, basic usage, NBBO, channels, and backends.
|
||||
- `references/other.md`: additional generated reference material.
|
||||
|
||||
## Maintenance
|
||||
|
||||
- Sources: local `references/` extracted from Cryptofeed documentation.
|
||||
- Last updated: 2026-04-28
|
||||
- Known limits: channel support is exchange-specific; always validate symbol naming and callback signatures against the installed version.
|
||||
@@ -1,192 +0,0 @@
|
||||
# Cryptocurrency Exchange Feed Handler
|
||||
[](https://github.com/bmoscon/cryptofeed/blob/master/LICENSE)
|
||||

|
||||
[](https://pypi.python.org/pypi/cryptofeed)
|
||||
[](https://www.codacy.com/app/bmoscon/cryptofeed?utm_source=github.com&utm_medium=referral&utm_content=bmoscon/cryptofeed&utm_campaign=Badge_Grade)
|
||||
|
||||
Handles multiple cryptocurrency exchange data feeds and returns normalized and standardized results to client registered callbacks for events like trades, book updates, ticker updates, etc. Utilizes websockets when possible, but can also poll data via REST endpoints if a websocket is not provided.
|
||||
|
||||
## Supported exchanges
|
||||
|
||||
* [AscendEX](https://ascendex.com/)
|
||||
* [Bequant](https://bequant.io/)
|
||||
* [Bitfinex](https://bitfinex.com)
|
||||
* [bitFlyer](https://bitflyer.com/)
|
||||
* [Bithumb](https://en.bithumb.com/)
|
||||
* [Bitstamp](https://www.bitstamp.net/)
|
||||
* [Blockchain.com](https://www.blockchain.com/)
|
||||
* [Bybit](https://www.bybit.com/)
|
||||
* [Binance](https://www.binance.com/en)
|
||||
* [Binance Delivery](https://binance-docs.github.io/apidocs/delivery/en/)
|
||||
* [Binance Futures](https://www.binance.com/en/futures)
|
||||
* [Binance US](https://www.binance.us/en)
|
||||
* [Bit.com](https://www.bit.com)
|
||||
* [Bitget](https://www.bitget.com/)
|
||||
* [BitMEX](https://www.bitmex.com/)
|
||||
* [Coinbase](https://www.coinbase.com/)
|
||||
* [Crypto.com](https://www.crypto.com)
|
||||
* [Delta](https://www.delta.exchange/)
|
||||
* [Deribit](https://www.deribit.com/)
|
||||
* [dYdX](https://dydx.exchange/)
|
||||
* [FMFW.io](https://www.fmfw.io/)
|
||||
* [EXX](https://www.exx.com/)
|
||||
* [Gate.io](https://www.gate.io/)
|
||||
* [Gate.io Futures](https://www.gate.io/futures_center)
|
||||
* [Gemini](https://gemini.com/)
|
||||
* [HitBTC](https://hitbtc.com/)
|
||||
* [Huobi](https://www.hbg.com/)
|
||||
* [Huobi DM](https://www.huobi.com/en-us/markets/hb_dm/)
|
||||
* Huobi Swap (Coin-M and USDT-M)
|
||||
* [Independent Reserve](https://www.independentreserve.com/)
|
||||
* [Kraken](https://www.kraken.com/)
|
||||
* [Kraken Futures](https://futures.kraken.com/)
|
||||
* [KuCoin](https://www.kucoin.com/)
|
||||
* [OKCoin](http://okcoin.com/)
|
||||
* [OKX](https://www.okx.com/)
|
||||
* [Phemex](https://phemex.com/)
|
||||
* [Poloniex](https://www.poloniex.com/)
|
||||
* [ProBit](https://www.probit.com/)
|
||||
* [Upbit](https://sg.upbit.com/home)
|
||||
|
||||
|
||||
## Basic Usage
|
||||
|
||||
Create a FeedHandler object and add subscriptions. For the various data channels that an exchange supports, you can supply callbacks for data events, or use provided backends (described below) to handle the data for you. Start the feed handler and you're done!
|
||||
|
||||
```python
|
||||
from cryptofeed import FeedHandler
|
||||
# not all imports shown for clarity
|
||||
|
||||
fh = FeedHandler()
|
||||
|
||||
# ticker, trade, and book are user defined functions that
|
||||
# will be called when ticker, trade and book updates are received
|
||||
ticker_cb = {TICKER: ticker}
|
||||
trade_cb = {TRADES: trade}
|
||||
gemini_cb = {TRADES: trade, L2_BOOK: book}
|
||||
|
||||
|
||||
fh.add_feed(Coinbase(symbols=['BTC-USD'], channels=[TICKER], callbacks=ticker_cb))
|
||||
fh.add_feed(Bitfinex(symbols=['BTC-USD'], channels=[TICKER], callbacks=ticker_cb))
|
||||
fh.add_feed(Poloniex(symbols=['BTC-USDT'], channels=[TRADES], callbacks=trade_cb))
|
||||
fh.add_feed(Gemini(symbols=['BTC-USD', 'ETH-USD'], channels=[TRADES, L2_BOOK], callbacks=gemini_cb))
|
||||
|
||||
fh.run()
|
||||
```
|
||||
|
||||
Please see the [examples](https://github.com/bmoscon/cryptofeed/tree/master/examples) for more code samples and the [documentation](https://github.com/bmoscon/cryptofeed/blob/master/docs/README.md) for more information about the library usage.
|
||||
|
||||
|
||||
For an example of a containerized application using cryptofeed to store data to a backend, please see [Cryptostore](https://github.com/bmoscon/cryptostore).
|
||||
|
||||
|
||||
## National Best Bid/Offer (NBBO)
|
||||
|
||||
Cryptofeed also provides a synthetic [NBBO](https://github.com/bmoscon/cryptofeed/blob/master/examples/demo_nbbo.py) (National Best Bid/Offer) feed that aggregates the best bids and asks from the user specified feeds.
|
||||
|
||||
```python
|
||||
from cryptofeed import FeedHandler
|
||||
from cryptofeed.exchanges import Coinbase, Gemini, Kraken
|
||||
|
||||
|
||||
def nbbo_update(symbol, bid, bid_size, ask, ask_size, bid_feed, ask_feed):
|
||||
print(f'Pair: {symbol} Bid Price: {bid:.2f} Bid Size: {bid_size:.6f} Bid Feed: {bid_feed} Ask Price: {ask:.2f} Ask Size: {ask_size:.6f} Ask Feed: {ask_feed}')
|
||||
|
||||
|
||||
def main():
|
||||
f = FeedHandler()
|
||||
f.add_nbbo([Coinbase, Kraken, Gemini], ['BTC-USD'], nbbo_update)
|
||||
f.run()
|
||||
```
|
||||
|
||||
## Supported Channels
|
||||
|
||||
Cryptofeed supports the following channels from exchanges:
|
||||
|
||||
### Market Data Channels (Public)
|
||||
|
||||
* L1_BOOK - Top of book
|
||||
* L2_BOOK - Price aggregated sizes. Some exchanges provide the entire depth, some provide a subset.
|
||||
* L3_BOOK - Price aggregated orders. Like the L2 book, some exchanges may only provide partial depth.
|
||||
* TRADES - Note this reports the taker's side, even for exchanges that report the maker side.
|
||||
* TICKER
|
||||
* FUNDING
|
||||
* OPEN_INTEREST - Open interest data.
|
||||
* LIQUIDATIONS
|
||||
* INDEX
|
||||
* CANDLES - Candlestick / K-Line data.
|
||||
|
||||
### Authenticated Data Channels
|
||||
|
||||
* ORDER_INFO - Order status updates
|
||||
* TRANSACTIONS - Real-time updates on account deposits and withdrawals
|
||||
* BALANCES - Updates on wallet funds
|
||||
* FILLS - User's executed trades
|
||||
|
||||
|
||||
## Backends
|
||||
|
||||
Cryptofeed supports `backend` callbacks that will write directly to storage or other interfaces.
|
||||
|
||||
Supported Backends:
|
||||
* Redis (Streams and Sorted Sets)
|
||||
* [Arctic](https://github.com/manahl/arctic)
|
||||
* ZeroMQ
|
||||
* UDP Sockets
|
||||
* TCP Sockets
|
||||
* Unix Domain Sockets
|
||||
* [InfluxDB v2](https://github.com/influxdata/influxdb)
|
||||
* MongoDB
|
||||
* Kafka
|
||||
* RabbitMQ
|
||||
* PostgreSQL
|
||||
* [QuasarDB](https://quasar.ai/)
|
||||
* GCP Pub/Sub
|
||||
* [QuestDB](https://questdb.io/)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
**Note:** cryptofeed requires Python 3.8+
|
||||
|
||||
Cryptofeed can be installed from PyPi. (It's recommended that you install in a virtual environment of your choosing).
|
||||
|
||||
pip install cryptofeed
|
||||
|
||||
Cryptofeed has optional dependencies, depending on the backends used. You can install them individually, or all at once. To install Cryptofeed along with all its optional dependencies in one bundle:
|
||||
|
||||
pip install cryptofeed[all]
|
||||
|
||||
If you wish to clone the repository and install from source, run this command from the root of the cloned repository.
|
||||
|
||||
python setup.py install
|
||||
|
||||
Alternatively, you can install in 'edit' mode (also called development mode):
|
||||
|
||||
python setup.py develop
|
||||
|
||||
See more discussion of package installation in [INSTALL.md](https://github.com/bmoscon/cryptofeed/blob/master/INSTALL.md).
|
||||
|
||||
|
||||
|
||||
## Rest API
|
||||
|
||||
Cryptofeed supports some REST interfaces for retrieving real-time and historical data, as well as order placement and account management. These are integrated into the exchange classes directly. You can view the supported methods by calling the `info()` method on any exchange. The methods for interacting with the exchange RET endpoints exist in two flavors, the synchronous methods (suffixed with `_sync`) as well as the asynchronous which can be utilized with asyncio. For more information see the [documentation](https://github.com/bmoscon/cryptofeed/blob/master/docs/rest.md).
|
||||
|
||||
|
||||
## Future Work
|
||||
|
||||
There are a lot of planned features, new exchanges, etc planned! If you'd like to discuss ongoing development, please join the [discord](https://discord.gg/zaBYaGAYfR) or open a thread in the [discussions](https://github.com/bmoscon/cryptofeed/discussions) in GitHub.
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues and PRs are welcomed!
|
||||
|
||||
Cryptofeed wouldn't be possible without the help of many [contributors](https://github.com/bmoscon/cryptofeed/blob/master/AUTHORS.md)! I owe them and all other contributors my thanks!
|
||||
|
||||
## Donations / Support
|
||||
|
||||
Support and donations are appreciated but not required. You can donate via [GitHub Sponsors](https://github.com/sponsors/bmoscon), or via the addresses below:
|
||||
|
||||
* Bitcoin: bc1qm0kxz8hqacaglku5fjhfe9a5hjnuyfwk02lsyr
|
||||
* Ethereum: 0x690709FEe13eEce9E7852089BB2D53Ae5D073154
|
||||
@@ -1,24 +0,0 @@
|
||||
# Cryptofeed Documentation Index
|
||||
|
||||
## Categories
|
||||
|
||||
### README
|
||||
**File:** `README.md`
|
||||
**Pages:** 1 (192 lines)
|
||||
|
||||
Complete overview of Cryptofeed including:
|
||||
- Installation instructions
|
||||
- Supported exchanges (40+)
|
||||
- Basic usage examples
|
||||
- NBBO (National Best Bid/Offer) implementation
|
||||
- Supported channels and backends
|
||||
- REST API information
|
||||
|
||||
## Quick Links
|
||||
|
||||
- Installation and setup → `README.md`
|
||||
- Basic usage examples → `README.md` (line 52-76)
|
||||
- NBBO example → `README.md` (line 83-100)
|
||||
- Supported exchanges → `README.md` (line 9-50)
|
||||
- Data channels → `README.md` (line 102-125)
|
||||
- Backend integrations → `README.md` (line 127-146)
|
||||
@@ -1,11 +0,0 @@
|
||||
# Cryptofeed - Other
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## GitHub - bmoscon/cryptofeed: Cryptocurrency Exchange Websocket Data Feed Handler
|
||||
|
||||
**URL:** https://github.com/bmoscon/cryptofeed
|
||||
|
||||
---
|
||||
@@ -1,118 +0,0 @@
|
||||
---
|
||||
name: ddd-doc-steward
|
||||
description: "文档驱动开发(DDD)文档管家:以仓库真实证据为准,盘点 ~/project 与 docs 目录,生成/更新 SSOT 文档(计划→补丁/全文→摘要→一致性检查)。触发:需要让文档与代码/配置/运行方式同步、补齐 guides/integrations/features/architecture/incidents/archive、无法推导时标注【待确认】并给验证路径。"
|
||||
---
|
||||
|
||||
# DDD 文档管家 Skill
|
||||
|
||||
让 `~/project/docs` 成为单一可信来源(SSOT):先盘点、后计划、再增量写文档,所有事实有证据来源,没有证据就【待确认】。
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- 需要为真实仓库建立/维护文档 SSOT,输出「盘点表 → 计划 → 文档补丁/全文 → 变更摘要 → 一致性检查」的固定交付物。
|
||||
- 新增/改动功能、集成或事故复盘,需要同步更新 docs 下对应目录。
|
||||
- 需要在 strict 模式下,避免任何臆测,所有关键事实必须给出代码/配置/命令的路径或说明验证方法。
|
||||
- 只能获取部分信息时,仍需生成最小可落地模板并标注【待确认】。
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
- 与工程无关的纯创作文案。
|
||||
- 无法提供最小证据集(目录树、README/依赖/配置/路由位置)且不接受【待确认】输出时。
|
||||
- 涉及密钥明文输出;文档中仅可写占位符与获取方式。
|
||||
- 未提供 `project_root/docs_root/output_mode` 等输入时,先将自然语言归一到输入 JSON(参见快速参考)。
|
||||
|
||||
## Quick Reference
|
||||
|
||||
1) 归一化输入(缺省值)
|
||||
```json
|
||||
{
|
||||
"project_root": "~/project",
|
||||
"docs_root": "~/project/docs",
|
||||
"output_mode": "patch_diff",
|
||||
"truthfulness_mode": "strict",
|
||||
"change_type": "baseline",
|
||||
"scope_hint": null,
|
||||
"related_paths": [],
|
||||
"prefer_priority": ["guides","integrations","features","architecture","incidents","archive"],
|
||||
"enforce_docs_index": true,
|
||||
"use_git_diff": true,
|
||||
"max_doc_size_kb": 200,
|
||||
"style": "standard"
|
||||
}
|
||||
```
|
||||
|
||||
2) Phase A 扫描要点(证据链)
|
||||
- `tree -L 3` 或目录枚举;`rg` 聚焦 README、依赖、配置、路由/API 定义。
|
||||
- 记录证据路径清单(文件/命令),不写结论。
|
||||
|
||||
3) Phase B 先输出计划
|
||||
- 《文档盘点表》:按六大目录标记「存在/缺失/疑似过期」,附证据路径。
|
||||
- 《生成/更新计划》:新增/更新/待确认清单;理由=证据。
|
||||
|
||||
4) Phase C 生成文档(遵循 output_mode)
|
||||
- `patch_diff` 推荐;无写权限时用 `full_files`。
|
||||
- 每个文档必含 Purpose/Scope/Status/Evidence/Related/Changelog。
|
||||
- 命名规范:ADR `architecture/adr-YYYYMMDD-<kebab>.md`;PRD/Spec/Integration/Guide/Incident/Archive 详见 `references/api.md`。
|
||||
|
||||
5) Phase D 收尾
|
||||
- 变更摘要:每文件 3-8 条关键变化。
|
||||
- 一致性检查:文档-代码验证点 + 未解的【待确认】与下一步。
|
||||
|
||||
6) 关键规则
|
||||
- 真实性优先:无证据不写,写则附路径;敏感值用占位符。
|
||||
- 没有就创建,有就增量更新,禁止大面积重写无关内容。
|
||||
- 超过 `max_doc_size_kb` 拆分;缺少访问时生成模板并给证据采集命令。
|
||||
|
||||
## 规则 & 约束
|
||||
|
||||
- MUST:输出五段结构;严格遵守目录/命名规范;Changelog 每文必有;冲突以代码/配置为准。
|
||||
- SHOULD:优先用 git diff/related_paths 聚焦;guides 与 integrations 先行;为每个【待确认】提供验证路径。
|
||||
- NEVER:编造端口/环境变量/接口字段;输出密钥明文;跳过盘点直接写文档。
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: 空仓库初始化
|
||||
- 输入:`change_type=baseline`,docs 为空。
|
||||
- 步骤:A 扫描→B 盘点表标记全部缺失→计划新增 docs/README.md、guides/getting-started.md 等→C 生成骨架补丁→D 摘要与检查。
|
||||
- 验收:输出 patch diff,所有命令标【待确认】或给寻找路径。
|
||||
|
||||
### Example 2: 新增登录功能
|
||||
- 输入:`change_type=feature`,`scope_hint="auth 登录"`,`use_git_diff=true`。
|
||||
- 步骤:用 diff 找受影响路由;盘点 features/integrations;计划新增 PRD/Spec,更新 integrations/auth-api;标记 token 过期时间待确认。
|
||||
- 验收:变更摘要指出新增文档与更新字段;检查清单含鉴权/错误码/验证 curl。
|
||||
|
||||
### Example 3: 无法读取仓库
|
||||
- 输入:仅自然语言“帮我做 SSOT 文档”。
|
||||
- 步骤:先归一化 JSON,声明“无法真实扫描”→生成六类文档模板,全量标【待确认】并列证据缺口与采集命令。
|
||||
- 验收:输出 full_files;每条待确认可直接行动补证。
|
||||
|
||||
## FAQ
|
||||
|
||||
- Q: 没有写权限怎么办?
|
||||
A: 将 `output_mode` 设为 `patch_diff` 或 `full_files`,给出可落盘内容。
|
||||
- Q: 目录过大处理不过来?
|
||||
A: 按 prefer_priority 分批;声明本次范围与剩余批次计划。
|
||||
|
||||
## References
|
||||
|
||||
- `references/index.md`:导航与长文入口。
|
||||
- `references/getting_started.md`:DDD 文档管家流程与术语。
|
||||
- `references/api.md`:输入/输出规范、目录命名与质量门禁。
|
||||
- `references/examples.md`:可套用场景示例。
|
||||
- `references/troubleshooting.md`:降级与故障处理。
|
||||
|
||||
## Maintenance
|
||||
|
||||
- 来源:提示词库(在线表格入口见 `prompts/README.md`);元技能 `skills/auto-skill/`;自动化辅助工具 `tools/external/Skill_Seekers-development`.
|
||||
- 最后更新:2026-04-28
|
||||
- 已知限制:依赖用户提供真实证据;大体量仓库需分批;不输出敏感值。
|
||||
|
||||
## 质量门禁(出厂前自检)
|
||||
|
||||
1. `name/description` 符合触发条件、目录名一致。
|
||||
2. 五段交付结构齐全;每段内容可直接给人/脚本消费。
|
||||
3. 每个文档含 Purpose/Scope/Status/Evidence/Related/Changelog。
|
||||
4. 所有事实有证据路径;无证据标【待确认】且给验证路径。
|
||||
5. Quick Reference ≤20 条且可直接执行;示例 ≥3。
|
||||
6. 长文本放 `references/`,`references/index.md` 可导航。
|
||||
7. 安全:不输出密钥明文,敏感值使用占位符。
|
||||
@@ -1,62 +0,0 @@
|
||||
# 输入 / 输出 / 目录命名规范
|
||||
|
||||
## 输入字段
|
||||
|
||||
- **required**
|
||||
- `project_root` (默认 `~/project`)
|
||||
- `docs_root` (默认 `~/project/docs`)
|
||||
- `output_mode` ∈ {`direct_write`,`patch_diff`,`full_files`},默认 `patch_diff`
|
||||
- `truthfulness_mode`,默认 `strict`
|
||||
- **optional**
|
||||
- `scope_hint`:聚焦模块/目录提示
|
||||
- `change_type` ∈ {`baseline`,`feature`,`bugfix`,`refactor`,`release`}
|
||||
- `related_paths`:受影响路径列表
|
||||
- `prefer_priority`:文档优先级顺序
|
||||
- `enforce_docs_index`:是否强制维护 docs/README.md
|
||||
- `use_git_diff`:true 时优先以 git diff 定位
|
||||
- `max_doc_size_kb`:单文档体积上限(默认 200KB)
|
||||
- `style` ∈ {`concise`,`standard`,`verbose`}
|
||||
|
||||
## 输出固定顺序
|
||||
|
||||
1) 文档盘点表
|
||||
2) 生成/更新计划
|
||||
3) 逐文件创建/更新内容(遵循 output_mode)
|
||||
4) 变更摘要
|
||||
5) 一致性检查清单
|
||||
|
||||
## 目录与命名
|
||||
|
||||
```
|
||||
docs/
|
||||
├── architecture/
|
||||
├── features/
|
||||
├── integrations/
|
||||
├── guides/
|
||||
├── incidents/
|
||||
└── archive/
|
||||
```
|
||||
|
||||
- ADR:`docs/architecture/adr-YYYYMMDD-<kebab>.md`
|
||||
- PRD:`docs/features/prd-<kebab>.md`
|
||||
- Spec:`docs/features/spec-<kebab>.md`
|
||||
- Integration:`docs/integrations/<kebab-service>.md`
|
||||
- Guide:`docs/guides/<kebab-topic>.md`
|
||||
- Incident:`docs/incidents/incident-YYYYMMDD-<kebab>.md`
|
||||
- Archive:`docs/archive/YYYY/<orig-or-topic>.md`(原处留指向)
|
||||
|
||||
## 每个文档必备结构
|
||||
|
||||
- Purpose(目的)
|
||||
- Scope(适用范围)
|
||||
- Status(Active/Draft/Deprecated)
|
||||
- Evidence(代码/配置/命令路径)
|
||||
- Related(交叉链接或路径)
|
||||
- Changelog(含最后更新时间 + 变更摘要)
|
||||
|
||||
## 质量门禁速查
|
||||
|
||||
- 五段交付结构齐全,顺序正确。
|
||||
- 所有关键事实附证据路径;缺失用【待确认】+验证指引。
|
||||
- guides / integrations 优先生成,且 integrations 含可验证步骤(curl/脚本)。
|
||||
- 超限文档拆分;无权限时使用 patch/full_files 仍可落地。
|
||||
@@ -1,51 +0,0 @@
|
||||
# 场景示例(可直接套用)
|
||||
|
||||
## 示例 1:空仓库快速落地
|
||||
- 输入:
|
||||
```json
|
||||
{
|
||||
"project_root": "~/project",
|
||||
"docs_root": "~/project/docs",
|
||||
"output_mode": "patch_diff",
|
||||
"change_type": "baseline",
|
||||
"scope_hint": "docs 为空",
|
||||
"use_git_diff": false
|
||||
}
|
||||
```
|
||||
- 操作:
|
||||
1. A:`tree -L 2 docs` 为空 → 记录证据。
|
||||
2. B:盘点表全部标记“缺失”;计划新增 docs/README.md、guides/getting-started.md、development-workflow.md、integrations/<待确认>.md。
|
||||
3. C:输出补丁,命令/端口/变量均标【待确认】,并说明从 `.env` / `docker-compose` / 配置目录查证。
|
||||
4. D:摘要列出新增文件;检查清单提示需补全端口/env/API 证据。
|
||||
- 预期:可直接应用的 diff;无臆测字段;每文含 Changelog。
|
||||
|
||||
## 示例 2:功能迭代—登录与刷新
|
||||
- 输入:
|
||||
```json
|
||||
{
|
||||
"project_root": "~/project",
|
||||
"docs_root": "~/project/docs",
|
||||
"output_mode": "patch_diff",
|
||||
"truthfulness_mode": "strict",
|
||||
"change_type": "feature",
|
||||
"scope_hint": "auth 登录 & token 刷新",
|
||||
"related_paths": ["services/api/auth", "services/api/routes"],
|
||||
"use_git_diff": true
|
||||
}
|
||||
```
|
||||
- 操作:
|
||||
1. A:`git diff --name-only` 聚焦 auth 路由/控制器;提取请求/响应字段与错误码。
|
||||
2. B:盘点表标识 features/prd-auth-login.md、spec-auth-login.md 缺失;integrations/auth-api.md 疑似过期(字段不一致)。
|
||||
3. C:新增 PRD/Spec;更新 integrations 文档含鉴权方式、错误码、验证 curl;token TTL 等未证实字段标【待确认】并指向配置文件。
|
||||
4. D:摘要列出新增/更新;检查清单包含“对照 auth/config 复核 TTL、错误码”。
|
||||
- 预期:diff 覆盖 3 个文件;所有事实有路径;待确认项附验证方法。
|
||||
|
||||
## 示例 3:无法读取仓库的降级
|
||||
- 输入:自然语言 “帮我生成 SSOT 文档模板”。
|
||||
- 操作:
|
||||
1. 归一化 JSON,声明“无法真实扫描,进入 strict 模板模式”。
|
||||
2. 盘点表说明证据缺口(目录树/README/依赖/配置/API 位置缺失)。
|
||||
3. 计划仅生成模板;待确认清单列出需用户补充的命令与文件。
|
||||
4. 输出 full_files:六大目录的骨架文档,字段均标【待确认】+ 如何获取。
|
||||
5. 检查清单提示下一步需用户提供证据。
|
||||
- 预期:完整可落盘模板,不含任何凭空事实。
|
||||
@@ -1,31 +0,0 @@
|
||||
# 快速开始 & 术语表
|
||||
|
||||
## 使命
|
||||
|
||||
让 `~/project/docs` 成为单一可信来源(SSOT):先盘点、先计划、增量更新,所有事实可追溯。
|
||||
|
||||
## 最短落地路径
|
||||
|
||||
1. **收集最小证据集**:`tree -L 3`、README、依赖清单、主要配置(.env*/yaml/toml/docker/k8s)、路由/API 定义位置、最近 git diff。
|
||||
2. **归一化输入**:把用户自然语言转成 JSON(见 `SKILL.md` 快速参考),缺省 `output_mode=patch_diff`、`truthfulness_mode=strict`。
|
||||
3. **执行 A→D 流程**:A 扫描→B 盘点与计划→C 生成文档(按 output_mode)→D 变更摘要与一致性检查。
|
||||
4. **落盘或回传**:有写权用 direct_write;否则输出 patch/full_files 供用户应用。
|
||||
|
||||
## 核心术语
|
||||
|
||||
- **SSOT**:Single Source of Truth,docs 与代码/配置/运行方式一致。
|
||||
- **output_mode**:`direct_write`(直接写)、`patch_diff`(推荐)、`full_files`(无法写入时)。
|
||||
- **truthfulness_mode=strict**:无证据不写;写则附路径或命令;敏感值用占位符。
|
||||
- **prefer_priority**:默认 `guides > integrations > features > architecture > incidents > archive`。
|
||||
- **enforce_docs_index**:true 时必须维护 `docs/README.md` 导航。
|
||||
- **Evidence**:文件路径、命令输出、日志位置;每个关键事实都需来源。
|
||||
- **【待确认】**:无法推导的字段,需附验证路径(文件/命令/负责人)。
|
||||
- **max_doc_size_kb**:单文档建议体积,超限应拆分。
|
||||
|
||||
## 自动化采集(可选)
|
||||
|
||||
- 需要批量抓取外部文档/代码仓库时,可用 `tools/external/Skill_Seekers-development` 的 CLI(如 `skill-seekers scrape --config <config.json>`)生成参考素材,再按本技能流程落盘。
|
||||
|
||||
## 交付物检查
|
||||
|
||||
- 五段结构齐全;每文含 Purpose/Scope/Status/Evidence/Related/Changelog;所有事实有证据或【待确认】。
|
||||
@@ -1,17 +0,0 @@
|
||||
# ddd-doc-steward 参考索引
|
||||
|
||||
长文与细节集中在这里,`SKILL.md` 保持轻量。
|
||||
|
||||
## 快速导航
|
||||
|
||||
- 入门与术语:`getting_started.md`
|
||||
- 输入/输出规范 & 目录命名:`api.md`
|
||||
- 场景示例(可直接套用):`examples.md`
|
||||
- 降级与故障处理:`troubleshooting.md`
|
||||
- 质量门禁与评分要点:`api.md#质量门禁`
|
||||
|
||||
## 使用提示
|
||||
|
||||
- 优先阅读 `getting_started.md` 获取流程全貌,再按需跳转。
|
||||
- 大于 10KB 的真实项目素材请分批引用,避免上下文爆炸。
|
||||
- 所有证据链(文件/命令)务必写在文档正文而非这里。
|
||||
@@ -1,26 +0,0 @@
|
||||
# 故障与降级处理
|
||||
|
||||
## 无法访问仓库或文件
|
||||
- 症状:无法读取目录/文件;无 tree/README/依赖信息。
|
||||
- 诊断:权限不足或未提供素材。
|
||||
- 处理:声明 strict 降级;仅输出模板骨架,所有事实标【待确认】;列出证据采集命令(tree/README/依赖/配置/API)。
|
||||
|
||||
## 文档与代码冲突
|
||||
- 症状:文档端口/字段/错误码与实现不一致。
|
||||
- 诊断:历史文档未同步。
|
||||
- 处理:以代码/配置为准更新;在 Changelog 记录冲突与修复原因;若行为变更建议补 ADR;无法确定时标【待确认】并给验证命令。
|
||||
|
||||
## 仓库过大或范围不清
|
||||
- 症状:输出超长或扫描耗时。
|
||||
- 诊断:目录/模块过多,未限定范围。
|
||||
- 处理:按 `prefer_priority` 分批;声明本次覆盖范围;优先 guides/integrations;余量列入后续批次计划。
|
||||
|
||||
## 敏感信息暴露风险
|
||||
- 症状:配置包含 token/password/key。
|
||||
- 诊断:直接读取 .env / 配置文件。
|
||||
- 处理:文档仅写变量名与获取方式,值用占位符;提示使用 vault/secret manager;必要时创建安全整改/incident 记录。
|
||||
|
||||
## 自动化采集失败
|
||||
- 症状:使用 `skill-seekers` 抓取外部文档/仓库失败。
|
||||
- 诊断:配置不当或站点屏蔽。
|
||||
- 处理:检查 config/URL;改用本地 `git clone` + 手工 `rg`;必要时缩小范围或增加重试间隔。
|
||||
@@ -1,175 +0,0 @@
|
||||
---
|
||||
name: headless-cli
|
||||
description: "无头模式 AI CLI 调用技能:支持 Gemini/Claude/Codex CLI 的无交互批量调用,包含 YOLO 模式和安全模式。用于批量翻译、代码审查、多模型编排等场景。"
|
||||
---
|
||||
|
||||
# Headless CLI 技能
|
||||
|
||||
无交互批量调用 AI CLI 工具,支持 stdin/stdout 管道,实现自动化工作流。
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
触发条件:
|
||||
- 需要批量处理文件(翻译、审查、格式化)
|
||||
- 需要在脚本中调用 AI 模型
|
||||
- 需要多模型串联/并联处理
|
||||
- 需要无人值守的 AI 任务执行
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
不适用于:
|
||||
- 需要交互式对话的场景
|
||||
- 需要实时反馈的任务
|
||||
- 敏感操作(YOLO 模式需谨慎)
|
||||
|
||||
必需输入:
|
||||
- 已安装对应 CLI 工具
|
||||
- 已完成身份认证
|
||||
- 网络代理配置(如需)
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### 🔴 YOLO 模式(全权限,跳过确认)
|
||||
|
||||
**Codex CLI**
|
||||
```bash
|
||||
# --yolo 是 --dangerously-bypass-approvals-and-sandbox 的别名
|
||||
alias c='codex --enable web_search_request -m gpt-5.5 -c model_reasoning_effort="xhigh" --yolo'
|
||||
```
|
||||
|
||||
**Claude Code**
|
||||
```bash
|
||||
alias cc='claude --dangerously-skip-permissions'
|
||||
```
|
||||
|
||||
**Gemini CLI**
|
||||
```bash
|
||||
# --yolo 或 --approval-mode yolo
|
||||
alias g='gemini --yolo'
|
||||
```
|
||||
|
||||
### 🟡 Full-Auto 模式(推荐的自动化方式)
|
||||
|
||||
**Codex CLI**
|
||||
```bash
|
||||
# workspace-write 沙箱 + 失败时才审批
|
||||
codex --full-auto "Your prompt"
|
||||
```
|
||||
|
||||
**Gemini CLI**
|
||||
```bash
|
||||
# 自动批准编辑工具
|
||||
gemini --approval-mode auto_edit "Your prompt"
|
||||
```
|
||||
|
||||
### 🟢 安全模式(无头但有限制)
|
||||
|
||||
**Gemini CLI(禁用工具调用)**
|
||||
```bash
|
||||
cat input.md | gemini -p "prompt" --output-format text --allowed-tools '' > output.md
|
||||
```
|
||||
|
||||
**Claude Code(Print 模式)**
|
||||
```bash
|
||||
cat input.md | claude -p "prompt" --output-format text > output.md
|
||||
```
|
||||
|
||||
**Codex CLI(非交互执行)**
|
||||
```bash
|
||||
codex exec "prompt" --json -o result.txt
|
||||
```
|
||||
|
||||
### 📋 常用命令模板
|
||||
|
||||
**批量翻译**
|
||||
```bash
|
||||
# 设置代理(如需)
|
||||
export http_proxy=http://127.0.0.1:9910
|
||||
export https_proxy=http://127.0.0.1:9910
|
||||
|
||||
# Gemini 翻译
|
||||
cat zh.md | gemini -p "Translate to English. Keep code/links unchanged." \
|
||||
--output-format text --allowed-tools '' > en.md
|
||||
```
|
||||
|
||||
**代码审查**
|
||||
```bash
|
||||
cat code.py | claude --dangerously-skip-permissions -p \
|
||||
"Review this code for bugs and security issues. Output markdown." > review.md
|
||||
```
|
||||
|
||||
**多模型编排**
|
||||
```bash
|
||||
# 模型 A 生成 → 模型 B 审查
|
||||
cat spec.md | gemini -p "Generate code" --output-format text | \
|
||||
claude -p "Review and improve this code" --output-format text > result.md
|
||||
```
|
||||
|
||||
### ⚙️ 关键参数对照表
|
||||
|
||||
| 功能 | Gemini CLI | Claude Code | Codex CLI |
|
||||
|:---|:---|:---|:---|
|
||||
| YOLO 模式 | `--yolo` | `--dangerously-skip-permissions` | `--yolo` |
|
||||
| 指定模型 | `-m <model>` | `--model <model>` | `-m <model>` |
|
||||
| 非交互 | `-p "prompt"` | `-p "prompt"` | `exec "prompt"` |
|
||||
| 输出格式 | `--output-format text` | `--output-format text` | `--json` |
|
||||
| 禁用工具 | `--allowed-tools ''` | `--disallowedTools` | N/A |
|
||||
| 继续对话 | N/A | `-c` / `--continue` | `resume --last` |
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: 批量翻译文档
|
||||
|
||||
**输入**: 中文 Markdown 文件
|
||||
**步骤**:
|
||||
```bash
|
||||
export http_proxy=http://127.0.0.1:9910
|
||||
export https_proxy=http://127.0.0.1:9910
|
||||
|
||||
for f in docs/*.md; do
|
||||
cat "$f" | timeout 120 gemini -p \
|
||||
"Translate to English. Keep code fences unchanged." \
|
||||
--output-format text --allowed-tools '' 2>/dev/null > "en_$(basename $f)"
|
||||
done
|
||||
```
|
||||
**预期输出**: 翻译后的英文文件
|
||||
|
||||
### Example 2: 代码审查流水线
|
||||
|
||||
**输入**: Python 代码文件
|
||||
**步骤**:
|
||||
```bash
|
||||
cat src/*.py | claude --dangerously-skip-permissions -p \
|
||||
"Review for: 1) Bugs 2) Security 3) Performance. Output markdown table." > review.md
|
||||
```
|
||||
**预期输出**: Markdown 格式的审查报告
|
||||
|
||||
### Example 3: 多模型对比验证
|
||||
|
||||
**输入**: 技术问题
|
||||
**步骤**:
|
||||
```bash
|
||||
question="How to implement rate limiting in Python?"
|
||||
|
||||
echo "$question" | gemini -p "$question" --output-format text > gemini_answer.md
|
||||
echo "$question" | claude -p "$question" --output-format text > claude_answer.md
|
||||
|
||||
# 对比两个答案
|
||||
diff gemini_answer.md claude_answer.md
|
||||
```
|
||||
**预期输出**: 两个模型答案的对比
|
||||
|
||||
## References
|
||||
|
||||
- `references/gemini-cli.md` - Gemini CLI 完整参数
|
||||
- `references/claude-cli.md` - Claude Code CLI 参数
|
||||
- `references/codex-cli.md` - Codex CLI 参数
|
||||
- [Gemini CLI 官方文档](https://geminicli.com/docs/)
|
||||
- [Claude Code 官方文档](https://docs.anthropic.com/en/docs/claude-code/)
|
||||
- [Codex CLI 官方文档](https://developers.openai.com/codex/cli/reference)
|
||||
|
||||
## Maintenance
|
||||
|
||||
- 来源: 各 CLI 官方文档
|
||||
- 更新: 2025-12-19
|
||||
- 限制: 需要网络连接和有效认证;YOLO 模式有安全风险
|
||||
@@ -1,115 +0,0 @@
|
||||
# Claude Code CLI 参数参考
|
||||
|
||||
> 来源: [官方文档](https://docs.anthropic.com/en/docs/claude-code/cli-reference)
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
npm install -g @anthropic-ai/claude-code
|
||||
```
|
||||
|
||||
## 认证
|
||||
|
||||
需要 Anthropic API Key 或 Claude Pro/Max 订阅:
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY="YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## 核心命令
|
||||
|
||||
| 命令 | 说明 | 示例 |
|
||||
|:---|:---|:---|
|
||||
| `claude` | 启动交互式 REPL | `claude` |
|
||||
| `claude "query"` | 带初始提示词启动 | `claude "explain this"` |
|
||||
| `claude -p "query"` | Print 模式,执行后退出 | `claude -p "review code"` |
|
||||
| `claude -c` | 继续最近的对话 | `claude -c` |
|
||||
| `claude -c -p "query"` | 继续对话(Print 模式) | `claude -c -p "run tests"` |
|
||||
| `claude -r "id" "query"` | 恢复指定会话 | `claude -r "abc123" "continue"` |
|
||||
| `claude update` | 更新到最新版本 | `claude update` |
|
||||
| `claude mcp` | 配置 MCP 服务器 | `claude mcp add server` |
|
||||
|
||||
## CLI 参数
|
||||
|
||||
| 参数 | 说明 | 示例 |
|
||||
|:---|:---|:---|
|
||||
| `--model` | 指定模型 | `--model claude-sonnet-4` |
|
||||
| `--output-format` | 输出格式: `text`/`json`/`stream-json` | `--output-format json` |
|
||||
| `--max-turns` | 限制对话轮数 | `--max-turns 3` |
|
||||
| `--dangerously-skip-permissions` | 跳过所有权限确认 (YOLO) | 见下方 |
|
||||
| `--allowedTools` | 允许的工具列表 | `--allowedTools "Write" "Bash(git *)"` |
|
||||
| `--disallowedTools` | 禁止的工具列表 | `--disallowedTools "Bash(rm *)"` |
|
||||
| `--add-dir` | 添加额外工作目录 | `--add-dir ./apps ./lib` |
|
||||
| `--verbose` | 启用详细日志 | `--verbose` |
|
||||
| `--continue` | 继续最近对话 | `--continue` |
|
||||
| `--resume` | 恢复指定会话 | `--resume abc123` |
|
||||
|
||||
## 可用模型
|
||||
|
||||
- `claude-sonnet-4` - 平衡模型 (默认)
|
||||
- `claude-opus-4` - 最强模型
|
||||
- `claude-opus-4.5` - 最新最强
|
||||
|
||||
## 无头模式用法
|
||||
|
||||
```bash
|
||||
# Print 模式(非交互,执行后退出)
|
||||
claude -p "review this code" --output-format text
|
||||
|
||||
# 管道输入
|
||||
cat input.txt | claude -p "explain these errors"
|
||||
|
||||
# YOLO 模式(跳过所有权限确认)
|
||||
claude --dangerously-skip-permissions "Your prompt"
|
||||
|
||||
# 别名设置
|
||||
alias cc='claude --dangerously-skip-permissions'
|
||||
|
||||
# 继续对话 + Print 模式(适合脚本)
|
||||
claude -c -p "show progress"
|
||||
```
|
||||
|
||||
## 交互式命令 (Slash Commands)
|
||||
|
||||
| 命令 | 说明 |
|
||||
|:---|:---|
|
||||
| `/help` | 显示所有命令 |
|
||||
| `/config` | 配置设置 |
|
||||
| `/allowed-tools` | 配置工具权限 |
|
||||
| `/mcp` | 管理 MCP 服务器 |
|
||||
| `/vim` | 启用 vim 编辑模式 |
|
||||
|
||||
## 配置文件
|
||||
|
||||
- 用户设置: `~/.claude/settings.json`
|
||||
- 项目设置: `.claude/settings.json`
|
||||
- 本地设置: `.claude/settings.local.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "claude-sonnet-4",
|
||||
"permissions": {
|
||||
"allowedTools": ["Read", "Write", "Bash(git *)"],
|
||||
"deny": ["Read(./.env)", "Bash(rm *)"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 上下文文件 (CLAUDE.md)
|
||||
|
||||
- 全局: `~/.claude/CLAUDE.md`
|
||||
- 项目: `./CLAUDE.md`
|
||||
- 子目录: 组件特定指令
|
||||
|
||||
## 深度思考触发词
|
||||
|
||||
强度递增:
|
||||
- `think` - 基础思考
|
||||
- `think hard` - 深入思考
|
||||
- `think harder` - 更深入
|
||||
- `ultrathink` - 最深度思考
|
||||
|
||||
## 常见问题
|
||||
|
||||
1. **权限弹窗**: 使用 `--dangerously-skip-permissions`
|
||||
2. **上下文过长**: 使用 `/compact` 或 `/clear`
|
||||
3. **回退更改**: 使用 `/rewind`
|
||||
@@ -1,124 +0,0 @@
|
||||
# Codex CLI 参数参考
|
||||
|
||||
> 来源: [官方文档](https://developers.openai.com/codex/cli/reference)
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
npm install -g @openai/codex
|
||||
```
|
||||
|
||||
## 认证
|
||||
|
||||
```bash
|
||||
# 方式 1: 浏览器 OAuth (ChatGPT 账号)
|
||||
codex login
|
||||
|
||||
# 方式 2: API Key
|
||||
printenv OPENAI_API_KEY | codex login --with-api-key
|
||||
|
||||
# 检查登录状态
|
||||
codex login status
|
||||
```
|
||||
|
||||
## 核心命令
|
||||
|
||||
| 命令 | 说明 | 示例 |
|
||||
|:---|:---|:---|
|
||||
| `codex` | 启动交互式 TUI | `codex` |
|
||||
| `codex "prompt"` | 带提示词启动 | `codex "explain this"` |
|
||||
| `codex exec` / `codex e` | 非交互模式 | `codex exec "fix bugs"` |
|
||||
| `codex resume` | 恢复会话 | `codex resume --last` |
|
||||
| `codex apply` / `codex a` | 应用 Cloud 任务的 diff | `codex apply TASK_ID` |
|
||||
| `codex mcp` | 管理 MCP 服务器 | `codex mcp add server` |
|
||||
| `codex completion` | 生成 shell 补全 | `codex completion zsh` |
|
||||
|
||||
## 全局参数
|
||||
|
||||
| 参数 | 说明 | 示例 |
|
||||
|:---|:---|:---|
|
||||
| `--model, -m` | 指定模型 | `-m gpt-5.5` |
|
||||
| `--sandbox, -s` | 沙箱策略: `read-only`/`workspace-write`/`danger-full-access` | `-s workspace-write` |
|
||||
| `--ask-for-approval, -a` | 审批模式: `untrusted`/`on-failure`/`on-request`/`never` | `-a on-failure` |
|
||||
| `--full-auto` | 自动化预设 (workspace-write + on-failure) | `--full-auto` |
|
||||
| `--dangerously-bypass-approvals-and-sandbox` / `--yolo` | 跳过所有审批和沙箱 | `--yolo` |
|
||||
| `--search` | 启用网页搜索 | `--search` |
|
||||
| `--add-dir` | 添加额外写入目录 | `--add-dir ./other` |
|
||||
| `--enable` | 启用功能标志 | `--enable web_search_request` |
|
||||
| `--disable` | 禁用功能标志 | `--disable feature_name` |
|
||||
| `--config, -c` | 配置覆盖 | `-c model_reasoning_effort="xhigh"` |
|
||||
| `--image, -i` | 附加图片 | `-i image.png` |
|
||||
| `--cd, -C` | 设置工作目录 | `-C /path/to/project` |
|
||||
| `--profile, -p` | 配置文件 profile | `-p my-profile` |
|
||||
| `--oss` | 使用本地开源模型 (Ollama) | `--oss` |
|
||||
|
||||
## codex exec 专用参数
|
||||
|
||||
| 参数 | 说明 | 示例 |
|
||||
|:---|:---|:---|
|
||||
| `--json` | 输出 JSONL 格式 | `--json` |
|
||||
| `--output-last-message, -o` | 保存最终消息到文件 | `-o result.txt` |
|
||||
| `--output-schema` | JSON Schema 验证输出 | `--output-schema schema.json` |
|
||||
| `--color` | 颜色输出: `always`/`never`/`auto` | `--color never` |
|
||||
| `--skip-git-repo-check` | 允许在非 Git 目录运行 | `--skip-git-repo-check` |
|
||||
|
||||
## 可用模型
|
||||
|
||||
- `gpt-5.5` - 最新推荐模型
|
||||
- `gpt-5.4` - 上一代兼容模型
|
||||
- `gpt-5.2` - 旧版兼容模型
|
||||
|
||||
## 推理强度配置
|
||||
|
||||
```bash
|
||||
-c model_reasoning_effort="low" # 快速
|
||||
-c model_reasoning_effort="medium" # 平衡
|
||||
-c model_reasoning_effort="high" # 深度
|
||||
-c model_reasoning_effort="xhigh" # 最深
|
||||
```
|
||||
|
||||
## 无头模式用法
|
||||
|
||||
```bash
|
||||
# 非交互执行
|
||||
codex exec "fix all linting errors"
|
||||
|
||||
# 管道输入
|
||||
echo "explain this error" | codex exec -
|
||||
|
||||
# YOLO 模式(跳过所有确认和沙箱)
|
||||
codex --yolo "Your prompt"
|
||||
|
||||
# 或完整写法
|
||||
codex --dangerously-bypass-approvals-and-sandbox "Your prompt"
|
||||
|
||||
# full-auto 模式(推荐的自动化方式)
|
||||
codex --full-auto "Your prompt"
|
||||
|
||||
# 完整 YOLO 配置别名
|
||||
alias c='codex --enable web_search_request -m gpt-5.5 -c model_reasoning_effort="xhigh" --yolo'
|
||||
|
||||
# 恢复最近会话
|
||||
codex resume --last
|
||||
codex exec resume --last "continue"
|
||||
```
|
||||
|
||||
## 配置文件
|
||||
|
||||
配置存储在 `~/.codex/config.toml`:
|
||||
|
||||
```toml
|
||||
model = "gpt-5.5"
|
||||
sandbox = "workspace-write"
|
||||
ask_for_approval = "on-failure"
|
||||
|
||||
[features]
|
||||
web_search_request = true
|
||||
```
|
||||
|
||||
## 常见问题
|
||||
|
||||
1. **审批弹窗**: 使用 `--yolo` 或 `--full-auto`
|
||||
2. **需要联网**: 使用 `--search` 或 `--enable web_search_request`
|
||||
3. **推理不够深**: 使用 `-c model_reasoning_effort="high"`
|
||||
4. **非 Git 目录**: 使用 `--skip-git-repo-check`
|
||||
@@ -1,81 +0,0 @@
|
||||
# Gemini CLI 参数参考
|
||||
|
||||
> 来源: [官方文档](https://geminicli.com/docs/get-started/configuration/)
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
npm install -g @anthropic-ai/gemini-cli
|
||||
```
|
||||
|
||||
## 认证
|
||||
|
||||
首次运行会引导 Google 账号登录,或设置环境变量:
|
||||
```bash
|
||||
export GEMINI_API_KEY="YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## 核心命令行参数
|
||||
|
||||
| 参数 | 说明 | 示例 |
|
||||
|:---|:---|:---|
|
||||
| `--model <model>` | 指定模型 | `--model gemini-2.5-flash` |
|
||||
| `--yolo` | YOLO 模式,自动批准所有工具调用 | `gemini --yolo` |
|
||||
| `--approval-mode <mode>` | 审批模式: `default`/`auto_edit`/`yolo` | `--approval-mode auto_edit` |
|
||||
| `--allowed-tools <tools>` | 允许的工具列表(逗号分隔) | `--allowed-tools ''` (禁用所有) |
|
||||
| `--output-format <format>` | 输出格式: `text`/`json`/`stream-json` | `--output-format text` |
|
||||
| `--sandbox` / `-s` | 启用沙箱模式 | `gemini -s` |
|
||||
| `--prompt <prompt>` / `-p` | 非交互模式,直接传入提示词 | `gemini -p "query"` |
|
||||
| `--prompt-interactive <prompt>` / `-i` | 交互模式,带初始提示词 | `gemini -i "explain"` |
|
||||
| `--debug` / `-d` | 启用调试模式 | `gemini -d` |
|
||||
|
||||
## 可用模型
|
||||
|
||||
- `gemini-2.5-flash` - 快速模型
|
||||
- `gemini-2.5-pro` - 高级模型
|
||||
- `gemini-3-flash-preview` - 最新 Flash
|
||||
- `gemini-3-pro-preview` - 最新 Pro
|
||||
|
||||
## 无头模式用法
|
||||
|
||||
```bash
|
||||
# 基础无头调用(管道输入)
|
||||
cat input.txt | gemini -p "Your prompt" --output-format text
|
||||
|
||||
# 禁用工具调用(纯文本输出)
|
||||
cat input.txt | gemini -p "Your prompt" --output-format text --allowed-tools ''
|
||||
|
||||
# YOLO 模式(跳过所有确认)
|
||||
gemini --yolo "Your prompt"
|
||||
|
||||
# 或使用 approval-mode
|
||||
gemini --approval-mode yolo "Your prompt"
|
||||
```
|
||||
|
||||
## 配置文件
|
||||
|
||||
配置存储在 `~/.gemini/settings.json` 或项目 `.gemini/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"security": {
|
||||
"disableYoloMode": false
|
||||
},
|
||||
"model": {
|
||||
"name": "gemini-2.5-flash"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 代理配置
|
||||
|
||||
```bash
|
||||
export http_proxy=http://127.0.0.1:9910
|
||||
export https_proxy=http://127.0.0.1:9910
|
||||
```
|
||||
|
||||
## 常见问题
|
||||
|
||||
1. **MCP 初始化慢**: 使用 `--allowed-tools ''` 跳过
|
||||
2. **超时**: 使用 `timeout` 命令包装
|
||||
3. **输出包含日志**: 重定向 stderr `2>/dev/null`
|
||||
@@ -1,15 +0,0 @@
|
||||
# Headless CLI References
|
||||
|
||||
> ⚠️ CLI 参数可能随版本更新变化,请以官方文档为准
|
||||
|
||||
## 目录
|
||||
|
||||
- [gemini-cli.md](./gemini-cli.md) - Gemini CLI 参数
|
||||
- [claude-cli.md](./claude-cli.md) - Claude Code CLI 参数
|
||||
- [codex-cli.md](./codex-cli.md) - Codex CLI 参数
|
||||
|
||||
## 官方文档
|
||||
|
||||
- [Gemini CLI](https://github.com/google-gemini/gemini-cli)
|
||||
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code)
|
||||
- [Codex CLI](https://github.com/openai/codex)
|
||||
@@ -1,136 +0,0 @@
|
||||
---
|
||||
name: hummingbot
|
||||
description: "Hummingbot trading bot framework skill: connector setup, scripts, market making, arbitrage, Gateway DEX operations, headless quickstart, candles, market data provider, and troubleshooting for crypto trading bots."
|
||||
---
|
||||
|
||||
# hummingbot Skill
|
||||
|
||||
Use this skill to operate, configure, or extend Hummingbot bots and Gateway connectors with explicit risk controls and version-aware references.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Trigger when any of these applies:
|
||||
- Running Hummingbot strategies, scripts, or headless bot instances.
|
||||
- Configuring CEX/DEX connectors, API keys, Gateway routes, or blockchain RPC providers.
|
||||
- Building market-making, arbitrage, liquidity, or custom script strategies.
|
||||
- Using candles, order book snapshots, mid-price, volume-for-price, or market data provider APIs.
|
||||
- Debugging connector failures, Docker/runtime issues, Gateway command errors, or strategy config problems.
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
- Not financial advice, profitability guarantees, or unattended live-trading approval.
|
||||
- Never paste real exchange API keys, private keys, mnemonics, or wallet secrets into prompts, examples, logs, or commits.
|
||||
- Use paper/sandbox/small-size validation before live capital; many connectors have exchange-specific limits and failure modes.
|
||||
- Required inputs: Hummingbot version, install mode, connector, trading pair, strategy/script, config file, live/paper mode, and exact logs.
|
||||
- Gateway and connector schemas evolve; verify against `references/` and the running version before production deployment.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Common Patterns
|
||||
|
||||
**Run a headless quickstart**
|
||||
```bash
|
||||
bin/hummingbot_quickstart.py --headless -p PASSWORD -f CONFIG_FILE_NAME
|
||||
```
|
||||
|
||||
**Run a script config**
|
||||
```bash
|
||||
bin/hummingbot_quickstart.py -p PASSWORD -f simple_pmm_example_config.py -c conf_simple_pmm_example_config_1.yml
|
||||
```
|
||||
|
||||
**List Gateway connectors**
|
||||
```text
|
||||
gateway list
|
||||
```
|
||||
|
||||
**Inspect Gateway swap syntax**
|
||||
```text
|
||||
gateway swap --help
|
||||
```
|
||||
|
||||
**Get a mid price from the market data provider**
|
||||
```python
|
||||
price = self.market_data_provider.get_price_by_type(
|
||||
"binance",
|
||||
"BTC-USDT",
|
||||
PriceType.MidPrice,
|
||||
)
|
||||
```
|
||||
|
||||
**Get price by quote volume**
|
||||
```python
|
||||
price = self.market_data_provider.get_price_by_volume(
|
||||
"binance",
|
||||
"BTC-USDT",
|
||||
10000,
|
||||
True,
|
||||
)
|
||||
```
|
||||
|
||||
**Get an order book snapshot**
|
||||
```python
|
||||
snapshot = self.market_data_provider.get_order_book_snapshot("binance", "BTC-USDT")
|
||||
```
|
||||
|
||||
**Create a candle feed**
|
||||
```python
|
||||
candles = CandlesFactory.get_candle(
|
||||
connector="kucoin",
|
||||
trading_pair="ETH-USDT",
|
||||
interval="1m",
|
||||
max_records=100,
|
||||
)
|
||||
```
|
||||
|
||||
**Update Docker deployment images**
|
||||
```bash
|
||||
docker compose down
|
||||
docker pull hummingbot/hummingbot:latest
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Headless Bot Smoke Test
|
||||
|
||||
- Input: password, strategy config file, optional script config.
|
||||
- Steps:
|
||||
1. Start with `bin/hummingbot_quickstart.py --headless`.
|
||||
2. Confirm logs show connector initialization and strategy start.
|
||||
3. Stop the bot and inspect final status before enabling live size.
|
||||
- Expected output / acceptance: the bot starts from config without interactive prompts and exits cleanly.
|
||||
|
||||
### Example 2: Gateway Connector Triage
|
||||
|
||||
- Input: failing Gateway command and connector name.
|
||||
- Steps:
|
||||
1. Run `gateway list` to verify connector availability.
|
||||
2. Run `gateway swap --help` or the specific command help.
|
||||
3. Compare arguments with the connector/network schema in `references/trading.md`.
|
||||
- Expected output / acceptance: failure is classified as missing connector, bad args, RPC/network issue, or credential/config issue.
|
||||
|
||||
### Example 3: Strategy Market Data Hook
|
||||
|
||||
- Input: connector `binance`, pair `BTC-USDT`, needed price type.
|
||||
- Steps:
|
||||
1. Use `market_data_provider` for mid price or volume-aware price.
|
||||
2. Keep API calls outside tight loops when cached data is sufficient.
|
||||
3. Log connector/pair/price source for later debugging.
|
||||
- Expected output / acceptance: strategy reads a deterministic price source without blocking order logic.
|
||||
|
||||
## References
|
||||
|
||||
- `references/index.md`: navigation for local Hummingbot references.
|
||||
- `references/getting_started.md`: install and first-run material.
|
||||
- `references/configuration.md`: bot and connector configuration.
|
||||
- `references/connectors.md`: exchange connector catalog and notes.
|
||||
- `references/strategies.md`: strategy and script material.
|
||||
- `references/trading.md`: Gateway and trading operations.
|
||||
- `references/development.md`: development, headless, and release-related notes.
|
||||
- `references/troubleshooting.md`: common failure modes.
|
||||
|
||||
## Maintenance
|
||||
|
||||
- Sources: local `references/` extracted from Hummingbot documentation.
|
||||
- Last updated: 2026-04-28
|
||||
- Known limits: connector support and Gateway schemas change frequently; validate against the installed Hummingbot version.
|
||||
@@ -1,255 +0,0 @@
|
||||
# Hummingbot - Advanced
|
||||
|
||||
**Pages:** 7
|
||||
|
||||
---
|
||||
|
||||
##
|
||||
|
||||
**URL:** https://hummingbot.org/dashboard/backtest.png
|
||||
|
||||
---
|
||||
|
||||
##
|
||||
|
||||
**URL:** https://hummingbot.org/dashboard/backtest-2.png
|
||||
|
||||
---
|
||||
|
||||
##
|
||||
|
||||
**URL:** https://hummingbot.org/assets/img/backtesting.png
|
||||
|
||||
---
|
||||
|
||||
##
|
||||
|
||||
**URL:** https://hummingbot.org/dashboard/backtest-1.png
|
||||
|
||||
---
|
||||
|
||||
## Check Performance - Hummingbot
|
||||
|
||||
**URL:** https://hummingbot.org/client/history
|
||||
|
||||
**Contents:**
|
||||
- Performance History¶
|
||||
- History command¶
|
||||
- How It Works¶
|
||||
- Sample Output¶
|
||||
- Average Price¶
|
||||
- Hold Portfolio Value¶
|
||||
- Current Portfolio Value¶
|
||||
- Trade P&L¶
|
||||
- Total P&L¶
|
||||
- Return Percentage¶
|
||||
|
||||
The history command displays the current duration of total past trades, asset inventory and value, and market trading pair performance. Run history --verbose to see all recent trades.
|
||||
|
||||
Trades are saved locally in a .csv file located in the data folder which you can view by running history --verbose --days command even after you restart Hummingbot.
|
||||
|
||||
Optional argument --precision specifies the number of decimal values.
|
||||
|
||||
This block below shows the calculation for some of the values displayed in the history output.
|
||||
|
||||
The Return % in the navbar at the bottom of Hummingbot client may be different from the history command output. This is because the Return % in history takes the price changes into calculation while the navbar in the bottom UI does not.
|
||||
|
||||
Run the history command in Hummingbot to display the current duration of total past trades, asset inventory and value, market trading pair performance.
|
||||
|
||||
The following displays the formula for key calculations:
|
||||
|
||||
For more details on the calculations, please see this Google Sheet.
|
||||
|
||||
Avg Price = Total trade volume of quote/Total trade volume of base asset.
|
||||
|
||||
In the sample output, the total avg price is 6.91/47423 = 0.0001457
|
||||
|
||||
This value means the average price of total MFT/BNB trades is 0.0001457
|
||||
|
||||
The asset value from the start to the end with no trades.
|
||||
|
||||
Hold portfolio value = (base start asset*current market price)+ quote start asset
|
||||
|
||||
From the above example, for the Hold portfolio value is (155248*0.0000809)+23.33=35.89
|
||||
|
||||
Current portfolio value = (base current asset*current market price)+ quote current asset
|
||||
|
||||
From the above example, for the Current portfolio value is (202671*0.0000809)+16.419=32.815
|
||||
|
||||
Trade P&L = Current portfolio value - Hold Portfolio value
|
||||
|
||||
From the above example, for the Trade P&L value is 32.815-35.89=-3.075
|
||||
|
||||
Total P&L = Trade P&L + Fees paid
|
||||
|
||||
From the above example, for the Total P&L is -3.075 + -0.428 = -3.504
|
||||
|
||||
Return% = Total P&L/Hold portfolio value
|
||||
|
||||
From the above example, for the Return% is -3.075/-35.89 = -9.76%
|
||||
|
||||
The Return % (bottom navbar) matches the calculated return on History after the last trade, see following screenshot:
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
Avg price = total trade volume of quote / total trade volume of base asset
|
||||
Hold portfolio value = (base start asset * current market price) + quote start asset
|
||||
Current portfolio value = (base current asset * current market price) + quote current asset
|
||||
Trade P&L = current portfolio value - hold portfolio value
|
||||
Total P&L = trade P&L + fees paid
|
||||
Return % = total P&L / hold portfolio value
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
>>> history
|
||||
|
||||
Start Time: 2020-11-11 00:56:37
|
||||
Current Time: 2020-11-11 12:57:22
|
||||
Duration: 0 days 12:00:45
|
||||
|
||||
binance / MFT-BNB
|
||||
|
||||
Trades:
|
||||
buy sell total
|
||||
Number of trades 113 97 209
|
||||
Total trade volume (BTC) 2181335 -2133912 47423
|
||||
Total trade volume (USDT) -217,67 210.76 -6.91
|
||||
Avg price 0.0000998 0.0000988 0.0001457
|
||||
|
||||
Assets:
|
||||
|
||||
Start Current Change
|
||||
MFT 155248 202671 47423
|
||||
BNB 23.331 16.419 -6.912
|
||||
MFT/BNB price 0.0001076 0.0000809 -0.0000267
|
||||
Base asset % 41.7% 50.0% 8.2%
|
||||
|
||||
Performance:
|
||||
Hold portfolio value 35.890 BNB
|
||||
Current portfolio value 32.815 BNB
|
||||
Trade P&L -3.075 BNB
|
||||
Fees paid -0.428 BNB
|
||||
Total P&L -3.504 BNB
|
||||
Return %: -9.76%
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
##
|
||||
|
||||
**URL:** https://hummingbot.org/dashboard/backtest-3.png
|
||||
|
||||
---
|
||||
|
||||
## Check Performance - Hummingbot
|
||||
|
||||
**URL:** https://hummingbot.org/client/history/
|
||||
|
||||
**Contents:**
|
||||
- Performance History¶
|
||||
- History command¶
|
||||
- How It Works¶
|
||||
- Sample Output¶
|
||||
- Average Price¶
|
||||
- Hold Portfolio Value¶
|
||||
- Current Portfolio Value¶
|
||||
- Trade P&L¶
|
||||
- Total P&L¶
|
||||
- Return Percentage¶
|
||||
|
||||
The history command displays the current duration of total past trades, asset inventory and value, and market trading pair performance. Run history --verbose to see all recent trades.
|
||||
|
||||
Trades are saved locally in a .csv file located in the data folder which you can view by running history --verbose --days command even after you restart Hummingbot.
|
||||
|
||||
Optional argument --precision specifies the number of decimal values.
|
||||
|
||||
This block below shows the calculation for some of the values displayed in the history output.
|
||||
|
||||
The Return % in the navbar at the bottom of Hummingbot client may be different from the history command output. This is because the Return % in history takes the price changes into calculation while the navbar in the bottom UI does not.
|
||||
|
||||
Run the history command in Hummingbot to display the current duration of total past trades, asset inventory and value, market trading pair performance.
|
||||
|
||||
The following displays the formula for key calculations:
|
||||
|
||||
For more details on the calculations, please see this Google Sheet.
|
||||
|
||||
Avg Price = Total trade volume of quote/Total trade volume of base asset.
|
||||
|
||||
In the sample output, the total avg price is 6.91/47423 = 0.0001457
|
||||
|
||||
This value means the average price of total MFT/BNB trades is 0.0001457
|
||||
|
||||
The asset value from the start to the end with no trades.
|
||||
|
||||
Hold portfolio value = (base start asset*current market price)+ quote start asset
|
||||
|
||||
From the above example, for the Hold portfolio value is (155248*0.0000809)+23.33=35.89
|
||||
|
||||
Current portfolio value = (base current asset*current market price)+ quote current asset
|
||||
|
||||
From the above example, for the Current portfolio value is (202671*0.0000809)+16.419=32.815
|
||||
|
||||
Trade P&L = Current portfolio value - Hold Portfolio value
|
||||
|
||||
From the above example, for the Trade P&L value is 32.815-35.89=-3.075
|
||||
|
||||
Total P&L = Trade P&L + Fees paid
|
||||
|
||||
From the above example, for the Total P&L is -3.075 + -0.428 = -3.504
|
||||
|
||||
Return% = Total P&L/Hold portfolio value
|
||||
|
||||
From the above example, for the Return% is -3.075/-35.89 = -9.76%
|
||||
|
||||
The Return % (bottom navbar) matches the calculated return on History after the last trade, see following screenshot:
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
Avg price = total trade volume of quote / total trade volume of base asset
|
||||
Hold portfolio value = (base start asset * current market price) + quote start asset
|
||||
Current portfolio value = (base current asset * current market price) + quote current asset
|
||||
Trade P&L = current portfolio value - hold portfolio value
|
||||
Total P&L = trade P&L + fees paid
|
||||
Return % = total P&L / hold portfolio value
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
>>> history
|
||||
|
||||
Start Time: 2020-11-11 00:56:37
|
||||
Current Time: 2020-11-11 12:57:22
|
||||
Duration: 0 days 12:00:45
|
||||
|
||||
binance / MFT-BNB
|
||||
|
||||
Trades:
|
||||
buy sell total
|
||||
Number of trades 113 97 209
|
||||
Total trade volume (BTC) 2181335 -2133912 47423
|
||||
Total trade volume (USDT) -217,67 210.76 -6.91
|
||||
Avg price 0.0000998 0.0000988 0.0001457
|
||||
|
||||
Assets:
|
||||
|
||||
Start Current Change
|
||||
MFT 155248 202671 47423
|
||||
BNB 23.331 16.419 -6.912
|
||||
MFT/BNB price 0.0001076 0.0000809 -0.0000267
|
||||
Base asset % 41.7% 50.0% 8.2%
|
||||
|
||||
Performance:
|
||||
Hold portfolio value 35.890 BNB
|
||||
Current portfolio value 32.815 BNB
|
||||
Trade P&L -3.075 BNB
|
||||
Fees paid -0.428 BNB
|
||||
Total P&L -3.504 BNB
|
||||
Return %: -9.76%
|
||||
```
|
||||
|
||||
---
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,39 +0,0 @@
|
||||
# Hummingbot Documentation Index
|
||||
|
||||
## Categories
|
||||
|
||||
### Advanced
|
||||
**File:** `advanced.md`
|
||||
**Pages:** 7
|
||||
|
||||
### Configuration
|
||||
**File:** `configuration.md`
|
||||
**Pages:** 24
|
||||
|
||||
### Connectors
|
||||
**File:** `connectors.md`
|
||||
**Pages:** 100
|
||||
|
||||
### Development
|
||||
**File:** `development.md`
|
||||
**Pages:** 13
|
||||
|
||||
### Getting Started
|
||||
**File:** `getting_started.md`
|
||||
**Pages:** 24
|
||||
|
||||
### Other
|
||||
**File:** `other.md`
|
||||
**Pages:** 75
|
||||
|
||||
### Strategies
|
||||
**File:** `strategies.md`
|
||||
**Pages:** 73
|
||||
|
||||
### Trading
|
||||
**File:** `trading.md`
|
||||
**Pages:** 3
|
||||
|
||||
### Troubleshooting
|
||||
**File:** `troubleshooting.md`
|
||||
**Pages:** 1
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,258 +0,0 @@
|
||||
# Hummingbot - Trading
|
||||
|
||||
**Pages:** 3
|
||||
|
||||
---
|
||||
|
||||
## Overview - Hummingbot
|
||||
|
||||
**URL:** https://hummingbot.org/gateway/
|
||||
|
||||
**Contents:**
|
||||
- Overview
|
||||
- What is Gateway?¶
|
||||
- In This Section¶
|
||||
- Key Features¶
|
||||
- Connector Schemas¶
|
||||
- Installation¶
|
||||
- Architecture¶
|
||||
- Governance and Maintenance¶
|
||||
- Contributing¶
|
||||
- History¶
|
||||
|
||||
Hummingbot Gateway is a Typescript-based API server that standardizes interactions with blockchain networks and decentralized exchanges (DEXs). It acts as a middleware layer, providing a unified interface for performing actions like checking balances, executing trades, and managing wallets across different protocols.
|
||||
|
||||
Gateway is a companion service to the Python-based Hummingbot client, exposing standardized REST API endpoints for trading and liquidity-related functionality on DEXs. This enables Hummingbot to run strategies that operate across both centralized (CEX) and decentralized exchanges seamlessly.
|
||||
|
||||
For detailed implementation guides and examples for each schema, see DEX Connectors.
|
||||
|
||||
Gateway can be installed alongside Hummingbot to enable trading on AMM DEXs, or as a standalone API server. For detailed installation instructions, see Installation & Setup.
|
||||
|
||||
When running Gateway in DEV mode, access the interactive Swagger API documentation at: http://localhost:15888/docs
|
||||
|
||||
Gateway follows a modular architecture with clear separation of concerns:
|
||||
|
||||
Like other connectors, Gateway DEX connectors require ongoing maintenance: fixing bugs, addressing user issues, and keeping up with updates to both the exchange/blockchain API as well as improvements to the Hummingbot connector standard.
|
||||
|
||||
Hummingbot Foundation maintains certain reference connectors as the standard and utilizes a community-based maintenance process. We assign Bounties to community developers to upgrade and fix bugs for each exchange's connectors in the codebase.
|
||||
|
||||
Each quarter, Exchange Connector Polls allocates HBOT bounties toward the top CEX connectors and determines which exchange connectors should be included in the codebase going forward. This process also determines which blockchains and networks that Gateway supports.
|
||||
|
||||
See the Connector Pots tab in HBOT Tracker for the current allocations for each exchange.
|
||||
|
||||
Gateway is part of the open source Hummingbot project. Ways to contribute:
|
||||
|
||||
For more information about Gateway's history and architecture decisions, see:
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (javascript):
|
||||
```javascript
|
||||
/src
|
||||
├── chains/ # Blockchain-specific implementations
|
||||
│ └── {chain}/ # Each blockchain (ethereum, solana, etc.)
|
||||
├── connectors/ # DEX-specific implementations
|
||||
│ ├── {dex}/ # Each DEX connector directory
|
||||
│ │ ├── router-routes/ # DEX aggregator operations
|
||||
│ │ ├── amm-routes/ # AMM pool operations
|
||||
│ │ └── clmm-routes/ # Concentrated liquidity operations
|
||||
├── services/ # Core services (config, logging, tokens)
|
||||
├── schemas/ # API request/response schemas
|
||||
├── templates/ # Base classes and interfaces for connectors
|
||||
├── tokens/ # Token lists and metadata
|
||||
├── pools/ # Liquidity pool configurations
|
||||
└── wallet/ # Wallet management
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Overview - Hummingbot
|
||||
|
||||
**URL:** https://hummingbot.org/gateway
|
||||
|
||||
**Contents:**
|
||||
- Overview
|
||||
- What is Gateway?¶
|
||||
- In This Section¶
|
||||
- Key Features¶
|
||||
- Connector Schemas¶
|
||||
- Installation¶
|
||||
- Architecture¶
|
||||
- Governance and Maintenance¶
|
||||
- Contributing¶
|
||||
- History¶
|
||||
|
||||
Hummingbot Gateway is a Typescript-based API server that standardizes interactions with blockchain networks and decentralized exchanges (DEXs). It acts as a middleware layer, providing a unified interface for performing actions like checking balances, executing trades, and managing wallets across different protocols.
|
||||
|
||||
Gateway is a companion service to the Python-based Hummingbot client, exposing standardized REST API endpoints for trading and liquidity-related functionality on DEXs. This enables Hummingbot to run strategies that operate across both centralized (CEX) and decentralized exchanges seamlessly.
|
||||
|
||||
For detailed implementation guides and examples for each schema, see DEX Connectors.
|
||||
|
||||
Gateway can be installed alongside Hummingbot to enable trading on AMM DEXs, or as a standalone API server. For detailed installation instructions, see Installation & Setup.
|
||||
|
||||
When running Gateway in DEV mode, access the interactive Swagger API documentation at: http://localhost:15888/docs
|
||||
|
||||
Gateway follows a modular architecture with clear separation of concerns:
|
||||
|
||||
Like other connectors, Gateway DEX connectors require ongoing maintenance: fixing bugs, addressing user issues, and keeping up with updates to both the exchange/blockchain API as well as improvements to the Hummingbot connector standard.
|
||||
|
||||
Hummingbot Foundation maintains certain reference connectors as the standard and utilizes a community-based maintenance process. We assign Bounties to community developers to upgrade and fix bugs for each exchange's connectors in the codebase.
|
||||
|
||||
Each quarter, Exchange Connector Polls allocates HBOT bounties toward the top CEX connectors and determines which exchange connectors should be included in the codebase going forward. This process also determines which blockchains and networks that Gateway supports.
|
||||
|
||||
See the Connector Pots tab in HBOT Tracker for the current allocations for each exchange.
|
||||
|
||||
Gateway is part of the open source Hummingbot project. Ways to contribute:
|
||||
|
||||
For more information about Gateway's history and architecture decisions, see:
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (javascript):
|
||||
```javascript
|
||||
/src
|
||||
├── chains/ # Blockchain-specific implementations
|
||||
│ └── {chain}/ # Each blockchain (ethereum, solana, etc.)
|
||||
├── connectors/ # DEX-specific implementations
|
||||
│ ├── {dex}/ # Each DEX connector directory
|
||||
│ │ ├── router-routes/ # DEX aggregator operations
|
||||
│ │ ├── amm-routes/ # AMM pool operations
|
||||
│ │ └── clmm-routes/ # Concentrated liquidity operations
|
||||
├── services/ # Core services (config, logging, tokens)
|
||||
├── schemas/ # API request/response schemas
|
||||
├── templates/ # Base classes and interfaces for connectors
|
||||
├── tokens/ # Token lists and metadata
|
||||
├── pools/ # Liquidity pool configurations
|
||||
└── wallet/ # Wallet management
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Overview - Hummingbot
|
||||
|
||||
**URL:** https://hummingbot.org/hummingbot-api/
|
||||
|
||||
**Contents:**
|
||||
- Hummingbot API¶
|
||||
- Overview¶
|
||||
- Key Features¶
|
||||
- Architecture¶
|
||||
- Key Components¶
|
||||
- Use Cases¶
|
||||
- Getting Started¶
|
||||
- API Routers¶
|
||||
- 🐳 Docker Management¶
|
||||
- 💼 Account Management¶
|
||||
|
||||
The backend-api has been renamed to hummingbot-api, marking a major revamp of the codebase with improvements in architecture, modularity, and developer experience.
|
||||
|
||||
Hummingbot API is a comprehensive RESTful API framework designed for managing trading operations across multiple exchanges. It allows individual traders and teams to deploy custom, private servers for trade execution, portfolio management, and data collection, bot deployment, and other use cases.
|
||||
|
||||
GitHub Repository: github.com/hummingbot/hummingbot-api
|
||||
|
||||
The Hummingbot API enables various trading applications:
|
||||
|
||||
The guides include Docker setup and Python API client examples to get you trading in minutes.
|
||||
|
||||
The Hummingbot API provides the following key routers:
|
||||
|
||||
Manage Docker containers and instances running Hummingbot
|
||||
|
||||
Handle exchange account credentials and configurations
|
||||
|
||||
Discover and manage available exchange connectors
|
||||
|
||||
Monitor and analyze portfolio performance across exchanges
|
||||
|
||||
Execute trades, manage orders, and monitor positions
|
||||
|
||||
Configure and deploy trading strategies with real-time updates
|
||||
|
||||
Access real-time and historical market data
|
||||
|
||||
Deploy, configure, and manage multiple bot instances
|
||||
|
||||
Run strategy backtests with historical data
|
||||
|
||||
The API uses HTTP Basic Authentication:
|
||||
|
||||
A modern, asynchronous Python client is available for interacting with the Hummingbot API. This client is used by the Hummingbot Dashboard as the interface layer for all API communications.
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
graph TB
|
||||
subgraph "Clients"
|
||||
direction LR
|
||||
CUSTOM[Custom Apps]
|
||||
DASH[Hummingbot<br/>Dashboard]
|
||||
AI[AI Agents]
|
||||
end
|
||||
|
||||
subgraph "Hummingbot API"
|
||||
direction LR
|
||||
API["FastAPI<br/>Server<br/>"]
|
||||
PG[(PostgreSQL<br/>Database)]
|
||||
MQTT[EMQX<br/>Message Broker]
|
||||
end
|
||||
|
||||
subgraph "Bots"
|
||||
BOTS[Hummingbot<br/>Instances]
|
||||
end
|
||||
|
||||
subgraph "Exchanges"
|
||||
EX[Binance, OKX,<br/>Hyperliquid, etc.]
|
||||
end
|
||||
|
||||
%% Client connections using API Client
|
||||
DASH -->|Hummingbot API Client| API
|
||||
|
||||
%% Bot connections
|
||||
BOTS <-->|Commands & Updates| MQTT
|
||||
|
||||
%% Exchange connections
|
||||
BOTS <-->|Trade & Data| EX
|
||||
API <-->|Trade & Data| EX
|
||||
|
||||
%% Apply theme colors
|
||||
classDef clientStyle stroke:#5FFFD7,stroke-width:3px
|
||||
classDef apiStyle stroke:#00B1BB,stroke-width:3px
|
||||
classDef botsStyle stroke:#E549FF,stroke-width:3px
|
||||
|
||||
class DASH clientStyle
|
||||
class API,PG,MQTT apiStyle
|
||||
class BOTS botsStyle
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
pip install hummingbot-api-client
|
||||
```
|
||||
|
||||
Example 3 (python):
|
||||
```python
|
||||
from hummingbot_api_client import HummingbotAPIClient
|
||||
|
||||
# Initialize client
|
||||
client = HummingbotAPIClient(
|
||||
base_url="http://localhost:8000",
|
||||
username="your-username",
|
||||
password="your-password"
|
||||
)
|
||||
|
||||
# Get portfolio data
|
||||
portfolio = await client.get_portfolio()
|
||||
|
||||
# Execute a trade
|
||||
order = await client.create_order(
|
||||
connector="binance",
|
||||
trading_pair="BTC-USDT",
|
||||
order_type="limit",
|
||||
side="buy",
|
||||
amount=0.001,
|
||||
price=50000
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
@@ -1,87 +0,0 @@
|
||||
# Hummingbot - Troubleshooting
|
||||
|
||||
**Pages:** 1
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting - Hummingbot
|
||||
|
||||
**URL:** https://hummingbot.org/troubleshooting/
|
||||
|
||||
**Contents:**
|
||||
- Troubleshooting
|
||||
- Installation¶
|
||||
- Docker: Permission denied error¶
|
||||
- Source: conda command not found¶
|
||||
- Source: ./install: line 40 ... Killed¶
|
||||
- Source: Could not find conda environment: hummingbot¶
|
||||
- Source: unable to execute gcc: No such file or directory¶
|
||||
- Dashboard¶
|
||||
- Failed to connect MQTT Bridge:¶
|
||||
- Docker is not running. Please start Docker and refresh the page.¶
|
||||
|
||||
The error message above indicates a permission issue while trying to access the Docker daemon socket. This is a common problem when trying to run Docker commands as a non-root user. To add your user to the docker group, use the following command:
|
||||
|
||||
Ensure Anaconda, Miniconda, or Miniforge (for arm64 systems) is installed. If you've just installed it, restart your terminal to refresh the command line environment.
|
||||
|
||||
Collecting package metadata (repodata.json): / ./install: line 40: 14981 Killed... This error shows up during installation, typically on systems with 2GB RAM or less. Increase your system's RAM to at least 4GB, or consider adding a swap file if upgrading hardware is not feasible.
|
||||
|
||||
This is related to the issue above. Check if there are any errors after running the ./install script. If there are, you'll need to solve those first otherwise creating the hummingbot conda environment will fail.
|
||||
|
||||
If getting this error you'll need to install the build-essential package. Run the command below to install -
|
||||
|
||||
If you get this error, this usually means the Hummingbot Broker is not running, start the Broker from the Instances page and then restart all Hummingbot client instances.
|
||||
|
||||
Make sure you have Docker installed. On Windows and MacOS machines make sure you have Docker Desktop running in the background.
|
||||
|
||||
Note: The name of the missing module could be something else like st_pages etc. If you get this message this means the environment wasn't installed properly. Run the following steps in a terminal to reinstall -
|
||||
|
||||
By default the authentication system is disabled.
|
||||
|
||||
Find the variable AUTH_SYSTEM_ENABLED in the CONFIG.py file and set it to True to enable the authentication page.
|
||||
|
||||
If you are getting this error on Kraken, or a similar error on a different exchange this is because the exchange connector doesn't currently support market orders which the PositionExecutor needs to close the position.
|
||||
|
||||
If you get this error make sure that when you created the API keys you also checked the Access Websockets API option.
|
||||
|
||||
You'll need to approve tokens that you are trading. See below for an example if you are trading WETH on Ethereum mainnet
|
||||
|
||||
When approving tokens, if you get a "Token not Supported" error, please make sure to add the token address in the tokenlist manually. The token list can be found in the ./conf/list folder
|
||||
|
||||
Use the following command to display token balances for different networks.
|
||||
|
||||
This error comes up because CTRL + V doesn't work in Hummingbot. Try any of the following shortcuts below to paste.
|
||||
|
||||
Press CTRL + X if you want to cancel out of the configuration
|
||||
|
||||
If one or more tokens is showing 0 Total in ($), use the command below to change your rate oracle source. By default, the rate_oracle_source is set to Binance and if the token is not available in Binance then the Total in ($) will show 0.
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
docker: Got permission denied while trying to connect to the Docker daemon socket at
|
||||
unix:///var/run/docker.sock...
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
sudo usermod -aG docker $USER
|
||||
|
||||
# Restart the terminal after running the command above, if it still doesn't work try the command below
|
||||
|
||||
sudo chmod 666 /var/run/docker.sock
|
||||
```
|
||||
|
||||
Example 3 (unknown):
|
||||
```unknown
|
||||
$ conda
|
||||
-bash: conda: command not found
|
||||
```
|
||||
|
||||
Example 4 (unknown):
|
||||
```unknown
|
||||
Collecting package metadata (repodata.json): / ./install: line 40: 14981 Killed...
|
||||
```
|
||||
|
||||
---
|
||||
@@ -1,117 +0,0 @@
|
||||
---
|
||||
name: markdown-to-epub
|
||||
description: "Markdown to EPUB build skill: normalize local image references, copy assets, call Calibre ebook-convert, inspect EPUB package structure, and report missing images. Use when turning Markdown manuscripts into reproducible EPUB files."
|
||||
---
|
||||
|
||||
# markdown-to-epub Skill
|
||||
|
||||
Use this skill to build a reproducible EPUB from Markdown manuscripts with local image assets, without mutating the source manuscript.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Trigger when any of these applies:
|
||||
- Converting one or more Markdown files into an EPUB deliverable.
|
||||
- Normalizing broken or inconsistent image references before conversion.
|
||||
- Recovering local assets with unreliable extensions such as `.bin` or `.idunno`.
|
||||
- Running Calibre `ebook-convert` non-interactively from a repeatable build directory.
|
||||
- Checking the resulting EPUB archive for OPF, NCX/NAV, and image inclusion.
|
||||
|
||||
## Not For / Boundaries
|
||||
|
||||
- Not for authoring, rewriting, proofreading, or typesetting the manuscript body.
|
||||
- Not for downloading remote `http(s)` or `data:` images; remote references are preserved unless the user supplies local replacements.
|
||||
- Not a substitute for full EPUB QA in dedicated readers; it performs structural and asset checks only.
|
||||
- Required inputs: source Markdown path, desired EPUB path/title/authors/language, source root, and any fallback asset map.
|
||||
- If Calibre is unavailable, fail clearly and provide the install/`--ebook-convert-bin` verification path instead of producing a fake EPUB.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Common Patterns
|
||||
|
||||
**Build a basic EPUB**
|
||||
```bash
|
||||
python3 skills/markdown-to-epub/scripts/build_epub.py \
|
||||
--input-md "./book.md" \
|
||||
--output-epub "./book.epub" \
|
||||
--title "Book Title" \
|
||||
--authors "Author Name" \
|
||||
--language "zh-CN"
|
||||
```
|
||||
|
||||
**Use a custom source root and build directory**
|
||||
```bash
|
||||
python3 skills/markdown-to-epub/scripts/build_epub.py \
|
||||
--input-md "./manuscript/book.md" \
|
||||
--source-root "./manuscript" \
|
||||
--build-dir "./build/book-epub" \
|
||||
--output-epub "./dist/book.epub"
|
||||
```
|
||||
|
||||
**Recover missing assets with a fallback map**
|
||||
```bash
|
||||
python3 skills/markdown-to-epub/scripts/build_epub.py \
|
||||
--input-md "./book.md" \
|
||||
--output-epub "./book.epub" \
|
||||
--fallback-map "./fallback-map.json"
|
||||
```
|
||||
|
||||
**Allow unresolved local images but report them**
|
||||
```bash
|
||||
python3 skills/markdown-to-epub/scripts/build_epub.py \
|
||||
--input-md "./book.md" \
|
||||
--output-epub "./book.epub" \
|
||||
--no-strict-missing
|
||||
```
|
||||
|
||||
**Point to a non-standard Calibre binary**
|
||||
```bash
|
||||
python3 skills/markdown-to-epub/scripts/build_epub.py \
|
||||
--input-md "./book.md" \
|
||||
--ebook-convert-bin "/opt/calibre/ebook-convert"
|
||||
```
|
||||
|
||||
**Inspect the generated package**
|
||||
```bash
|
||||
unzip -l ./book.epub | rg 'content.opf|toc.ncx|nav.xhtml|\\.(png|jpg|jpeg|webp|gif)$'
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Clean Manuscript Build
|
||||
|
||||
- Input: `book.md` with valid local images and metadata title/author/language.
|
||||
- Steps:
|
||||
1. Run the basic build command.
|
||||
2. Inspect `build_epub/report.json`.
|
||||
3. Check the EPUB zip listing for OPF and navigation files.
|
||||
- Expected output / acceptance: `book.epub` exists, `missing_images` is empty, and package structure contains OPF plus NCX or NAV.
|
||||
|
||||
### Example 2: Extension Recovery
|
||||
|
||||
- Input: Markdown references `images/cover.idunno`, but the file signature is a PNG.
|
||||
- Steps:
|
||||
1. Run the build script in strict mode.
|
||||
2. Confirm copied assets in `build_epub/assets/` use normalized extensions.
|
||||
3. Rebuild after fixing any missing file mapping.
|
||||
- Expected output / acceptance: EPUB includes the normalized image and the report records no unresolved local image.
|
||||
|
||||
### Example 3: Missing Asset Triage
|
||||
|
||||
- Input: manuscript references old file names that no longer exist.
|
||||
- Steps:
|
||||
1. Create a JSON fallback map from missing basenames to replacement basenames.
|
||||
2. Re-run with `--fallback-map`.
|
||||
3. Keep strict mode enabled so unmapped missing assets fail the build.
|
||||
- Expected output / acceptance: every missing local image is either resolved by the map or listed in `report.json` for explicit follow-up.
|
||||
|
||||
## References
|
||||
|
||||
- `references/index.md`: navigation, script contract, and validation notes.
|
||||
- `scripts/build_epub.py`: executable builder used by this skill.
|
||||
- `agents/openai.yaml`: agent metadata for this skill package.
|
||||
|
||||
## Maintenance
|
||||
|
||||
- Sources: local script implementation and EPUB/Calibre behavior observed by the build report.
|
||||
- Last updated: 2026-04-28
|
||||
- Known limits: structural checks do not guarantee visual fidelity in every EPUB reader; run reader-specific QA for final publication.
|
||||
@@ -1,4 +0,0 @@
|
||||
interface:
|
||||
display_name: "Markdown → EPUB 构建器"
|
||||
short_description: "把 Markdown 手稿 + 本地图片资产转换为可校验的 EPUB。"
|
||||
default_prompt: "使用 $markdown-to-epub 把我的 Markdown 手稿和本地图片资产转换成可校验的 EPUB 文件。"
|
||||
@@ -1,27 +0,0 @@
|
||||
# markdown-to-epub Reference Index
|
||||
|
||||
This directory keeps long-form notes for the Markdown to EPUB skill. The entrypoint stays in `../SKILL.md`; operational behavior is implemented by `../scripts/build_epub.py`.
|
||||
|
||||
## Navigation
|
||||
|
||||
- `../SKILL.md`: triggers, boundaries, quick commands, and examples.
|
||||
- `../scripts/build_epub.py`: source of truth for CLI arguments, asset normalization, Calibre invocation, and EPUB inspection.
|
||||
- `../agents/openai.yaml`: optional agent metadata.
|
||||
|
||||
## Script Contract
|
||||
|
||||
- Source Markdown is read-only.
|
||||
- Build artifacts are written to `--build-dir`.
|
||||
- Local images are copied into the build workspace and normalized when the file signature proves a better extension.
|
||||
- Remote `http(s)` and `data:` image references are not downloaded.
|
||||
- Strict mode fails when local image references cannot be resolved.
|
||||
|
||||
## Verification
|
||||
|
||||
Run the builder, then inspect:
|
||||
|
||||
```bash
|
||||
unzip -l ./book.epub | rg 'content.opf|toc.ncx|nav.xhtml|\\.(png|jpg|jpeg|webp|gif)$'
|
||||
```
|
||||
|
||||
Also inspect `report.json` in the build directory for `missing_images`, copied assets, and conversion status.
|
||||
@@ -1,389 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Build a robust EPUB from Markdown with local image assets.
|
||||
|
||||
Features:
|
||||
- Normalize Markdown image references into build_dir/assets
|
||||
- Detect real image extensions from file signatures (.png/.jpg/.gif/.webp/.svg)
|
||||
- Optionally resolve missing files via fallback JSON map
|
||||
- Convert using Calibre ebook-convert
|
||||
- Emit conversion report JSON for verification
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.parse
|
||||
import zipfile
|
||||
from dataclasses import dataclass
|
||||
from hashlib import sha1
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
|
||||
IMAGE_PATTERN = re.compile(r"!\[([^\]]*)\]\(([^)]+)\)")
|
||||
REMOTE_PREFIXES = ("http://", "https://", "data:")
|
||||
VALID_IMAGE_EXTS = {".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg", ".bmp"}
|
||||
|
||||
|
||||
@dataclass
|
||||
class RewriteResult:
|
||||
normalized_markdown: Path
|
||||
assets_dir: Path
|
||||
total_refs: int
|
||||
rewritten_refs: int
|
||||
copied_assets: int
|
||||
missing_images: List[str]
|
||||
|
||||
|
||||
def detect_extension(file_path: Path, data: bytes) -> str:
|
||||
lower_name = file_path.name.lower()
|
||||
if lower_name.endswith(".svg"):
|
||||
return ".svg"
|
||||
if data.startswith(b"\x89PNG\r\n\x1a\n"):
|
||||
return ".png"
|
||||
if data.startswith(b"\xff\xd8\xff"):
|
||||
return ".jpg"
|
||||
if data.startswith(b"GIF87a") or data.startswith(b"GIF89a"):
|
||||
return ".gif"
|
||||
if data.startswith(b"RIFF") and len(data) >= 12 and data[8:12] == b"WEBP":
|
||||
return ".webp"
|
||||
if data.startswith(b"BM"):
|
||||
return ".bmp"
|
||||
current_ext = file_path.suffix.lower()
|
||||
if current_ext in VALID_IMAGE_EXTS:
|
||||
return current_ext
|
||||
return ".bin"
|
||||
|
||||
|
||||
def decode_reference(reference: str) -> str:
|
||||
return urllib.parse.unquote(reference.strip())
|
||||
|
||||
|
||||
def resolve_source_file(
|
||||
source_root: Path,
|
||||
decoded_ref: str,
|
||||
fallback_map: Dict[str, str],
|
||||
) -> Tuple[Optional[Path], str]:
|
||||
decoded_ref = decoded_ref.replace("\\", "/")
|
||||
basename = Path(decoded_ref).name
|
||||
candidates = []
|
||||
|
||||
# Keep relative path when possible.
|
||||
rel_path = Path(decoded_ref)
|
||||
if not rel_path.is_absolute():
|
||||
candidates.append((source_root / rel_path).resolve())
|
||||
|
||||
# Common exported markdown style: "<folder>/<asset>"
|
||||
if "/" in decoded_ref:
|
||||
candidates.append((source_root / basename).resolve())
|
||||
|
||||
# Direct basename fallback.
|
||||
candidates.append((source_root / basename).resolve())
|
||||
|
||||
checked = set()
|
||||
for candidate in candidates:
|
||||
key = str(candidate).lower()
|
||||
if key in checked:
|
||||
continue
|
||||
checked.add(key)
|
||||
if candidate.exists() and candidate.is_file():
|
||||
return candidate, basename
|
||||
|
||||
fallback_name = fallback_map.get(basename)
|
||||
if fallback_name:
|
||||
fallback_candidate = (source_root / fallback_name).resolve()
|
||||
if fallback_candidate.exists() and fallback_candidate.is_file():
|
||||
return fallback_candidate, basename
|
||||
|
||||
return None, basename
|
||||
|
||||
|
||||
def rewrite_markdown_and_copy_assets(
|
||||
input_md: Path,
|
||||
source_root: Path,
|
||||
build_dir: Path,
|
||||
input_encoding: str,
|
||||
fallback_map: Dict[str, str],
|
||||
strict_missing: bool,
|
||||
) -> RewriteResult:
|
||||
assets_dir = build_dir / "assets"
|
||||
assets_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
text = input_md.read_text(encoding=input_encoding)
|
||||
copied_name_by_source: Dict[str, str] = {}
|
||||
missing_images: List[str] = []
|
||||
total_refs = 0
|
||||
rewritten_refs = 0
|
||||
|
||||
def replace(match: re.Match[str]) -> str:
|
||||
nonlocal total_refs, rewritten_refs
|
||||
total_refs += 1
|
||||
alt_text = match.group(1)
|
||||
original_ref = match.group(2).strip()
|
||||
|
||||
if original_ref.lower().startswith(REMOTE_PREFIXES):
|
||||
return match.group(0)
|
||||
|
||||
decoded = decode_reference(original_ref)
|
||||
source_file, missing_name = resolve_source_file(source_root, decoded, fallback_map)
|
||||
if source_file is None:
|
||||
missing_images.append(missing_name)
|
||||
return match.group(0)
|
||||
|
||||
source_key = str(source_file.resolve()).lower()
|
||||
if source_key in copied_name_by_source:
|
||||
target_name = copied_name_by_source[source_key]
|
||||
else:
|
||||
data = source_file.read_bytes()
|
||||
ext = detect_extension(source_file, data)
|
||||
target_name = f"{source_file.stem}{ext}"
|
||||
target_path = assets_dir / target_name
|
||||
if target_path.exists():
|
||||
existing_data = target_path.read_bytes()
|
||||
if existing_data != data:
|
||||
digest = sha1(data).hexdigest()[:8]
|
||||
target_name = f"{source_file.stem}-{digest}{ext}"
|
||||
target_path = assets_dir / target_name
|
||||
target_path.write_bytes(data)
|
||||
copied_name_by_source[source_key] = target_name
|
||||
|
||||
rewritten_refs += 1
|
||||
return f""
|
||||
|
||||
rewritten = IMAGE_PATTERN.sub(replace, text)
|
||||
normalized_md = build_dir / "book.normalized.md"
|
||||
normalized_md.write_text(rewritten, encoding="utf-8")
|
||||
|
||||
unique_missing = sorted(set(missing_images))
|
||||
if strict_missing and unique_missing:
|
||||
msg = (
|
||||
"Missing local image files detected. "
|
||||
f"Count={len(unique_missing)}; examples={unique_missing[:10]}"
|
||||
)
|
||||
raise FileNotFoundError(msg)
|
||||
|
||||
return RewriteResult(
|
||||
normalized_markdown=normalized_md,
|
||||
assets_dir=assets_dir,
|
||||
total_refs=total_refs,
|
||||
rewritten_refs=rewritten_refs,
|
||||
copied_assets=len(copied_name_by_source),
|
||||
missing_images=unique_missing,
|
||||
)
|
||||
|
||||
|
||||
def run_ebook_convert(
|
||||
ebook_convert_bin: str,
|
||||
normalized_md: Path,
|
||||
output_epub: Path,
|
||||
title: Optional[str],
|
||||
authors: Optional[str],
|
||||
language: Optional[str],
|
||||
input_encoding: str,
|
||||
conversion_log: Path,
|
||||
) -> None:
|
||||
cmd = [
|
||||
ebook_convert_bin,
|
||||
str(normalized_md),
|
||||
str(output_epub),
|
||||
"--input-encoding",
|
||||
input_encoding,
|
||||
"--level1-toc",
|
||||
"//h:h1",
|
||||
"--level2-toc",
|
||||
"//h:h2",
|
||||
"--level3-toc",
|
||||
"//h:h3",
|
||||
]
|
||||
|
||||
if title:
|
||||
cmd.extend(["--title", title])
|
||||
if authors:
|
||||
cmd.extend(["--authors", authors])
|
||||
if language:
|
||||
cmd.extend(["--language", language])
|
||||
|
||||
proc = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace")
|
||||
conversion_log.write_text(
|
||||
"\n".join(
|
||||
[
|
||||
f"COMMAND: {' '.join(cmd)}",
|
||||
"",
|
||||
"STDOUT:",
|
||||
proc.stdout,
|
||||
"",
|
||||
"STDERR:",
|
||||
proc.stderr,
|
||||
"",
|
||||
f"EXIT_CODE: {proc.returncode}",
|
||||
]
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
raise RuntimeError(f"ebook-convert failed with exit code {proc.returncode}")
|
||||
|
||||
|
||||
def inspect_epub(epub_file: Path) -> Dict[str, object]:
|
||||
if not epub_file.exists():
|
||||
raise FileNotFoundError(f"EPUB not found: {epub_file}")
|
||||
|
||||
with zipfile.ZipFile(epub_file) as zf:
|
||||
names = zf.namelist()
|
||||
image_files = [
|
||||
n for n in names if re.search(r"\.(png|jpg|jpeg|gif|svg|webp|bmp)$", n, flags=re.IGNORECASE)
|
||||
]
|
||||
has_opf = any(n.lower().endswith(".opf") for n in names)
|
||||
has_ncx_or_nav = any(n.lower().endswith(".ncx") or "nav" in n.lower() for n in names)
|
||||
nav_points = 0
|
||||
for name in names:
|
||||
if name.lower().endswith(".ncx"):
|
||||
content = zf.read(name).decode("utf-8", errors="ignore")
|
||||
nav_points = len(re.findall(r"<navPoint\b", content))
|
||||
break
|
||||
|
||||
return {
|
||||
"file_size": epub_file.stat().st_size,
|
||||
"total_files": len(names),
|
||||
"image_files": len(image_files),
|
||||
"has_opf": has_opf,
|
||||
"has_ncx_or_nav": has_ncx_or_nav,
|
||||
"ncx_nav_points": nav_points,
|
||||
}
|
||||
|
||||
|
||||
def load_fallback_map(path: Optional[Path]) -> Dict[str, str]:
|
||||
if path is None:
|
||||
return {}
|
||||
content = path.read_text(encoding="utf-8-sig")
|
||||
raw = json.loads(content)
|
||||
if not isinstance(raw, dict):
|
||||
raise ValueError("--fallback-map must be a JSON object")
|
||||
output: Dict[str, str] = {}
|
||||
for key, value in raw.items():
|
||||
if isinstance(key, str) and isinstance(value, str):
|
||||
output[key] = value
|
||||
return output
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description="从 Markdown 与本地图片资产构建 EPUB。")
|
||||
parser.add_argument("--input-md", required=True, type=Path, help="源 Markdown 路径。")
|
||||
parser.add_argument(
|
||||
"--output-epub",
|
||||
type=Path,
|
||||
help="输出 EPUB 路径。默认:当前目录下的 <input-stem>.epub。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--source-root",
|
||||
type=Path,
|
||||
help="解析图片引用的根目录。默认:Markdown 所在目录。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--build-dir",
|
||||
type=Path,
|
||||
default=Path.cwd() / "build_epub",
|
||||
help="构建工作区目录(规范化 Markdown / assets / 日志 / 报告)。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--fallback-map",
|
||||
type=Path,
|
||||
help="JSON 映射:缺失图片 basename → 替换 basename。",
|
||||
)
|
||||
parser.add_argument("--title", help="EPUB 标题元数据。")
|
||||
parser.add_argument("--authors", help="EPUB 作者元数据。")
|
||||
parser.add_argument("--language", default="zh-CN", help="EPUB 语言元数据。")
|
||||
parser.add_argument("--input-encoding", default="utf-8", help="输入 Markdown 编码。")
|
||||
parser.add_argument("--ebook-convert-bin", default="ebook-convert", help="ebook-convert 可执行文件名/路径。")
|
||||
parser.add_argument(
|
||||
"--strict-missing",
|
||||
action="store_true",
|
||||
default=True,
|
||||
help="严格模式:任何本地图片无法解析则失败(默认开启)。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-strict-missing",
|
||||
action="store_false",
|
||||
dest="strict_missing",
|
||||
help="关闭严格模式:即使存在未解析的本地图片引用也继续转换。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--clean-build-dir",
|
||||
action="store_true",
|
||||
help="转换前清空 build-dir。",
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = parse_args()
|
||||
|
||||
input_md = args.input_md.resolve()
|
||||
if not input_md.exists():
|
||||
raise FileNotFoundError(f"Markdown not found: {input_md}")
|
||||
|
||||
output_epub = (
|
||||
args.output_epub.resolve()
|
||||
if args.output_epub
|
||||
else (Path.cwd() / f"{input_md.stem}.epub").resolve()
|
||||
)
|
||||
source_root = args.source_root.resolve() if args.source_root else input_md.parent.resolve()
|
||||
build_dir = args.build_dir.resolve()
|
||||
|
||||
if args.clean_build_dir and build_dir.exists():
|
||||
shutil.rmtree(build_dir)
|
||||
build_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
fallback_map = load_fallback_map(args.fallback_map.resolve() if args.fallback_map else None)
|
||||
|
||||
rewrite_result = rewrite_markdown_and_copy_assets(
|
||||
input_md=input_md,
|
||||
source_root=source_root,
|
||||
build_dir=build_dir,
|
||||
input_encoding=args.input_encoding,
|
||||
fallback_map=fallback_map,
|
||||
strict_missing=args.strict_missing,
|
||||
)
|
||||
|
||||
conversion_log = build_dir / "conversion.log"
|
||||
run_ebook_convert(
|
||||
ebook_convert_bin=args.ebook_convert_bin,
|
||||
normalized_md=rewrite_result.normalized_markdown,
|
||||
output_epub=output_epub,
|
||||
title=args.title,
|
||||
authors=args.authors,
|
||||
language=args.language,
|
||||
input_encoding="utf-8",
|
||||
conversion_log=conversion_log,
|
||||
)
|
||||
|
||||
epub_info = inspect_epub(output_epub)
|
||||
report = {
|
||||
"input_markdown": str(input_md),
|
||||
"output_epub": str(output_epub),
|
||||
"build_dir": str(build_dir),
|
||||
"total_image_refs": rewrite_result.total_refs,
|
||||
"rewritten_image_refs": rewrite_result.rewritten_refs,
|
||||
"copied_assets": rewrite_result.copied_assets,
|
||||
"missing_images": rewrite_result.missing_images,
|
||||
"epub": epub_info,
|
||||
}
|
||||
report_path = build_dir / "report.json"
|
||||
report_path.write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
|
||||
print(json.dumps(report, ensure_ascii=False, indent=2))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
raise SystemExit(main())
|
||||
except Exception as exc: # pragma: no cover
|
||||
print(f"错误:{exc}", file=sys.stderr)
|
||||
raise
|
||||
@@ -1,141 +0,0 @@
|
||||
---
|
||||
name: polymarket
|
||||
description: "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-client` WebSocket client.
|
||||
- Subscribing to activity, comments, RFQ, crypto price, `clob_market`, or authenticated `clob_user` topics.
|
||||
- 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**
|
||||
```bash
|
||||
npm install @polymarket/real-time-data-client
|
||||
```
|
||||
|
||||
**Subscribe to live trades**
|
||||
```typescript
|
||||
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**
|
||||
```typescript
|
||||
client.subscribe({
|
||||
subscriptions: [{
|
||||
topic: "activity",
|
||||
type: "trades",
|
||||
filters: "{\"market_slug\":\"btc-above-100k-2024\"}",
|
||||
}],
|
||||
});
|
||||
```
|
||||
|
||||
**Subscribe to CLOB market price changes**
|
||||
```typescript
|
||||
client.subscribe({
|
||||
subscriptions: [{
|
||||
topic: "clob_market",
|
||||
type: "price_change",
|
||||
filters: "[\"100\",\"101\",\"102\"]",
|
||||
}],
|
||||
});
|
||||
```
|
||||
|
||||
**Subscribe to comments for an event**
|
||||
```typescript
|
||||
client.subscribe({
|
||||
subscriptions: [{
|
||||
topic: "comments",
|
||||
type: "*",
|
||||
filters: "{\"parentEntityID\":12345,\"parentEntityType\":\"Event\"}",
|
||||
}],
|
||||
});
|
||||
```
|
||||
|
||||
**Authenticate a user stream**
|
||||
```typescript
|
||||
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:
|
||||
1. Subscribe to `activity/trades` with a `market_slug` filter.
|
||||
2. Normalize messages into timestamp, market, side, price, size.
|
||||
3. Alert only when trade size or price movement crosses the configured threshold.
|
||||
- Expected output / acceptance: real-time public trade stream with no private authentication material.
|
||||
|
||||
### Example 2: CLOB Price Dashboard
|
||||
|
||||
- Input: CLOB market IDs.
|
||||
- Steps:
|
||||
1. Subscribe to `clob_market/price_change` with a JSON array filter.
|
||||
2. Update an in-memory view keyed by market id.
|
||||
3. Persist snapshots at a controlled interval rather than every message if volume is high.
|
||||
- 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:
|
||||
1. Load credentials at runtime without logging them.
|
||||
2. Subscribe to `clob_user` order/trade events.
|
||||
3. 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.md` and `references/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.
|
||||
@@ -1,396 +0,0 @@
|
||||
# Real time data client
|
||||
|
||||
This client provides a wrapper to connect to the `real-time-data-streaming` `WebSocket` service.
|
||||
|
||||
## How to use it
|
||||
|
||||
Here is a quick example about how to connect to the service and start receiving messages (you can find more in the folder `examples/`):
|
||||
|
||||
```typescript
|
||||
import { RealTimeDataClient } from "../src/client";
|
||||
import { Message } from "../src/model";
|
||||
|
||||
const onMessage = (message: Message): void => {
|
||||
console.log(message.topic, message.type, message.payload);
|
||||
};
|
||||
|
||||
const onConnect = (client: RealTimeDataClient): void => {
|
||||
// Subscribe to a topic
|
||||
client.subscribe({
|
||||
subscriptions: [
|
||||
{
|
||||
topic: "comments",
|
||||
type: "*", // "*"" can be used to connect to all the types of the topic
|
||||
filters: `{"parentEntityID":100,"parentEntityType":"Event"}`, // empty means no filter
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
new RealTimeDataClient({ onMessage, onConnect }).connect();
|
||||
```
|
||||
|
||||
## How to subscribe and unsubscribe from messages
|
||||
|
||||
Once the connection is stablished and you have a `client: RealTimeDataClient` object, you can `subscribe` and `unsubscribe` to many messages streamings using the same connection.
|
||||
|
||||
### Subscribe
|
||||
|
||||
Subscribe to 'trades' messages from the topic 'activity' and to the all comments messages.
|
||||
|
||||
```typescript
|
||||
client.subscribe({
|
||||
subscriptions: [
|
||||
{
|
||||
topic: "activity",
|
||||
type: "trades",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
client.subscribe({
|
||||
subscriptions: [
|
||||
{
|
||||
topic: "comments",
|
||||
type: "*", // "*"" can be used to connect to all the types of the topic
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
### Unsubscribe
|
||||
|
||||
Unsubscribe from the new trades messages of the topic 'activity'. If 'activity' has more messages types and I used '\*' to connect to all of them, this will only unsubscribe from the type 'trades'.
|
||||
|
||||
```typescript
|
||||
client.subscribe({
|
||||
subscriptions: [
|
||||
{
|
||||
topic: "activity",
|
||||
type: "trades",
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
### Disconnect
|
||||
|
||||
The `client` object provides a method to disconnect from the `WebSocket` server:
|
||||
|
||||
```typescript
|
||||
client.disconnect();
|
||||
```
|
||||
|
||||
## Messages hierarchy
|
||||
|
||||
| Topic | Type | Auth | Filters (if it is empty the messages won't be filtered) | Schema | Subscription Handler |
|
||||
| ------------------------- | ------------------ | -------- | --------------------------------------------------------------- | ----------------------------------- | ----------------------------------------------------------- |
|
||||
| `activity` | `trades` | - | `{"event_slug":"string"}' OR '{"market_slug":"string"}` | [`Trade`](#trade) | |
|
||||
| `activity` | `orders_matched` | - | `{"event_slug":"string"}' OR '{"market_slug":"string"}` | [`Trade`](#trade) | |
|
||||
| `comments` | `comment_created` | - | `{"parentEntityID":number,"parentEntityType":"Event / Series"}` | [`Comment`](#comment) | |
|
||||
| `comments` | `comment_removed` | - | `{"parentEntityID":number,"parentEntityType":"Event / Series"}` | [`Comment`](#comment) | |
|
||||
| `comments` | `reaction_created` | - | `{"parentEntityID":number,"parentEntityType":"Event / Series"}` | [`Reaction`](#reaction) | |
|
||||
| `comments` | `reaction_removed` | - | `{"parentEntityID":number,"parentEntityType":"Event / Series"}` | [`Reaction`](#reaction) | |
|
||||
| `rfq` | `request_created` | - | - | [`Request`](#request) | |
|
||||
| `rfq` | `request_edited` | - | - | [`Request`](#request) | |
|
||||
| `rfq` | `request_canceled` | - | - | [`Request`](#request) | |
|
||||
| `rfq` | `request_expired` | - | - | [`Request`](#request) | |
|
||||
| `rfq` | `quote_created` | - | - | [`Quote`](#quote) | |
|
||||
| `rfq` | `quote_edited` | - | - | [`Quote`](#quote) | |
|
||||
| `rfq` | `quote_canceled` | - | - | [`Quote`](#quote) | |
|
||||
| `rfq` | `quote_expired` | - | - | [`Quote`](#quote) | |
|
||||
| `crypto_prices` | `update` | - | `{"symbol":string}` | [`CryptoPrice`](#cryptoprice) | [`CryptoPriceHistorical`](#initial-data-dump-on-connection) |
|
||||
| `crypto_prices_chainlink` | `update` | - | `{"symbol":string}` | [`CryptoPrice`](#cryptoprice) | [`CryptoPriceHistorical`](#initial-data-dump-on-connection) |
|
||||
| `clob_user` | `order` | ClobAuth | - | [`Order`](#order) | |
|
||||
| `clob_user` | `trade` | ClobAuth | - | [`Trade`](#trade-1) | |
|
||||
| `clob_market` | `price_change` | - | `["100","200",...]` (filters are mandatory on this one) | [`PriceChanges`](#pricechanges) | |
|
||||
| `clob_market` | `agg_orderbook` | - | `["100","200",...]` | [`AggOrderbook`](#aggorderbook) | [`AggOrderbook`](#aggorderbook) |
|
||||
| `clob_market` | `last_trade_price` | - | `["100","200",...]` | [`LastTradePrice`](#lasttradeprice) | |
|
||||
| `clob_market` | `tick_size_change` | - | `["100","200",...]` | [`TickSizeChange`](#ticksizechange) | |
|
||||
| `clob_market` | `market_created` | - | - | [`ClobMarket`](#clobmarket) | |
|
||||
| `clob_market` | `market_resolved` | - | - | [`ClobMarket`](#clobmarket) | |
|
||||
|
||||
## Auth
|
||||
|
||||
### ClobAuth
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* API key credentials for CLOB authentication.
|
||||
*/
|
||||
export interface ClobApiKeyCreds {
|
||||
/** API key used for authentication */
|
||||
key: string;
|
||||
|
||||
/** API secret associated with the key */
|
||||
secret: string;
|
||||
|
||||
/** Passphrase required for authentication */
|
||||
passphrase: string;
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
client.subscribe({
|
||||
subscriptions: [
|
||||
{
|
||||
topic: "clob_user",
|
||||
type: "*",
|
||||
clob_auth: {
|
||||
key: "xxxxxx-xxxx-xxxxx-xxxx-xxxxxx",
|
||||
secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
passphrase: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## Message types
|
||||
|
||||
### Activity
|
||||
|
||||
#### Trade
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----------------- | ------- | -------------------------------------------------- |
|
||||
| `asset` | string | ERC1155 token ID of conditional token being traded |
|
||||
| `bio` | string | Bio of the user of the trade |
|
||||
| `conditionId` | string | Id of market which is also the CTF condition ID |
|
||||
| `eventSlug` | string | Slug of the event |
|
||||
| `icon` | string | URL to the market icon image |
|
||||
| `name` | string | Name of the user of the trade |
|
||||
| `outcome` | string | Human readable outcome of the market |
|
||||
| `outcomeIndex` | integer | Index of the outcome |
|
||||
| `price` | float | Price of the trade |
|
||||
| `profileImage` | string | URL to the user profile image |
|
||||
| `proxyWallet` | string | Address of the user proxy wallet |
|
||||
| `pseudonym` | string | Pseudonym of the user |
|
||||
| `side` | string | Side of the trade (`BUY`/`SELL`) |
|
||||
| `size` | integer | Size of the trade |
|
||||
| `slug` | string | Slug of the market |
|
||||
| `timestamp` | integer | Timestamp of the trade |
|
||||
| `title` | string | Title of the event |
|
||||
| `transactionHash` | string | Hash of the transaction |
|
||||
|
||||
### Comments
|
||||
|
||||
#### Comment
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------ | ------ | ------------------------------------------- |
|
||||
| `id` | string | Unique identifier of comment |
|
||||
| `body` | string | Content of the comment |
|
||||
| `parentEntityType` | string | Type of the parent entity (Event or Series) |
|
||||
| `parentEntityID` | number | ID of the parent entity |
|
||||
| `parentCommentID` | string | ID of the parent comment |
|
||||
| `userAddress` | string | Address of the user |
|
||||
| `replyAddress` | string | Address of the reply user |
|
||||
| `createdAt` | string | Creation timestamp |
|
||||
| `updatedAt` | string | Last update timestamp |
|
||||
|
||||
#### Reaction
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------------- | ------ | ------------------------------ |
|
||||
| `id` | string | Unique identifier of reaction |
|
||||
| `commentID` | number | ID of the comment |
|
||||
| `reactionType` | string | Type of the reaction |
|
||||
| `icon` | string | Icon representing the reaction |
|
||||
| `userAddress` | string | Address of the user |
|
||||
| `createdAt` | string | Creation timestamp |
|
||||
|
||||
### RFQ
|
||||
|
||||
#### Request
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------------- | ------ | --------------------------------------------------------------- |
|
||||
| `requestId` | string | Unique identifier for the request |
|
||||
| `proxyAddress` | string | User proxy address |
|
||||
| `market` | string | Id of market which is also the CTF condition ID |
|
||||
| `token` | string | `ERC1155` token ID of conditional token being traded |
|
||||
| `complement` | string | Complement `ERC1155` token ID of conditional token being traded |
|
||||
| `state` | string | Current state of the request |
|
||||
| `side` | string | Indicates buy or sell side |
|
||||
| `sizeIn` | number | Input size of the request |
|
||||
| `sizeOut` | number | Output size of the request |
|
||||
| `price` | number | Price from in/out sizes |
|
||||
| `expiry` | number | Expiry timestamp (UNIX format) |
|
||||
|
||||
#### Quote
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------------- | ------ | --------------------------------------------------------------- |
|
||||
| `quoteId` | string | Unique identifier for the quote |
|
||||
| `requestId` | string | Associated request identifier |
|
||||
| `proxyAddress` | string | User proxy address |
|
||||
| `token` | string | `ERC1155` token ID of conditional token being traded |
|
||||
| `state` | string | Current state of the quote |
|
||||
| `side` | string | Indicates buy or sell side |
|
||||
| `sizeIn` | number | Input size of the quote |
|
||||
| `sizeOut` | number | Output size of the quote |
|
||||
| `sizeOut` | number | Output size of the request |
|
||||
| `condition` | string | Id of market which is also the CTF condition ID |
|
||||
| `complement` | string | Complement `ERC1155` token ID of conditional token being traded |
|
||||
| `expiry` | number | Expiry timestamp (UNIX format) |
|
||||
|
||||
### CryptoPrice
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----------- | ------ | ---------------------------------------- |
|
||||
| `symbol` | string | Symbol of the asset |
|
||||
| `timestamp` | number | Timestamp in milliseconds for the update |
|
||||
| `value` | number | Value at the time of update |
|
||||
|
||||
#### Filters
|
||||
|
||||
- `{"symbol":"btcusdt"}`
|
||||
- `{"symbol":"ethusdt"}`
|
||||
- `{"symbol":"xrpusdt"}`
|
||||
- `{"symbol":"solusdt"}`
|
||||
|
||||
#### Initial data dump on connection
|
||||
|
||||
When the connection is stablished, if a `filter` is used, the server will dump an initial snapshoot of recent data
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------ | ------ | ---------------------------------------------------------------- |
|
||||
| symbol | string | Symbol of the asset |
|
||||
| data | array | Array of price data objects, each containing timestamp and value |
|
||||
|
||||
### CLOB User
|
||||
|
||||
#### Order
|
||||
|
||||
| Name | Type | Description |
|
||||
| --------------- | ------------------ | --------------------------------------------------------- |
|
||||
| `asset_id` | string | Order's `ERC1155` token ID of conditional token |
|
||||
| `created_at` | string (timestamp) | Order's creation UNIX timestamp |
|
||||
| `expiration` | string (timestamp) | Order's expiration UNIX timestamp |
|
||||
| `id` | string | Unique order hash identifier |
|
||||
| `maker_address` | string | Maker’s address (funder) |
|
||||
| `market` | string | Condition ID or market identifier |
|
||||
| `order_type` | string | Type of order: `GTC`, `GTD`, `FOK`, `FAK` |
|
||||
| `original_size` | string | Original size of the order at placement |
|
||||
| `outcome` | string | Order outcome: `YES` / `NO` |
|
||||
| `owner` | string | UUID of the order owner |
|
||||
| `price` | string | Order price (e.g., in decimals like `0.5`) |
|
||||
| `side` | string | Side of the trade: `BUY` or `SELL` |
|
||||
| `size_matched` | string | Amount of order that has been matched |
|
||||
| `status` | string | Status of the order (e.g., `MATCHED`) |
|
||||
| `type` | string | Type of update: `PLACEMENT`, `CANCELLATION`, `FILL`, etc. |
|
||||
|
||||
#### Trade
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------ | ------------------ | ----------------------------------------------------------------- |
|
||||
| `asset_id` | string | `ERC1155` token ID of the conditional token involved in the trade |
|
||||
| `fee_rate_bps` | string | Fee rate in basis points (bps) |
|
||||
| `id` | string | Unique identifier for the match record |
|
||||
| `last_update` | string (timestamp) | Last update timestamp (UNIX) |
|
||||
| `maker_address` | string | Maker’s address |
|
||||
| `maker_orders` | array | List of maker orders (see nested schema below) |
|
||||
| `market` | string | Condition ID or market identifier |
|
||||
| `match_time` | string (timestamp) | Match execution timestamp (UNIX) |
|
||||
| `outcome` | string | Outcome of the market: `YES` / `NO` |
|
||||
| `owner` | string | UUID of the taker (owner of the matched order) |
|
||||
| `price` | string | Matched price (in decimal format, e.g., `0.5`) |
|
||||
| `side` | string | Taker side of the trade: `BUY` or `SELL` |
|
||||
| `size` | string | Total matched size |
|
||||
| `status` | string | Status of the match: e.g., `MINED` |
|
||||
| `taker_order_id` | string | ID of the taker's order |
|
||||
| `transaction_hash` | string | Transaction hash where the match was settled |
|
||||
|
||||
##### `maker_orders`
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------------- | ------ | ---------------------------------------------------------------- |
|
||||
| `asset_id` | string | `ERC1155` token ID of the conditional token of the maker's order |
|
||||
| `fee_rate_bps` | string | Maker's fee rate in basis points |
|
||||
| `maker_address` | string | Maker’s address |
|
||||
| `matched_amount` | string | Amount matched from the maker's order |
|
||||
| `order_id` | string | ID of the maker's order |
|
||||
| `outcome` | string | Outcome targeted by the maker's order (`YES` / `NO`) |
|
||||
| `owner` | string | UUID of the maker |
|
||||
| `price` | string | Order price |
|
||||
| `side` | string | Side of the maker: `BUY` or `SELL` |
|
||||
|
||||
### CLOB market
|
||||
|
||||
#### PriceChanges
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------- | ------------------ | --------------------------------------------------------- |
|
||||
| `m` (market) | string | Condition ID |
|
||||
| `pc` (price change) | array | Price changes by book |
|
||||
| `t` (timestamp) | string (timestamp) | Timestamp in milliseconds since epoch (UNIX time \* 1000) |
|
||||
|
||||
##### PriceChange
|
||||
|
||||
NOTE: Filters are mandatory for this topic/type. Example: `["100","200",...]` (collection of token ids)
|
||||
|
||||
| Name | Type | Description |
|
||||
| --------------- | ------ | --------------------------------------------------------------- |
|
||||
| `a` (asset_id) | string | Asset identifier |
|
||||
| `h` (hash) | string | Unique hash ID of the book snapshot |
|
||||
| `p` (price) | string | Price quoted (e.g., `0.5`) |
|
||||
| `s` (side) | string | Side of the quote: `BUY` or `SELL` |
|
||||
| `si` (size) | string | Size or volume available at the quoted price (e.g., `0`, `100`) |
|
||||
| `ba` (best_ask) | string | Best ask price |
|
||||
| `bb` (best_bid) | string | Best bid price |
|
||||
|
||||
#### AggOrderbook
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------------- | ------------------ | ----------------------------------------------------------------------- |
|
||||
| `asks` | array | List of ask aggregated orders (sell side), each with `price` and `size` |
|
||||
| `asset_id` | string | Asset Id identifier |
|
||||
| `bids` | array | List of aggregated bid orders (buy side), each with `price` and `size` |
|
||||
| `hash` | string | Unique hash ID for this orderbook snapshot |
|
||||
| `market` | string | Market or condition ID |
|
||||
| `min_order_size` | string | Minimum allowed order size |
|
||||
| `neg_risk` | boolean | NegRisk or not |
|
||||
| `tick_size` | string | Minimum tick size |
|
||||
| `timestamp` | string (timestamp) | Timestamp in milliseconds since epoch (UNIX time \* 1000) |
|
||||
|
||||
##### `asks`/`bids` scheema
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------- | ------ | ------------------ |
|
||||
| `price` | string | Price level |
|
||||
| `size` | string | Size at that price |
|
||||
|
||||
##### Initial data dump on connection
|
||||
|
||||
When the connection is stablished, if a `filter` is used, the server will dump an initial snapshoot of recent data
|
||||
|
||||
#### LastTradePrice
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------------- | ------ | ---------------------------------- |
|
||||
| `asset_id` | string | Asset Id identifier |
|
||||
| `fee_rate_bps` | string | Fee rate in basis points (bps) |
|
||||
| `market` | string | Market or condition ID |
|
||||
| `price` | string | Trade price (e.g., `0.5`) |
|
||||
| `side` | string | Side of the order: `BUY` or `SELL` |
|
||||
| `size` | string | Size of the trade |
|
||||
|
||||
#### TickSizeChange
|
||||
|
||||
| Name | Type | Description |
|
||||
| --------------- | ------ | ------------------------------------ |
|
||||
| `market` | string | Market or condition ID |
|
||||
| `asset_id` | string | Array of two `ERC1155` asset ID |
|
||||
| `old_tick_size` | string | Previous tick size before the change |
|
||||
| `new_tick_size` | string | Updated tick size after the change |
|
||||
|
||||
#### ClobMarket
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------------- | --------- | ------------------------------------------------------------------ |
|
||||
| `market` | string | Market or condition ID |
|
||||
| `asset_ids` | [2]string | Array of two `ERC1155` asset ID identifiers associated with market |
|
||||
| `min_order_size` | string | Minimum size allowed for an order |
|
||||
| `tick_size` | string | Minimum allowable price increment |
|
||||
| `neg_risk` | boolean | Indicates if the market is negative risk |
|
||||
@@ -1,655 +0,0 @@
|
||||
# Polymarket - Api
|
||||
|
||||
**Pages:** 46
|
||||
|
||||
---
|
||||
|
||||
## Get sports metadata information
|
||||
|
||||
**URL:** llms-txt#get-sports-metadata-information
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/sports/get-sports-metadata-information
|
||||
|
||||
api-reference/gamma-openapi.json get /sports
|
||||
Retrieves metadata for various sports including images, resolution sources, ordering preferences, tags, and series information. This endpoint provides comprehensive sport configuration data used throughout the platform.
|
||||
|
||||
---
|
||||
|
||||
## Get user activity
|
||||
|
||||
**URL:** llms-txt#get-user-activity
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/core/get-user-activity
|
||||
|
||||
api-reference/data-api-openapi.yaml get /activity
|
||||
Returns on-chain activity for a user.
|
||||
|
||||
---
|
||||
|
||||
## Get comments by comment id
|
||||
|
||||
**URL:** llms-txt#get-comments-by-comment-id
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/comments/get-comments-by-comment-id
|
||||
|
||||
api-reference/gamma-openapi.json get /comments/{id}
|
||||
|
||||
---
|
||||
|
||||
## Get open interest
|
||||
|
||||
**URL:** llms-txt#get-open-interest
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/misc/get-open-interest
|
||||
|
||||
api-reference/data-api-openapi.yaml get /oi
|
||||
|
||||
---
|
||||
|
||||
## Get total value of a user's positions
|
||||
|
||||
**URL:** llms-txt#get-total-value-of-a-user's-positions
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/core/get-total-value-of-a-users-positions
|
||||
|
||||
api-reference/data-api-openapi.yaml get /value
|
||||
|
||||
---
|
||||
|
||||
## Get related tags (relationships) by tag id
|
||||
|
||||
**URL:** llms-txt#get-related-tags-(relationships)-by-tag-id
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/tags/get-related-tags-relationships-by-tag-id
|
||||
|
||||
api-reference/gamma-openapi.json get /tags/{id}/related-tags
|
||||
|
||||
---
|
||||
|
||||
## List events
|
||||
|
||||
**URL:** llms-txt#list-events
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/events/list-events
|
||||
|
||||
api-reference/gamma-openapi.json get /events
|
||||
|
||||
---
|
||||
|
||||
## Get tag by id
|
||||
|
||||
**URL:** llms-txt#get-tag-by-id
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/tags/get-tag-by-id
|
||||
|
||||
api-reference/gamma-openapi.json get /tags/{id}
|
||||
|
||||
---
|
||||
|
||||
## Get market by id
|
||||
|
||||
**URL:** llms-txt#get-market-by-id
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/markets/get-market-by-id
|
||||
|
||||
api-reference/gamma-openapi.json get /markets/{id}
|
||||
|
||||
---
|
||||
|
||||
## WSS Authentication
|
||||
|
||||
**URL:** llms-txt#wss-authentication
|
||||
|
||||
Source: https://docs.polymarket.com/developers/CLOB/websocket/wss-auth
|
||||
|
||||
<Tip> Only connections to `user` channel require authentication. </Tip>
|
||||
|
||||
| Field | Optional | Description |
|
||||
| ---------- | -------- | ------------------------------------- |
|
||||
| apikey | yes | Polygon account's CLOB api key |
|
||||
| secret | yes | Polygon account's CLOB api secret |
|
||||
| passphrase | yes | Polygon account's CLOB api passphrase |
|
||||
|
||||
---
|
||||
|
||||
## Get tags related to a tag slug
|
||||
|
||||
**URL:** llms-txt#get-tags-related-to-a-tag-slug
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/tags/get-tags-related-to-a-tag-slug
|
||||
|
||||
api-reference/gamma-openapi.json get /tags/slug/{slug}/related-tags/tags
|
||||
|
||||
---
|
||||
|
||||
## Get related tags (relationships) by tag slug
|
||||
|
||||
**URL:** llms-txt#get-related-tags-(relationships)-by-tag-slug
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/tags/get-related-tags-relationships-by-tag-slug
|
||||
|
||||
api-reference/gamma-openapi.json get /tags/slug/{slug}/related-tags
|
||||
|
||||
---
|
||||
|
||||
## Get total markets a user has traded
|
||||
|
||||
**URL:** llms-txt#get-total-markets-a-user-has-traded
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/misc/get-total-markets-a-user-has-traded
|
||||
|
||||
api-reference/data-api-openapi.yaml get /traded
|
||||
|
||||
---
|
||||
|
||||
## Get market by slug
|
||||
|
||||
**URL:** llms-txt#get-market-by-slug
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/markets/get-market-by-slug
|
||||
|
||||
api-reference/gamma-openapi.json get /markets/slug/{slug}
|
||||
|
||||
---
|
||||
|
||||
## List tags
|
||||
|
||||
**URL:** llms-txt#list-tags
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/tags/list-tags
|
||||
|
||||
api-reference/gamma-openapi.json get /tags
|
||||
|
||||
---
|
||||
|
||||
## Get market price
|
||||
|
||||
**URL:** llms-txt#get-market-price
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/pricing/get-market-price
|
||||
|
||||
api-reference/clob-subset-openapi.yaml get /price
|
||||
Retrieves the market price for a specific token and side
|
||||
|
||||
---
|
||||
|
||||
## Next page of markets with tag filtering
|
||||
|
||||
**URL:** llms-txt#next-page-of-markets-with-tag-filtering
|
||||
|
||||
**Contents:**
|
||||
- Best Practices
|
||||
- Related Endpoints
|
||||
|
||||
curl "https://gamma-api.polymarket.com/markets?tag_id=100381&closed=false&limit=25&offset=25"
|
||||
```
|
||||
|
||||
1. **For Individual Markets:** Always use the slug method for best performance
|
||||
2. **For Category Browsing:** Use tag filtering to reduce API calls
|
||||
3. **For Complete Market Discovery:** Use the events endpoint with pagination
|
||||
4. **Always Include `closed=false`:** Unless you specifically need historical data
|
||||
5. **Implement Rate Limiting:** Respect API limits for production applications
|
||||
|
||||
* [Get Markets](https://docs.polymarket.com/developers/gamma-markets-api/get-markets) - Full markets endpoint documentation
|
||||
* [Get Events](https://docs.polymarket.com/developers/gamma-markets-api/get-events) - Full events endpoint documentation
|
||||
* [Search Markets](https://docs.polymarket.com/developers/gamma-markets-api/get-public-search) - Search functionality
|
||||
|
||||
---
|
||||
|
||||
## API Key Operations
|
||||
|
||||
**URL:** llms-txt#api-key-operations
|
||||
|
||||
**Contents:**
|
||||
- Create API Key
|
||||
- Derive API Key
|
||||
- Get API Keys
|
||||
- Delete API Key
|
||||
- Access Status
|
||||
- Get Closed Only Mode Status
|
||||
|
||||
<Tip>This endpoint requires an **L1 Header**.</Tip>
|
||||
|
||||
Create new API key credentials for a user.
|
||||
|
||||
<Tip>This endpoint requires an **L1 Header**. </Tip>
|
||||
|
||||
Derive an existing API key for an address and nonce.
|
||||
|
||||
<Tip>This endpoint requires an **L2 Header**. </Tip>
|
||||
|
||||
Retrieve all API keys associated with a Polygon address.
|
||||
|
||||
<Tip>This endpoint requires an **L2 Header**.</Tip>
|
||||
|
||||
Delete an API key used to authenticate a request.
|
||||
|
||||
Check the value of `cert_required` by signer address.
|
||||
|
||||
## Get Closed Only Mode Status
|
||||
|
||||
<Tip>This endpoint requires an **L2 Header**.</Tip>
|
||||
|
||||
Retrieve the closed-only mode flag status.
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
***
|
||||
|
||||
## Derive API Key
|
||||
|
||||
<Tip>This endpoint requires an **L1 Header**. </Tip>
|
||||
|
||||
Derive an existing API key for an address and nonce.
|
||||
|
||||
**HTTP Request:**
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
***
|
||||
|
||||
## Get API Keys
|
||||
|
||||
<Tip>This endpoint requires an **L2 Header**. </Tip>
|
||||
|
||||
Retrieve all API keys associated with a Polygon address.
|
||||
|
||||
**HTTP Request:**
|
||||
```
|
||||
|
||||
Example 3 (unknown):
|
||||
```unknown
|
||||
***
|
||||
|
||||
## Delete API Key
|
||||
|
||||
<Tip>This endpoint requires an **L2 Header**.</Tip>
|
||||
|
||||
Delete an API key used to authenticate a request.
|
||||
|
||||
**HTTP Request:**
|
||||
```
|
||||
|
||||
Example 4 (unknown):
|
||||
```unknown
|
||||
***
|
||||
|
||||
## Access Status
|
||||
|
||||
Check the value of `cert_required` by signer address.
|
||||
|
||||
**HTTP Request:**
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## List comments
|
||||
|
||||
**URL:** llms-txt#list-comments
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/comments/list-comments
|
||||
|
||||
api-reference/gamma-openapi.json get /comments
|
||||
|
||||
---
|
||||
|
||||
## Get trades for a user or markets
|
||||
|
||||
**URL:** llms-txt#get-trades-for-a-user-or-markets
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/core/get-trades-for-a-user-or-markets
|
||||
|
||||
api-reference/data-api-openapi.yaml get /trades
|
||||
|
||||
---
|
||||
|
||||
## Get event tags
|
||||
|
||||
**URL:** llms-txt#get-event-tags
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/events/get-event-tags
|
||||
|
||||
api-reference/gamma-openapi.json get /events/{id}/tags
|
||||
|
||||
---
|
||||
|
||||
## Create and Place an Order
|
||||
|
||||
**URL:** llms-txt#create-and-place-an-order
|
||||
|
||||
**Contents:**
|
||||
- Request Payload Parameters
|
||||
- Order types
|
||||
- Response Format
|
||||
- Insert Error Messages
|
||||
- Insert Statuses
|
||||
|
||||
<Tip> This endpoint requires a L2 Header </Tip>
|
||||
|
||||
Create and place an order using the Polymarket CLOB API clients. All orders are represented as "limit" orders, but "market" orders are also supported. To place a market order, simply ensure your price is marketable against current resting limit orders, which are executed on input at the best price.
|
||||
|
||||
`POST /<clob-endpoint>/order`
|
||||
|
||||
### Request Payload Parameters
|
||||
|
||||
| Name | Required | Type | Description |
|
||||
| --------- | -------- | ------ | -------------------------------- |
|
||||
| order | yes | Order | signed object |
|
||||
| owner | yes | string | api key of order owner |
|
||||
| orderType | yes | string | order type ("FOK", "GTC", "GTD") |
|
||||
|
||||
An `order` object is the form:
|
||||
|
||||
| Name | Required | Type | Description |
|
||||
| ------------- | -------- | ------- | -------------------------------------------------- |
|
||||
| salt | yes | integer | random salt used to create unique order |
|
||||
| maker | yes | string | maker address (funder) |
|
||||
| signer | yes | string | signing address |
|
||||
| taker | yes | string | taker address (operator) |
|
||||
| tokenId | yes | string | ERC1155 token ID of conditional token being traded |
|
||||
| makerAmount | yes | string | maximum amount maker is willing to spend |
|
||||
| takerAmount | yes | string | minimum amount taker will pay the maker in return |
|
||||
| expiration | yes | string | unix expiration timestamp |
|
||||
| nonce | yes | string | maker's exchange nonce of the order is associated |
|
||||
| feeRateBps | yes | string | fee rate basis points as required by the operator |
|
||||
| side | yes | string | buy or sell enum index |
|
||||
| signatureType | yes | integer | signature type enum index |
|
||||
| signature | yes | string | hex encoded signature |
|
||||
|
||||
* **FOK**: A Fill-Or-Kill order is an market order to buy (in dollars) or sell (in shares) shares that must be executed immediately in its entirety; otherwise, the entire order will be cancelled.
|
||||
* **FAK**: A Fill-And-Kill order is a market order to buy (in dollars) or sell (in shares) that will be executed immediately for as many shares as are available; any portion not filled at once is cancelled.
|
||||
* **GTC**: A Good-Til-Cancelled order is a limit order that is active until it is fulfilled or cancelled.
|
||||
* **GTD**: A Good-Til-Date order is a type of order that is active until its specified date (UTC seconds timestamp), unless it has already been fulfilled or cancelled. There is a security threshold of one minute. If the order needs to expire in 90 seconds the correct expiration value is: now + 1 minute + 30 seconds
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| success | boolean | boolean indicating if server-side err (`success = false`) -> server-side error |
|
||||
| errorMsg | string | error message in case of unsuccessful placement (in case `success = false`, e.g. `client-side error`, the reason is in `errorMsg`) |
|
||||
| orderId | string | id of order |
|
||||
| orderHashes | string\[] | hash of settlement transaction order was marketable and triggered a match |
|
||||
|
||||
### Insert Error Messages
|
||||
|
||||
If the `errorMsg` field of the response object from placement is not an empty string, the order was not able to be immediately placed. This might be because of a delay or because of a failure. If the `success` is not `true`, then there was an issue placing the order. The following `errorMessages` are possible:
|
||||
|
||||
| Error | Success | Message | Description |
|
||||
| ------------------------------------ | ------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
||||
| INVALID\_ORDER\_MIN\_TICK\_SIZE | yes | order is invalid. Price breaks minimum tick size rules | order price isn't accurate to correct tick sizing |
|
||||
| INVALID\_ORDER\_MIN\_SIZE | yes | order is invalid. Size lower than the minimum | order size must meet min size threshold requirement |
|
||||
| INVALID\_ORDER\_DUPLICATED | yes | order is invalid. Duplicated. Same order has already been placed, can't be placed again | |
|
||||
| INVALID\_ORDER\_NOT\_ENOUGH\_BALANCE | yes | not enough balance / allowance | funder address doesn't have sufficient balance or allowance for order |
|
||||
| INVALID\_ORDER\_EXPIRATION | yes | invalid expiration | expiration field expresses a time before now |
|
||||
| INVALID\_ORDER\_ERROR | yes | could not insert order | system error while inserting order |
|
||||
| EXECUTION\_ERROR | yes | could not run the execution | system error while attempting to execute trade |
|
||||
| ORDER\_DELAYED | no | order match delayed due to market conditions | order placement delayed |
|
||||
| DELAYING\_ORDER\_ERROR | yes | error delaying the order | system error while delaying order |
|
||||
| FOK\_ORDER\_NOT\_FILLED\_ERROR | yes | order couldn't be fully filled, FOK orders are fully filled/killed | FOK order not fully filled so can't be placed |
|
||||
| MARKET\_NOT\_READY | no | the market is not yet ready to process new orders | system not accepting orders for market yet |
|
||||
|
||||
When placing an order, a status field is included. The status field provides additional information regarding the order's state as a result of the placement. Possible values include:
|
||||
|
||||
| Status | Description |
|
||||
| --------- | ------------------------------------------------------------ |
|
||||
| matched | order placed and matched with an existing resting order |
|
||||
| live | order placed and resting on the book |
|
||||
| delayed | order marketable, but subject to matching delay |
|
||||
| unmatched | order marketable, but failure delaying, placement successful |
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Get series by id
|
||||
|
||||
**URL:** llms-txt#get-series-by-id
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/series/get-series-by-id
|
||||
|
||||
api-reference/gamma-openapi.json get /series/{id}
|
||||
|
||||
---
|
||||
|
||||
## List markets
|
||||
|
||||
**URL:** llms-txt#list-markets
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/markets/list-markets
|
||||
|
||||
api-reference/gamma-openapi.json get /markets
|
||||
|
||||
---
|
||||
|
||||
## Get bid-ask spreads
|
||||
|
||||
**URL:** llms-txt#get-bid-ask-spreads
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/spreads/get-bid-ask-spreads
|
||||
|
||||
api-reference/clob-subset-openapi.yaml post /spreads
|
||||
Retrieves bid-ask spreads for multiple tokens
|
||||
|
||||
---
|
||||
|
||||
## List series
|
||||
|
||||
**URL:** llms-txt#list-series
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/series/list-series
|
||||
|
||||
api-reference/gamma-openapi.json get /series
|
||||
|
||||
---
|
||||
|
||||
## Search markets, events, and profiles
|
||||
|
||||
**URL:** llms-txt#search-markets,-events,-and-profiles
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/search/search-markets-events-and-profiles
|
||||
|
||||
api-reference/gamma-openapi.json get /public-search
|
||||
|
||||
---
|
||||
|
||||
## Get multiple order books summaries by request
|
||||
|
||||
**URL:** llms-txt#get-multiple-order-books-summaries-by-request
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/orderbook/get-multiple-order-books-summaries-by-request
|
||||
|
||||
api-reference/clob-subset-openapi.yaml post /books
|
||||
Retrieves order book summaries for specified tokens via POST request
|
||||
|
||||
---
|
||||
|
||||
## Get multiple market prices
|
||||
|
||||
**URL:** llms-txt#get-multiple-market-prices
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/pricing/get-multiple-market-prices
|
||||
|
||||
api-reference/clob-subset-openapi.yaml get /prices
|
||||
Retrieves market prices for multiple tokens and sides
|
||||
|
||||
---
|
||||
|
||||
## Get midpoint price
|
||||
|
||||
**URL:** llms-txt#get-midpoint-price
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/pricing/get-midpoint-price
|
||||
|
||||
api-reference/clob-subset-openapi.yaml get /midpoint
|
||||
Retrieves the midpoint price for a specific token
|
||||
|
||||
---
|
||||
|
||||
## List teams
|
||||
|
||||
**URL:** llms-txt#list-teams
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/sports/list-teams
|
||||
|
||||
api-reference/gamma-openapi.json get /teams
|
||||
|
||||
---
|
||||
|
||||
## Get current positions for a user
|
||||
|
||||
**URL:** llms-txt#get-current-positions-for-a-user
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/core/get-current-positions-for-a-user
|
||||
|
||||
api-reference/data-api-openapi.yaml get /positions
|
||||
Returns positions filtered by user and optional filters.
|
||||
|
||||
---
|
||||
|
||||
## Health check
|
||||
|
||||
**URL:** llms-txt#health-check
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/health/health-check
|
||||
|
||||
api-reference/data-api-openapi.yaml get /
|
||||
|
||||
---
|
||||
|
||||
## Get tags related to a tag id
|
||||
|
||||
**URL:** llms-txt#get-tags-related-to-a-tag-id
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/tags/get-tags-related-to-a-tag-id
|
||||
|
||||
api-reference/gamma-openapi.json get /tags/{id}/related-tags/tags
|
||||
|
||||
---
|
||||
|
||||
## Get multiple market prices by request
|
||||
|
||||
**URL:** llms-txt#get-multiple-market-prices-by-request
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/pricing/get-multiple-market-prices-by-request
|
||||
|
||||
api-reference/clob-subset-openapi.yaml post /prices
|
||||
Retrieves market prices for specified tokens and sides via POST request
|
||||
|
||||
---
|
||||
|
||||
## Get market tags by id
|
||||
|
||||
**URL:** llms-txt#get-market-tags-by-id
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/markets/get-market-tags-by-id
|
||||
|
||||
api-reference/gamma-openapi.json get /markets/{id}/tags
|
||||
|
||||
---
|
||||
|
||||
## Get closed positions for a user
|
||||
|
||||
**URL:** llms-txt#get-closed-positions-for-a-user
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/core/get-closed-positions-for-a-user
|
||||
|
||||
api-reference/data-api-openapi.yaml get /closed-positions
|
||||
Fetches closed positions for a user(address)
|
||||
|
||||
---
|
||||
|
||||
## Get event by slug
|
||||
|
||||
**URL:** llms-txt#get-event-by-slug
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/events/get-event-by-slug
|
||||
|
||||
api-reference/gamma-openapi.json get /events/slug/{slug}
|
||||
|
||||
---
|
||||
|
||||
## Get live volume for an event
|
||||
|
||||
**URL:** llms-txt#get-live-volume-for-an-event
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/misc/get-live-volume-for-an-event
|
||||
|
||||
api-reference/data-api-openapi.yaml get /live-volume
|
||||
|
||||
---
|
||||
|
||||
## Get tag by slug
|
||||
|
||||
**URL:** llms-txt#get-tag-by-slug
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/tags/get-tag-by-slug
|
||||
|
||||
api-reference/gamma-openapi.json get /tags/slug/{slug}
|
||||
|
||||
---
|
||||
|
||||
## Get comments by user address
|
||||
|
||||
**URL:** llms-txt#get-comments-by-user-address
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/comments/get-comments-by-user-address
|
||||
|
||||
api-reference/gamma-openapi.json get /comments/user_address/{user_address}
|
||||
|
||||
---
|
||||
|
||||
## Get order book summary
|
||||
|
||||
**URL:** llms-txt#get-order-book-summary
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/orderbook/get-order-book-summary
|
||||
|
||||
api-reference/clob-subset-openapi.yaml get /book
|
||||
Retrieves the order book summary for a specific token
|
||||
|
||||
---
|
||||
|
||||
## Endpoint
|
||||
|
||||
**URL:** llms-txt#endpoint
|
||||
|
||||
[https://gamma-api.polymarket.com](https://gamma-api.polymarket.com)
|
||||
|
||||
---
|
||||
|
||||
## Get top holders for markets
|
||||
|
||||
**URL:** llms-txt#get-top-holders-for-markets
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/core/get-top-holders-for-markets
|
||||
|
||||
api-reference/data-api-openapi.yaml get /holders
|
||||
|
||||
---
|
||||
|
||||
## Get event by id
|
||||
|
||||
**URL:** llms-txt#get-event-by-id
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/events/get-event-by-id
|
||||
|
||||
api-reference/gamma-openapi.json get /events/{id}
|
||||
|
||||
---
|
||||
|
||||
## Get price history for a traded token
|
||||
|
||||
**URL:** llms-txt#get-price-history-for-a-traded-token
|
||||
|
||||
Source: https://docs.polymarket.com/api-reference/pricing/get-price-history-for-a-traded-token
|
||||
|
||||
api-reference/clob-subset-openapi.yaml get /prices-history
|
||||
Fetches historical price data for a specified market token
|
||||
|
||||
---
|
||||
@@ -1,370 +0,0 @@
|
||||
# Polymarket - Getting Started
|
||||
|
||||
**Pages:** 8
|
||||
|
||||
---
|
||||
|
||||
## CLOB Introduction
|
||||
|
||||
**URL:** llms-txt#clob-introduction
|
||||
|
||||
**Contents:**
|
||||
- System
|
||||
- API
|
||||
- Security
|
||||
- Fees
|
||||
- Schedule
|
||||
- Overview
|
||||
- Additional Resources
|
||||
|
||||
Source: https://docs.polymarket.com/developers/CLOB/introduction
|
||||
|
||||
Welcome to the Polymarket Order Book API! This documentation provides overviews, explanations, examples, and annotations to simplify interaction with the order book. The following sections detail the Polymarket Order Book and the API usage.
|
||||
|
||||
Polymarket's Order Book, or CLOB (Central Limit Order Book), is hybrid-decentralized. It includes an operator for off-chain matching/ordering, with settlement executed on-chain, non-custodially, via signed order messages.
|
||||
|
||||
The exchange uses a custom Exchange contract facilitating atomic swaps between binary Outcome Tokens (CTF ERC1155 assets and ERC20 PToken assets) and collateral assets (ERC20), following signed limit orders. Designed for binary markets, the contract enables complementary tokens to match across a unified order book.
|
||||
|
||||
Orders are EIP712-signed structured data. Matched orders have one maker and one or more takers, with price improvements benefiting the taker. The operator handles off-chain order management and submits matched trades to the blockchain for on-chain execution.
|
||||
|
||||
The Polymarket Order Book API enables market makers and traders to programmatically manage market orders. Orders of any amount can be created, listed, fetched, or read from the market order books. Data includes all available markets, market prices, and order history via REST and WebSocket endpoints.
|
||||
|
||||
Polymarket's Exchange contract has been audited by Chainsecurity ([View Audit](https://github.com/Polymarket/ctf-exchange/blob/main/audit/ChainSecurity_Polymarket_Exchange_audit.pdf)).
|
||||
|
||||
The operator's privileges are limited to order matching, non-censorship, and ensuring correct ordering. Operators can't set prices or execute unauthorized trades. Users can cancel orders on-chain independently if trust issues arise.
|
||||
|
||||
| Volume Level | Maker Fee Base Rate (bps) | Taker Fee Base Rate (bps) |
|
||||
| ------------ | ------------------------- | ------------------------- |
|
||||
| >0 USDC | 0 | 0 |
|
||||
|
||||
Fees apply symmetrically in output assets (proceeds). This symmetry ensures fairness and market integrity. Fees are calculated differently depending on whether you are buying or selling:
|
||||
|
||||
* **Selling outcome tokens (base) for collateral (quote):**
|
||||
|
||||
$$
|
||||
feeQuote = baseRate \times \min(price, 1 - price) \times size
|
||||
$$
|
||||
|
||||
* **Buying outcome tokens (base) with collateral (quote):**
|
||||
|
||||
$$
|
||||
feeBase = baseRate \times \min(price, 1 - price) \times \frac{size}{price}
|
||||
$$
|
||||
|
||||
## Additional Resources
|
||||
|
||||
* [Exchange contract source code](https://github.com/Polymarket/ctf-exchange/tree/main/src)
|
||||
* [Exchange contract documentation](https://github.com/Polymarket/ctf-exchange/blob/main/docs/Overview.md)
|
||||
|
||||
---
|
||||
|
||||
## API Rate Limits
|
||||
|
||||
**URL:** llms-txt#api-rate-limits
|
||||
|
||||
**Contents:**
|
||||
- How Rate Limiting Works
|
||||
- General Rate Limits
|
||||
- Data API Rate Limits
|
||||
- GAMMA API Rate Limits
|
||||
- CLOB API Rate Limits
|
||||
- General CLOB Endpoints
|
||||
- CLOB Market Data
|
||||
- CLOB Ledger Endpoints
|
||||
- CLOB Markets & Pricing
|
||||
- CLOB Authentication
|
||||
|
||||
Source: https://docs.polymarket.com/quickstart/introduction/rate-limits
|
||||
|
||||
## How Rate Limiting Works
|
||||
|
||||
All rate limits are enforced using Cloudflare's throttling system. When you exceed the maximum configured rate for any endpoint, requests are throttled rather than immediately rejected. This means:
|
||||
|
||||
* **Throttling**: Requests over the limit are delayed/queued rather than dropped
|
||||
* **Burst Allowances**: Some endpoints allow short bursts above the sustained rate
|
||||
* **Time Windows**: Limits reset based on sliding time windows (e.g., per 10 seconds, per minute)
|
||||
|
||||
## General Rate Limits
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| --------------------- | ------------------- | -------------------------------------------------- |
|
||||
| General Rate Limiting | 5000 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| "OK" Endpoint | 50 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
## Data API Rate Limits
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| ---------------------- | ------------------------ | -------------------------------------------------- |
|
||||
| Data API (General) | 200 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| Data API (Alternative) | 1200 requests / 1 minute | 10 minutes block on violation |
|
||||
| Data API `/trades` | 75 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| Data API "OK" Endpoint | 10 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
## GAMMA API Rate Limits
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| -------------------------------- | ------------------ | -------------------------------------------------- |
|
||||
| GAMMA (General) | 750 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| GAMMA Get Comments | 100 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| GAMMA `/events` | 100 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| GAMMA `/markets` | 125 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| GAMMA `/markets` /events listing | 100 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| GAMMA Tags | 100 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| GAMMA Search | 300 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
## CLOB API Rate Limits
|
||||
|
||||
### General CLOB Endpoints
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| ----------------------------- | ------------------- | -------------------------------------------------- |
|
||||
| CLOB (General) | 5000 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB GET Balance Allowance | 125 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB UPDATE Balance Allowance | 20 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| ----------------- | ------------------ | -------------------------------------------------- |
|
||||
| CLOB `/book` | 200 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB `/books` | 80 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB `/price` | 200 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB `/prices` | 80 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB `/midprice` | 200 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB `/midprices` | 80 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
### CLOB Ledger Endpoints
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| ----------------------------------------------------------- | ------------------ | -------------------------------------------------- |
|
||||
| CLOB Ledger (`/trades` `/orders` `/notifications` `/order`) | 300 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB Ledger `/data/orders` | 150 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB Ledger `/data/trades` | 150 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB `/notifications` | 125 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
### CLOB Markets & Pricing
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| ----------------------- | ------------------ | -------------------------------------------------- |
|
||||
| CLOB Price History | 100 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB Markets | 250 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB Market Tick Size | 50 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB `markets/0x` | 50 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
| CLOB `/markets` listing | 100 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
### CLOB Authentication
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| ------------- | ----------------- | -------------------------------------------------- |
|
||||
| CLOB API Keys | 50 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
### CLOB Trading Endpoints
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| ----------------------------------- | ---------------------------------- | ---------------------------------------------------------- |
|
||||
| CLOB POST `/order` | 2400 requests / 10s (240/s) | BURST - Throttle requests over the maximum configured rate |
|
||||
| CLOB POST `/order` | 24000 requests / 10 minutes (40/s) | Throttle requests over the maximum configured rate |
|
||||
| CLOB DELETE `/order` | 2400 requests / 10s (240/s) | BURST - Throttle requests over the maximum configured rate |
|
||||
| CLOB DELETE `/order` | 24000 requests / 10 minutes (40/s) | Throttle requests over the maximum configured rate |
|
||||
| CLOB POST `/orders` | 800 requests / 10s (80/s) | BURST - Throttle requests over the maximum configured rate |
|
||||
| CLOB POST `/orders` | 12000 requests / 10 minutes (20/s) | Throttle requests over the maximum configured rate |
|
||||
| CLOB DELETE `/orders` | 800 requests / 10s (80/s) | BURST - Throttle requests over the maximum configured rate |
|
||||
| CLOB DELETE `/orders` | 12000 requests / 10 minutes (20/s) | Throttle requests over the maximum configured rate |
|
||||
| CLOB DELETE `/cancel-all` | 200 requests / 10s (20/s) | BURST - Throttle requests over the maximum configured rate |
|
||||
| CLOB DELETE `/cancel-all` | 3000 requests / 10 minutes (5/s) | Throttle requests over the maximum configured rate |
|
||||
| CLOB DELETE `/cancel-market-orders` | 800 requests / 10s (80/s) | BURST - Throttle requests over the maximum configured rate |
|
||||
| CLOB DELETE `/cancel-market-orders` | 12000 requests / 10 minutes (20/s) | Throttle requests over the maximum configured rate |
|
||||
|
||||
## Other API Rate Limits
|
||||
|
||||
| Endpoint | Limit | Notes |
|
||||
| ----------------- | ---------------------- | -------------------------------------------------- |
|
||||
| RELAYER `/submit` | 15 requests / 1 minute | Throttle requests over the maximum configured rate |
|
||||
| User PNL API | 100 requests / 10s | Throttle requests over the maximum configured rate |
|
||||
|
||||
---
|
||||
|
||||
## Glossary
|
||||
|
||||
**URL:** llms-txt#glossary
|
||||
|
||||
Source: https://docs.polymarket.com/quickstart/introduction/definitions
|
||||
|
||||
| Term | Definition |
|
||||
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **Token** | A token represents a stake in a specific Yes/No outcome in a Market. The price of a token can fluctuate between $0 - $1 based on the market belief in the outcome. When a market resolves, the token associated with the correct prediction can be redeemed for \$1 USDC. This is also sometimes called an *Asset Id* |
|
||||
| **Market** | A single event outcome. Corresponds to a pair of CLOB token IDs(Yes/No), a market address, a question ID and a condition ID. |
|
||||
| **Event** | A collection of related markets grouped under a common topic or theme. |
|
||||
| **SLUG** | A human readable identification for a market or event. Can be found in the URL of any Polymarket Market or Event. You can use this slug to find more detailed information about a market or event by using it as a parameter in the [Get Events](https://docs.polymarket.com/developers/gamma-markets-api/get-events) or [Get Markets](https://docs.polymarket.com/developers/gamma-markets-api/get-markets) endpoints. |
|
||||
| **Negative Risk (negrisk)** | A group of Markets(Event) in which only one Market can resolve as yes. For more detail see [Negrisk Details](https://docs.polymarket.com/developers/neg-risk/overview) |
|
||||
| **Central Limit Order Book** | The off-chain order matching system. This is where you place resting orders and market orders are matched with existing orders before being sent on-chain. |
|
||||
| **Polygon Network** | A scalable, multi-chain blockchain platform used by Polymarket to facilitate on-chain activities(contract creation, token transfers, etc) |
|
||||
|
||||
---
|
||||
|
||||
## WSS Quickstart
|
||||
|
||||
**URL:** llms-txt#wss-quickstart
|
||||
|
||||
**Contents:**
|
||||
- Getting your API Keys
|
||||
- Using those keys to connect to the Market or User Websocket
|
||||
|
||||
Source: https://docs.polymarket.com/quickstart/websocket/WSS-Quickstart
|
||||
|
||||
The following code samples and explanation will show you how to subsribe to the Marker and User channels of the Websocket.
|
||||
You'll need your API keys to do this so we'll start with that.
|
||||
|
||||
## Getting your API Keys
|
||||
|
||||
## Using those keys to connect to the Market or User Websocket
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
</CodeGroup>
|
||||
|
||||
## Using those keys to connect to the Market or User Websocket
|
||||
|
||||
<CodeGroup>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Does Polymarket have an API?
|
||||
|
||||
**URL:** llms-txt#does-polymarket-have-an-api?
|
||||
|
||||
Source: https://docs.polymarket.com/polymarket-learn/FAQ/does-polymarket-have-an-api
|
||||
|
||||
Getting data from Polymarket
|
||||
|
||||
Yes! Developers can find all the information they need for interacting with Polymarket. This includes [documentation on market discovery, resolution, trading etc.](https://docs.polymarket.com/quickstart/introduction/main)
|
||||
|
||||
Whether you are an academic researcher a market maker or an indepedent developer, this documentation should provide you what you need to get started. All the code you find linked here and on our [GitHub](https://github.com/polymarket) is open source and free to use.
|
||||
|
||||
<Tip>
|
||||
If you have any questions please join our [Discord](https://discord.com/invite/polymarket) and direct your questions to the #devs channel.
|
||||
</Tip>
|
||||
|
||||
---
|
||||
|
||||
## Developer Quickstart
|
||||
|
||||
**URL:** llms-txt#developer-quickstart
|
||||
|
||||
Source: https://docs.polymarket.com/quickstart/introduction/main
|
||||
|
||||
This section of the documentation will provide all the essential resources to help you perform basic trading actions on the Polymarket platform. If you're just getting started, you're in the right place.
|
||||
|
||||
Everything you need to start building with the Polymarket API is right here. Let’s get started.
|
||||
|
||||
[Not sure what to build next? Get inspired by checking out real examples from other developers using the API.](https://docs.polymarket.com/quickstart/introduction/showcase)
|
||||
|
||||
---
|
||||
|
||||
## What is a Prediction Market?
|
||||
|
||||
**URL:** llms-txt#what-is-a-prediction-market?
|
||||
|
||||
**Contents:**
|
||||
- How it works
|
||||
- Making predictions
|
||||
- Free-market trading
|
||||
- Trust the markets
|
||||
|
||||
Source: https://docs.polymarket.com/polymarket-learn/FAQ/what-are-prediction-markets
|
||||
|
||||
How people collectively forecast the future.
|
||||
|
||||
A prediction market is a platform where people can bet on the outcome of future events. By buying and selling shares in the outcomes, participants collectively forecast the likelihood of events such as sports results, political elections, or entertainment awards.
|
||||
|
||||
Market Prices = Probabilities: The price of shares in a prediction market represents the current probability of an event happening. For example, if shares of an event are trading at 20 cents, it indicates a 20% chance of that event occurring.
|
||||
|
||||
### Making predictions
|
||||
|
||||
If you believe the actual probability of an event is higher than the market price suggests, you can buy shares. For instance, if you think a team has a better than 20% chance of winning, you would buy shares at 20 cents. If the event occurs, each share becomes worth \$1, yielding a profit.
|
||||
|
||||
### Free-market trading
|
||||
|
||||
You can buy or sell shares at any time before the event concludes, based on new information or changing circumstances. This flexibility allows the market prices to continuously reflect the most current and accurate probabilities.
|
||||
|
||||
### Trust the markets
|
||||
|
||||
Prediction markets provide unbiased and accurate probabilities in real time, cutting through the noise of human and media biases. Traditional sources often have their own incentives and slants, but prediction markets operate on the principle of "put your money where your mouth is." Here, participants are financially motivated to provide truthful insights, as their profits depend on the accuracy of their predictions.
|
||||
|
||||
In a prediction market, prices reflect the aggregated sentiment of all participants, weighing news, data, expert opinions, and culture to determine the true odds. Unlike media narratives, which can be swayed by various biases, prediction markets offer a transparent view of where people genuinely believe we're heading.
|
||||
|
||||
#### Why use prediction markets?
|
||||
|
||||
Prediction markets are often more accurate than traditional polls and expert predictions. The collective wisdom of diverse participants, each motivated by the potential for profit, leads to highly reliable forecasts. This makes prediction markets an excellent tool for gauging real-time probabilities of future events.
|
||||
|
||||
Polymarket, the world's largest prediction market, offers a user-friendly platform to bet on a wide range of topics, from sports to politics. By participating, you can profit from your knowledge while contributing to the accuracy of market predictions.
|
||||
|
||||
---
|
||||
|
||||
## What is Polymarket?
|
||||
|
||||
**URL:** llms-txt#what-is-polymarket?
|
||||
|
||||
**Contents:**
|
||||
- Quick Overview
|
||||
- Understanding Prices
|
||||
- Making money on markets
|
||||
- How accurate are Polymarket odds?
|
||||
|
||||
Source: https://docs.polymarket.com/polymarket-learn/get-started/what-is-polymarket
|
||||
|
||||
Polymarket is the world’s largest prediction market, allowing you to stay informed and profit from your knowledge by betting on future events across various topics.
|
||||
|
||||
Studies show prediction markets are often more accurate than pundits because they combine news, polls, and expert opinions into a single value that represents the market's view of an event's odds. Our markets reflect *accurate, unbiased, and real-time probabilities* for the events that matter most to you. Markets seek truth.
|
||||
|
||||
* On Polymarket, you can [buy and sell shares](https://docs.polymarket.com/polymarket-learn/get-started/making-your-first-trade) representing future event outcomes (i.e. "Will TikTok be banned in the U.S. this year?")
|
||||
|
||||
* Shares in event outcomes are [always priced](https://docs.polymarket.com/polymarket-learn/get-started/what-is-polymarket/#understanding-prices) between 0.00 and 1.00 [USDC](https://docs.polymarket.com/polymarket-learn/FAQ/why-do-i-need-crypto/#why-usdc), and every pair of event outcomes (i.e. each pair of "YES" + "NO" shares) is fully collateralized by \$1.00 USDC.
|
||||
|
||||
* Shares are created when [opposing sides come to an agreement on odds](https://docs.polymarket.com/polymarket-learn/trading/limit-orders), such that the sum of what each side is willing to pay is equal to \$1.00.
|
||||
|
||||
* The shares representing the *correct, final outcome* are paid out \$1.00 USDC each upon [market resolution](https://docs.polymarket.com/polymarket-learn/markets/how-are-markets-resolved).
|
||||
|
||||
* Unlike sportsbooks, you are not betting against "the house" – the counterparty to each trade is another Polymarket user. As such:
|
||||
|
||||
* Shares can be sold before the event outcome is known\_ (i.e. to lock in profits or cut losses)
|
||||
|
||||
* *There is no "house" to ban you for winning too much.*
|
||||
|
||||
### Understanding Prices
|
||||
|
||||
Prices = Probabilities.
|
||||
|
||||
<VideoPlayer src="https://www.youtube.com/embed/v0CvPEYBzTI?si=9cirMPQ72orQzLyS" />
|
||||
|
||||
*Prices (odds) on Polymarket represent the current probability of an event occurring.* For example, in a market predicting whether the Miami Heat will win the 2025 NBA Finals, if YES shares are trading at 18 cents, it indicates a 18% chance of Miami winning.
|
||||
|
||||
These odds are determined by what price other Polymarket users are currently willing to buy & sell those shares at. Just how stock exchanges don't "set" the prices of stocks, Polymarket does not set prices / odds - they're a function of supply & demand.
|
||||
|
||||
[Learn more >](https://docs.polymarket.com/docs/guides/trading/how-are-prices-calculated)
|
||||
|
||||
### Making money on markets
|
||||
|
||||
In the example above, if you believe Miami's chances of winning are higher than 18%, you would buy “Yes” shares at 18 cents each. If Miami wins, each “Yes” share would be worth \$1, resulting in an 82-cent profit per share. Conversely, any trader who owned “No” shares would see their investment become worthless once the game is over.
|
||||
|
||||
Since it's a market, you're not locked into your trade. You can sell your shares at any time at the current market price. As the news changes, the supply and demand for shares fluctuates, causing the share price to reflect the new odds for the event.
|
||||
|
||||
### How accurate are Polymarket odds?
|
||||
|
||||
Research shows prediction markets are often more accurate than experts, polls, and pundits. Traders aggregate news, polls, and expert opinions, making informed trades. Their economic incentives ensure market prices adjust to reflect true odds as more knowledgeable participants join.
|
||||
|
||||
This makes prediction markets the best source of real-time event probabilities. People use Polymarket for the most accurate odds, gaining the ability to make informed decisions about the future.
|
||||
|
||||
If you're an expert on a certain topic, Polymarket is your opportunity to profit from trading based on your knowledge, while improving the market's accuracy.
|
||||
|
||||
---
|
||||
@@ -1,235 +0,0 @@
|
||||
# Polymarket - Guides
|
||||
|
||||
**Pages:** 3
|
||||
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
**URL:** llms-txt#example
|
||||
|
||||
* **\[Event]** Where will Barron Trump attend College?
|
||||
* **\[Market]** Will Barron attend Georgetown?
|
||||
* **\[Market]** Will Barron attend NYU?
|
||||
* **\[Market]** Will Barron attend UPenn?
|
||||
* **\[Market]** Will Barron attend Harvard?
|
||||
* **\[Market]** Will Barron attend another college?
|
||||
|
||||
---
|
||||
|
||||
## How to Fetch Markets
|
||||
|
||||
**URL:** llms-txt#how-to-fetch-markets
|
||||
|
||||
**Contents:**
|
||||
- Overview
|
||||
- 1. Fetch by Slug
|
||||
- How to Extract the Slug
|
||||
- API Endpoints
|
||||
- Examples
|
||||
- 2. Fetch by Tags
|
||||
- Discover Available Tags
|
||||
- Using Tags in Market Requests
|
||||
- Additional Tag Filtering
|
||||
- 3. Fetch All Active Markets
|
||||
|
||||
Source: https://docs.polymarket.com/developers/gamma-markets-api/fetch-markets-guide
|
||||
|
||||
<Tip>Both the getEvents and getMarkets are paginated. See [pagination section](#pagination) for details.</Tip>
|
||||
This guide covers the three recommended approaches for fetching market data from the Gamma API, each optimized for different use cases.
|
||||
|
||||
There are three main strategies for retrieving market data:
|
||||
|
||||
1. **By Slug** - Best for fetching specific individual markets or events
|
||||
2. **By Tags** - Ideal for filtering markets by category or sport
|
||||
3. **Via Events Endpoint** - Most efficient for retrieving all active markets
|
||||
|
||||
**Use Case:** When you need to retrieve a specific market or event that you already know about.
|
||||
|
||||
Individual markets and events are best fetched using their unique slug identifier. The slug can be found directly in the Polymarket frontend URL.
|
||||
|
||||
### How to Extract the Slug
|
||||
|
||||
From any Polymarket URL, the slug is the path segment after `/event/` or `/market/`:
|
||||
|
||||
**For Events:** [GET /events/slug/{slug}](https://docs.polymarket.com/api-reference/events/list-events)
|
||||
|
||||
**For Markets:** [GET /markets/slug/{slug}](https://docs.polymarket.com/api-reference/markets/list-markets)
|
||||
|
||||
**Use Case:** When you want to filter markets by category, sport, or topic.
|
||||
|
||||
Tags provide a powerful way to categorize and filter markets. You can discover available tags and then use them to filter your market requests.
|
||||
|
||||
### Discover Available Tags
|
||||
|
||||
**General Tags:** [GET /tags](https://docs.polymarket.com/api-reference/tags/list-tags)
|
||||
|
||||
**Sports Tags & Metadata:** [GET /sports](https://docs.polymarket.com/api-reference/sports/get-sports-metadata-information)
|
||||
|
||||
The `/sports` endpoint returns comprehensive metadata for sports including tag IDs, images, resolution sources, and series information.
|
||||
|
||||
### Using Tags in Market Requests
|
||||
|
||||
Once you have tag IDs, you can use them with the `tag_id` parameter in both markets and events endpoints.
|
||||
|
||||
**Markets with Tags:** [GET /markets](https://docs.polymarket.com/api-reference/markets/list-markets)
|
||||
|
||||
**Events with Tags:** [GET /events](https://docs.polymarket.com/api-reference/events/list-events)
|
||||
|
||||
### Additional Tag Filtering
|
||||
|
||||
* Use `related_tags=true` to include related tag markets
|
||||
* Exclude specific tags with `exclude_tag_id`
|
||||
|
||||
## 3. Fetch All Active Markets
|
||||
|
||||
**Use Case:** When you need to retrieve all available active markets, typically for broader analysis or market discovery.
|
||||
|
||||
The most efficient approach is to use the `/events` endpoint and work backwards, as events contain their associated markets.
|
||||
|
||||
**Events Endpoint:** [GET /events](https://docs.polymarket.com/api-reference/events/list-events)
|
||||
|
||||
**Markets Endpoint:** [GET /markets](https://docs.polymarket.com/api-reference/markets/list-markets)
|
||||
|
||||
* `order=id` - Order by event ID
|
||||
* `ascending=false` - Get newest events first
|
||||
* `closed=false` - Only active markets
|
||||
* `limit` - Control response size
|
||||
* `offset` - For pagination
|
||||
|
||||
This approach gives you all active markets ordered from newest to oldest, allowing you to systematically process all available trading opportunities.
|
||||
|
||||
For large datasets, use pagination with `limit` and `offset` parameters:
|
||||
|
||||
* `limit=50` - Return 50 results per page
|
||||
* `offset=0` - Start from the beginning (increment by limit for subsequent pages)
|
||||
|
||||
**Pagination Examples:**
|
||||
|
||||
```bash theme={null}
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
https://polymarket.com/event/fed-decision-in-october?tid=1758818660485
|
||||
↑
|
||||
Slug: fed-decision-in-october
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
***
|
||||
|
||||
## 2. Fetch by Tags
|
||||
|
||||
**Use Case:** When you want to filter markets by category, sport, or topic.
|
||||
|
||||
Tags provide a powerful way to categorize and filter markets. You can discover available tags and then use them to filter your market requests.
|
||||
|
||||
### Discover Available Tags
|
||||
|
||||
**General Tags:** [GET /tags](https://docs.polymarket.com/api-reference/tags/list-tags)
|
||||
|
||||
**Sports Tags & Metadata:** [GET /sports](https://docs.polymarket.com/api-reference/sports/get-sports-metadata-information)
|
||||
|
||||
The `/sports` endpoint returns comprehensive metadata for sports including tag IDs, images, resolution sources, and series information.
|
||||
|
||||
### Using Tags in Market Requests
|
||||
|
||||
Once you have tag IDs, you can use them with the `tag_id` parameter in both markets and events endpoints.
|
||||
|
||||
**Markets with Tags:** [GET /markets](https://docs.polymarket.com/api-reference/markets/list-markets)
|
||||
|
||||
**Events with Tags:** [GET /events](https://docs.polymarket.com/api-reference/events/list-events)
|
||||
```
|
||||
|
||||
Example 3 (unknown):
|
||||
```unknown
|
||||
### Additional Tag Filtering
|
||||
|
||||
You can also:
|
||||
|
||||
* Use `related_tags=true` to include related tag markets
|
||||
* Exclude specific tags with `exclude_tag_id`
|
||||
|
||||
***
|
||||
|
||||
## 3. Fetch All Active Markets
|
||||
|
||||
**Use Case:** When you need to retrieve all available active markets, typically for broader analysis or market discovery.
|
||||
|
||||
The most efficient approach is to use the `/events` endpoint and work backwards, as events contain their associated markets.
|
||||
|
||||
**Events Endpoint:** [GET /events](https://docs.polymarket.com/api-reference/events/list-events)
|
||||
|
||||
**Markets Endpoint:** [GET /markets](https://docs.polymarket.com/api-reference/markets/list-markets)
|
||||
|
||||
### Key Parameters
|
||||
|
||||
* `order=id` - Order by event ID
|
||||
* `ascending=false` - Get newest events first
|
||||
* `closed=false` - Only active markets
|
||||
* `limit` - Control response size
|
||||
* `offset` - For pagination
|
||||
|
||||
### Examples
|
||||
```
|
||||
|
||||
Example 4 (unknown):
|
||||
```unknown
|
||||
This approach gives you all active markets ordered from newest to oldest, allowing you to systematically process all available trading opportunities.
|
||||
|
||||
### Pagination
|
||||
|
||||
For large datasets, use pagination with `limit` and `offset` parameters:
|
||||
|
||||
* `limit=50` - Return 50 results per page
|
||||
* `offset=0` - Start from the beginning (increment by limit for subsequent pages)
|
||||
|
||||
**Pagination Examples:**
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Market Orders
|
||||
|
||||
**URL:** llms-txt#market-orders
|
||||
|
||||
**Contents:**
|
||||
- Video Walkthrough
|
||||
- Placing a Market Order
|
||||
|
||||
Once you've [signed up](https://docs.polymarket.com/polymarket-learn/get-started/how-to-signup) and [deposited funds](https://docs.polymarket.com/polymarket-learn/get-started/how-to-deposit), you're ready to start trading on Polymarket. Here's a step-by-step guide to get you started.
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/1lFgkHLqo28?si=i7e61-roRsOVeRMW" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
|
||||
|
||||
## Placing a Market Order
|
||||
|
||||
\_Before trading, you'll want to visit the [markets page](https://polymarket.com/markets) to find a market that interests you.
|
||||
|
||||
<Steps>
|
||||
<Steps.Step>
|
||||
### [Choose a market](https://polymarket.com/markets)
|
||||
|
||||
Locate the 'buy' modal, on the right side of the screen. Click the outcome you want to buy (usually Yes or No), then enter the dollar amount you wish to invest.
|
||||
</Steps.Step>
|
||||
|
||||
<Steps.Step>
|
||||
### Buy shares
|
||||
|
||||
Click **Buy** and confirm the transaction in your wallet. Once your trade goes through, you'll receive a notification confirming its success.
|
||||
|
||||
<Tip>Congrats, you're officially a Polymarket trader!</Tip>
|
||||
</Steps.Step>
|
||||
|
||||
<Steps.Step>
|
||||
### Share your bet slip
|
||||
|
||||
You'll also see a bet slip to share on social media. We love sending \$\$\$ to traders who post their trades on Twitter and tag us!
|
||||
</Steps.Step>
|
||||
</Steps>
|
||||
|
||||
Simple, right? If you think you've got the hang of it, it's time to learn about more advanced trading and order types. [Limit Orders](https://docs.polymarket.com/polymarket-learn/trading/limit-orders/).
|
||||
|
||||
---
|
||||
@@ -1,24 +0,0 @@
|
||||
# Polymarket Documentation Index
|
||||
|
||||
## Platform Documentation
|
||||
|
||||
- **api.md** - Polymarket API documentation
|
||||
- **getting_started.md** - Getting started guide
|
||||
- **guides.md** - Development guides
|
||||
- **learn.md** - Learning resources
|
||||
- **trading.md** - Trading and market operations
|
||||
- **other.md** - Additional resources and tools
|
||||
|
||||
## Real-Time Data Streaming
|
||||
|
||||
- **realtime-client.md** - WebSocket real-time data client (complete API reference)
|
||||
- **README.md** - Platform overview
|
||||
|
||||
## LLM Integration
|
||||
|
||||
- **llms.md** - LLM integration guide (summary)
|
||||
- **llms-full.md** - Complete LLM documentation
|
||||
|
||||
---
|
||||
|
||||
**Use these reference files for detailed information on specific topics.**
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,127 +0,0 @@
|
||||
# Polymarket Documentation
|
||||
|
||||
## Docs
|
||||
|
||||
- [Get comments by comment id](https://docs.polymarket.com/api-reference/comments/get-comments-by-comment-id.md)
|
||||
- [Get comments by user address](https://docs.polymarket.com/api-reference/comments/get-comments-by-user-address.md)
|
||||
- [List comments](https://docs.polymarket.com/api-reference/comments/list-comments.md)
|
||||
- [Get closed positions for a user](https://docs.polymarket.com/api-reference/core/get-closed-positions-for-a-user.md): Fetches closed positions for a user(address)
|
||||
- [Get current positions for a user](https://docs.polymarket.com/api-reference/core/get-current-positions-for-a-user.md): Returns positions filtered by user and optional filters.
|
||||
- [Get top holders for markets](https://docs.polymarket.com/api-reference/core/get-top-holders-for-markets.md)
|
||||
- [Get total value of a user's positions](https://docs.polymarket.com/api-reference/core/get-total-value-of-a-users-positions.md)
|
||||
- [Get trades for a user or markets](https://docs.polymarket.com/api-reference/core/get-trades-for-a-user-or-markets.md)
|
||||
- [Get user activity](https://docs.polymarket.com/api-reference/core/get-user-activity.md): Returns on-chain activity for a user.
|
||||
- [Get event by id](https://docs.polymarket.com/api-reference/events/get-event-by-id.md)
|
||||
- [Get event by slug](https://docs.polymarket.com/api-reference/events/get-event-by-slug.md)
|
||||
- [Get event tags](https://docs.polymarket.com/api-reference/events/get-event-tags.md)
|
||||
- [List events](https://docs.polymarket.com/api-reference/events/list-events.md)
|
||||
- [Health check](https://docs.polymarket.com/api-reference/health/health-check.md)
|
||||
- [Get market by id](https://docs.polymarket.com/api-reference/markets/get-market-by-id.md)
|
||||
- [Get market by slug](https://docs.polymarket.com/api-reference/markets/get-market-by-slug.md)
|
||||
- [Get market tags by id](https://docs.polymarket.com/api-reference/markets/get-market-tags-by-id.md)
|
||||
- [List markets](https://docs.polymarket.com/api-reference/markets/list-markets.md)
|
||||
- [Get live volume for an event](https://docs.polymarket.com/api-reference/misc/get-live-volume-for-an-event.md)
|
||||
- [Get open interest](https://docs.polymarket.com/api-reference/misc/get-open-interest.md)
|
||||
- [Get total markets a user has traded](https://docs.polymarket.com/api-reference/misc/get-total-markets-a-user-has-traded.md)
|
||||
- [Get multiple order books summaries by request](https://docs.polymarket.com/api-reference/orderbook/get-multiple-order-books-summaries-by-request.md): Retrieves order book summaries for specified tokens via POST request
|
||||
- [Get order book summary](https://docs.polymarket.com/api-reference/orderbook/get-order-book-summary.md): Retrieves the order book summary for a specific token
|
||||
- [Get market price](https://docs.polymarket.com/api-reference/pricing/get-market-price.md): Retrieves the market price for a specific token and side
|
||||
- [Get midpoint price](https://docs.polymarket.com/api-reference/pricing/get-midpoint-price.md): Retrieves the midpoint price for a specific token
|
||||
- [Get multiple market prices](https://docs.polymarket.com/api-reference/pricing/get-multiple-market-prices.md): Retrieves market prices for multiple tokens and sides
|
||||
- [Get multiple market prices by request](https://docs.polymarket.com/api-reference/pricing/get-multiple-market-prices-by-request.md): Retrieves market prices for specified tokens and sides via POST request
|
||||
- [Get price history for a traded token](https://docs.polymarket.com/api-reference/pricing/get-price-history-for-a-traded-token.md): Fetches historical price data for a specified market token
|
||||
- [Search markets, events, and profiles](https://docs.polymarket.com/api-reference/search/search-markets-events-and-profiles.md)
|
||||
- [Get series by id](https://docs.polymarket.com/api-reference/series/get-series-by-id.md)
|
||||
- [List series](https://docs.polymarket.com/api-reference/series/list-series.md)
|
||||
- [Get sports metadata information](https://docs.polymarket.com/api-reference/sports/get-sports-metadata-information.md): Retrieves metadata for various sports including images, resolution sources, ordering preferences, tags, and series information. This endpoint provides comprehensive sport configuration data used throughout the platform.
|
||||
- [List teams](https://docs.polymarket.com/api-reference/sports/list-teams.md)
|
||||
- [Get bid-ask spreads](https://docs.polymarket.com/api-reference/spreads/get-bid-ask-spreads.md): Retrieves bid-ask spreads for multiple tokens
|
||||
- [Get related tags (relationships) by tag id](https://docs.polymarket.com/api-reference/tags/get-related-tags-relationships-by-tag-id.md)
|
||||
- [Get related tags (relationships) by tag slug](https://docs.polymarket.com/api-reference/tags/get-related-tags-relationships-by-tag-slug.md)
|
||||
- [Get tag by id](https://docs.polymarket.com/api-reference/tags/get-tag-by-id.md)
|
||||
- [Get tag by slug](https://docs.polymarket.com/api-reference/tags/get-tag-by-slug.md)
|
||||
- [Get tags related to a tag id](https://docs.polymarket.com/api-reference/tags/get-tags-related-to-a-tag-id.md)
|
||||
- [Get tags related to a tag slug](https://docs.polymarket.com/api-reference/tags/get-tags-related-to-a-tag-slug.md)
|
||||
- [List tags](https://docs.polymarket.com/api-reference/tags/list-tags.md)
|
||||
- [Polymarket Changelog](https://docs.polymarket.com/changelog/changelog.md): Welcome to the Polymarket Changelog. Here you will find any important changes to Polymarket, including but not limited to CLOB, API, UI and Mobile Applications.
|
||||
- [null](https://docs.polymarket.com/developers/CLOB/authentication.md)
|
||||
- [null](https://docs.polymarket.com/developers/CLOB/clients.md)
|
||||
- [null](https://docs.polymarket.com/developers/CLOB/endpoints.md)
|
||||
- [CLOB Introduction](https://docs.polymarket.com/developers/CLOB/introduction.md)
|
||||
- [Cancel Orders(s)](https://docs.polymarket.com/developers/CLOB/orders/cancel-orders.md): Multiple endpoints to cancel a single order, multiple orders, all orders or all orders from a single market.
|
||||
- [Check Order Reward Scoring](https://docs.polymarket.com/developers/CLOB/orders/check-scoring.md): Check if an order is eligble or scoring for Rewards purposes
|
||||
- [Place Single Order](https://docs.polymarket.com/developers/CLOB/orders/create-order.md): Detailed instructions for creating, placing, and managing orders using Polymarket's CLOB API.
|
||||
- [Place Multiple Orders (Batching)](https://docs.polymarket.com/developers/CLOB/orders/create-order-batch.md): Instructions for placing multiple orders(Batch)
|
||||
- [Get Active Orders](https://docs.polymarket.com/developers/CLOB/orders/get-active-order.md)
|
||||
- [Get Order](https://docs.polymarket.com/developers/CLOB/orders/get-order.md): Get information about an existing order
|
||||
- [Onchain Order Info](https://docs.polymarket.com/developers/CLOB/orders/onchain-order-info.md)
|
||||
- [Orders Overview](https://docs.polymarket.com/developers/CLOB/orders/orders.md): Detailed instructions for creating, placing, and managing orders using Polymarket's CLOB API.
|
||||
- [null](https://docs.polymarket.com/developers/CLOB/status.md)
|
||||
- [Get Trades](https://docs.polymarket.com/developers/CLOB/trades/trades.md)
|
||||
- [Trades Overview](https://docs.polymarket.com/developers/CLOB/trades/trades-overview.md)
|
||||
- [Market Channel](https://docs.polymarket.com/developers/CLOB/websocket/market-channel.md)
|
||||
- [User Channel](https://docs.polymarket.com/developers/CLOB/websocket/user-channel.md)
|
||||
- [WSS Authentication](https://docs.polymarket.com/developers/CLOB/websocket/wss-auth.md)
|
||||
- [WSS Overview](https://docs.polymarket.com/developers/CLOB/websocket/wss-overview.md): Overview and general information about the Polymarket Websocket
|
||||
- [Deployment and Additional Information](https://docs.polymarket.com/developers/CTF/deployment-resources.md)
|
||||
- [Merging Tokens](https://docs.polymarket.com/developers/CTF/merge.md)
|
||||
- [Overview](https://docs.polymarket.com/developers/CTF/overview.md)
|
||||
- [Reedeeming Tokens](https://docs.polymarket.com/developers/CTF/redeem.md)
|
||||
- [Splitting USDC](https://docs.polymarket.com/developers/CTF/split.md)
|
||||
- [RTDS Comments](https://docs.polymarket.com/developers/RTDS/RTDS-comments.md)
|
||||
- [RTDS Crypto Prices](https://docs.polymarket.com/developers/RTDS/RTDS-crypto-prices.md)
|
||||
- [Real Time Data Socket](https://docs.polymarket.com/developers/RTDS/RTDS-overview.md)
|
||||
- [How to Fetch Markets](https://docs.polymarket.com/developers/gamma-markets-api/fetch-markets-guide.md)
|
||||
- [Gamma Structure](https://docs.polymarket.com/developers/gamma-markets-api/gamma-structure.md)
|
||||
- [null](https://docs.polymarket.com/developers/gamma-markets-api/overview.md)
|
||||
- [Overview](https://docs.polymarket.com/developers/neg-risk/overview.md)
|
||||
- [null](https://docs.polymarket.com/developers/proxy-wallet.md)
|
||||
- [Resolution](https://docs.polymarket.com/developers/resolution/UMA.md)
|
||||
- [Liquidity Rewards](https://docs.polymarket.com/developers/rewards/overview.md): Polymarket provides incentives aimed at catalyzing the supply and demand side of the marketplace. Specifically there is a public liquidity rewards program as well as one-off public pnl/volume competitions.
|
||||
- [null](https://docs.polymarket.com/developers/subgraph/overview.md)
|
||||
- [Does Polymarket have an API?](https://docs.polymarket.com/polymarket-learn/FAQ/does-polymarket-have-an-api.md): Getting data from Polymarket
|
||||
- [How To Use Embeds](https://docs.polymarket.com/polymarket-learn/FAQ/embeds.md): Adding market embeds to your Substack or website.
|
||||
- [How Do I Export My Key?](https://docs.polymarket.com/polymarket-learn/FAQ/how-to-export-private-key.md): Exporting your private key on Magic.Link
|
||||
- [Is My Money Safe?](https://docs.polymarket.com/polymarket-learn/FAQ/is-my-money-safe.md): Yes. Polymarket is non-custodial, so you're in control of your funds.
|
||||
- [Is Polymarket The House?](https://docs.polymarket.com/polymarket-learn/FAQ/is-polymarket-the-house.md): No, Polymarket is not the house. All trades happen peer-to-peer (p2p).
|
||||
- [Polymarket vs. Polling](https://docs.polymarket.com/polymarket-learn/FAQ/polling.md): How is Polymarket better than traditional / legacy polling?
|
||||
- [Recover Missing Deposit](https://docs.polymarket.com/polymarket-learn/FAQ/recover-missing-deposit.md): If you deposited the wrong cryptocurrency on Ethereum or Polygon, use these tools to recover those funds.
|
||||
- [Can I Sell Early?](https://docs.polymarket.com/polymarket-learn/FAQ/sell-early.md)
|
||||
- [How Do I Contact Support?](https://docs.polymarket.com/polymarket-learn/FAQ/support.md): Polymarket offers technical support through our website chat feature, and through Discord.
|
||||
- [Does Polymarket Have a Token?](https://docs.polymarket.com/polymarket-learn/FAQ/wen-token.md)
|
||||
- [What is a Prediction Market?](https://docs.polymarket.com/polymarket-learn/FAQ/what-are-prediction-markets.md): How people collectively forecast the future.
|
||||
- [Why Crypto?](https://docs.polymarket.com/polymarket-learn/FAQ/why-do-i-need-crypto.md): Why Polymarket uses crypto and blockchain technology to create the world’s largest Prediction market.
|
||||
- [Deposit with Coinbase](https://docs.polymarket.com/polymarket-learn/deposits/coinbase.md): How to buy and deposit USDC to your Polymarket account using Coinbase.
|
||||
- [How to Withdraw](https://docs.polymarket.com/polymarket-learn/deposits/how-to-withdraw.md): How to withdraw your cash balance from Polymarket.
|
||||
- [Large Cross Chain Deposits](https://docs.polymarket.com/polymarket-learn/deposits/large-cross-chain-deposits.md)
|
||||
- [Deposit Using Your Card](https://docs.polymarket.com/polymarket-learn/deposits/moonpay.md): Use MoonPay to deposit cash using your Visa, Mastercard, or bank account.
|
||||
- [Deposit by Transfering Crypto](https://docs.polymarket.com/polymarket-learn/deposits/supported-tokens.md): Learn what Tokens and Chains are supported for deposit.
|
||||
- [Deposit USDC on Ethereum](https://docs.polymarket.com/polymarket-learn/deposits/usdc-on-eth.md): How to deposit USDC on the Ethereum Network to your Polymarket account.
|
||||
- [How to Deposit](https://docs.polymarket.com/polymarket-learn/get-started/how-to-deposit.md): How to add cash to your balance on Polymarket.
|
||||
- [How to Sign-Up](https://docs.polymarket.com/polymarket-learn/get-started/how-to-signup.md): How to create a Polymarket account.
|
||||
- [Making Your First Trade](https://docs.polymarket.com/polymarket-learn/get-started/making-your-first-trade.md): How to buy shares.
|
||||
- [What is Polymarket?](https://docs.polymarket.com/polymarket-learn/get-started/what-is-polymarket.md)
|
||||
- [How Are Markets Disputed?](https://docs.polymarket.com/polymarket-learn/markets/dispute.md)
|
||||
- [How Are Markets Clarified?](https://docs.polymarket.com/polymarket-learn/markets/how-are-markets-clarified.md): How are markets on Polymarket clarified?
|
||||
- [How Are Markets Created?](https://docs.polymarket.com/polymarket-learn/markets/how-are-markets-created.md): Markets are created by the markets team with input from users and the community.
|
||||
- [How Are Prediction Markets Resolved?](https://docs.polymarket.com/polymarket-learn/markets/how-are-markets-resolved.md): Markets are resolved by the UMA Optimistic Oracle, a smart-contract based optimistic oracle.
|
||||
- [Trading Fees](https://docs.polymarket.com/polymarket-learn/trading/fees.md)
|
||||
- [Holding Rewards](https://docs.polymarket.com/polymarket-learn/trading/holding-rewards.md)
|
||||
- [How Are Prices Calculated?](https://docs.polymarket.com/polymarket-learn/trading/how-are-prices-calculated.md): The prices probabilities displayed on Polymarket are the midpoint of the bid-ask spread in the orderbook.
|
||||
- [Limit Orders](https://docs.polymarket.com/polymarket-learn/trading/limit-orders.md): What are limit orders and how to make them.
|
||||
- [Liquidity Rewards](https://docs.polymarket.com/polymarket-learn/trading/liquidity-rewards.md): Learn how to earn rewards merely by placing trades on Polymarket
|
||||
- [Market Orders](https://docs.polymarket.com/polymarket-learn/trading/market-orders.md): How to buy shares.
|
||||
- [Does Polymarket Have Trading Limits?](https://docs.polymarket.com/polymarket-learn/trading/no-limits.md)
|
||||
- [Using the Order Book](https://docs.polymarket.com/polymarket-learn/trading/using-the-orderbook.md): Understanding the Order Book will help you become an advanced trader.
|
||||
- [Glossary](https://docs.polymarket.com/quickstart/introduction/definitions.md)
|
||||
- [Developer Quickstart](https://docs.polymarket.com/quickstart/introduction/main.md)
|
||||
- [API Rate Limits](https://docs.polymarket.com/quickstart/introduction/rate-limits.md)
|
||||
- [Your First Order](https://docs.polymarket.com/quickstart/orders/first-order.md)
|
||||
- [WSS Quickstart](https://docs.polymarket.com/quickstart/websocket/WSS-Quickstart.md)
|
||||
|
||||
|
||||
## Optional
|
||||
|
||||
- [Polymarket](https://polymarket.com)
|
||||
- [Discord Community](https://discord.gg/polymarket)
|
||||
- [Twitter](https://x.com/polymarket)
|
||||
@@ -1,540 +0,0 @@
|
||||
# Polymarket - Other
|
||||
|
||||
**Pages:** 7
|
||||
|
||||
---
|
||||
|
||||
## Deployment and Additional Information
|
||||
|
||||
**URL:** llms-txt#deployment-and-additional-information
|
||||
|
||||
**Contents:**
|
||||
- Deployment
|
||||
- Resources
|
||||
|
||||
Source: https://docs.polymarket.com/developers/CTF/deployment-resources
|
||||
|
||||
The CTF contract is deployed (and verified) at the following addresses:
|
||||
|
||||
| Network | Deployed Address |
|
||||
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| Polygon Mainnet | [0x4D97DCd97eC945f40cF65F87097ACe5EA0476045](https://polygonscan.com/address/0x4D97DCd97eC945f40cF65F87097ACe5EA0476045) |
|
||||
| Polygon Mainnet | [0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E](https://polygonscan.com/address/0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E) |
|
||||
|
||||
Polymarket provides code samples in both Python and TypeScript for interacting
|
||||
with our smart chain contracts. You will need an RPC endpoint to access the
|
||||
blockchain, and you'll be responsible for paying gas fees when executing these
|
||||
RPC/function calls. Please ensure you're using the correct example for your wallet
|
||||
type (Safe Wallet vs Proxy Wallet) when implementing.
|
||||
|
||||
* [On-Chain Code Samples](https://github.com/Polymarket/examples/tree/main/examples)
|
||||
* [Polygon RPC List](https://chainlist.org/chain/137)
|
||||
* [CTF Source Code](https://github.com/gnosis/conditional-tokens-contracts)
|
||||
* [Audits](https://github.com/gnosis/conditional-tokens-contracts/tree/master/docs/audit)
|
||||
* [Gist For positionId Calculation](https://gist.github.com/L-Kov/950bce141a9d1aa1ed3b1cfce6d30217)
|
||||
|
||||
---
|
||||
|
||||
## Gamma Structure
|
||||
|
||||
**URL:** llms-txt#gamma-structure
|
||||
|
||||
Source: https://docs.polymarket.com/developers/gamma-markets-api/gamma-structure
|
||||
|
||||
Gamma provides some organizational models. These include events, and markets. The most fundamental element is always markets and the other models simply provide additional organization.
|
||||
|
||||
---
|
||||
|
||||
## Real Time Data Socket
|
||||
|
||||
**URL:** llms-txt#real-time-data-socket
|
||||
|
||||
**Contents:**
|
||||
- Overview
|
||||
- Connection Details
|
||||
- Authentication
|
||||
- Connection Management
|
||||
- Available Subscription Types
|
||||
- Message Structure
|
||||
- Subscription Management
|
||||
- Subscribe to Topics
|
||||
- Unsubscribe from Topics
|
||||
- Error Handling
|
||||
|
||||
Source: https://docs.polymarket.com/developers/RTDS/RTDS-overview
|
||||
|
||||
The Polymarket Real-Time Data Socket (RTDS) is a WebSocket-based streaming service that provides real-time updates for various Polymarket data streams. The service allows clients to subscribe to multiple data feeds simultaneously and receive live updates as events occur on the platform.
|
||||
|
||||
<Note>Polymarket provides a Typescript client for interacting with this streaming service. [Download and view it's documentation here](https://github.com/Polymarket/real-time-data-client)</Note>
|
||||
|
||||
### Connection Details
|
||||
|
||||
* **WebSocket URL**: `wss://ws-live-data.polymarket.com`
|
||||
* **Protocol**: WebSocket
|
||||
* **Data Format**: JSON
|
||||
|
||||
The RTDS supports two types of authentication depending on the subscription type:
|
||||
|
||||
1. **CLOB Authentication**: Required for certain trading-related subscriptions
|
||||
* `key`: API key
|
||||
* `secret`: API secret
|
||||
* `passphrase`: API passphrase
|
||||
|
||||
2. **Gamma Authentication**: Required for user-specific data
|
||||
* `address`: User wallet address
|
||||
|
||||
### Connection Management
|
||||
|
||||
The WebSocket connection supports:
|
||||
|
||||
* **Dynamic Subscriptions**: Without disconnecting from the socket users can add, remove and modify topics and filters they are subscribed to.
|
||||
* **Ping/Pong**: You should send PING messages (every 5 seconds ideally) to maintain connection
|
||||
|
||||
## Available Subscription Types
|
||||
|
||||
<Note>Although this connection technically supports additional activity and subscription types, they are not fully supported at this time. Users are free to use them but there may be some unexpected behavior.</Note>
|
||||
|
||||
The RTDS currently supports the following subscription types:
|
||||
|
||||
1. **[Crypto Prices](https://docs.polymarket.com/developers/RTDS/RTDS-crypto-prices)** - Real-time cryptocurrency price updates
|
||||
2. **[Comments](https://docs.polymarket.com/developers/RTDS/RTDS-comments)** - Comment-related events including reactions
|
||||
|
||||
All messages received from the WebSocket follow this structure:
|
||||
|
||||
* `topic`: The subscription topic (e.g., "crypto\_prices", "comments", "activity")
|
||||
* `type`: The message type/event (e.g., "update", "reaction\_created", "orders\_matched")
|
||||
* `timestamp`: Unix timestamp in milliseconds
|
||||
* `payload`: Event-specific data object
|
||||
|
||||
## Subscription Management
|
||||
|
||||
### Subscribe to Topics
|
||||
|
||||
To subscribe to data streams, send a JSON message with this structure:
|
||||
|
||||
### Unsubscribe from Topics
|
||||
|
||||
To unsubscribe from data streams, send a similar message with `"action": "unsubscribe"`.
|
||||
|
||||
* Connection errors will trigger automatic reconnection attempts
|
||||
* Invalid subscription messages may result in connection closure
|
||||
* Authentication failures will prevent successful subscription to protected topics
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
* `topic`: The subscription topic (e.g., "crypto\_prices", "comments", "activity")
|
||||
* `type`: The message type/event (e.g., "update", "reaction\_created", "orders\_matched")
|
||||
* `timestamp`: Unix timestamp in milliseconds
|
||||
* `payload`: Event-specific data object
|
||||
|
||||
## Subscription Management
|
||||
|
||||
### Subscribe to Topics
|
||||
|
||||
To subscribe to data streams, send a JSON message with this structure:
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## RTDS Crypto Prices
|
||||
|
||||
**URL:** llms-txt#rtds-crypto-prices
|
||||
|
||||
**Contents:**
|
||||
- Overview
|
||||
- Binance Source (`crypto_prices`)
|
||||
- Subscription Details
|
||||
- Subscription Message
|
||||
- With Symbol Filter
|
||||
- Chainlink Source (`crypto_prices_chainlink`)
|
||||
- Subscription Details
|
||||
- Subscription Message
|
||||
- With Symbol Filter
|
||||
- Message Format
|
||||
|
||||
Source: https://docs.polymarket.com/developers/RTDS/RTDS-crypto-prices
|
||||
|
||||
<Note>Polymarket provides a Typescript client for interacting with this streaming service. [Download and view it's documentation here](https://github.com/Polymarket/real-time-data-client)</Note>
|
||||
|
||||
The crypto prices subscription provides real-time updates for cryptocurrency price data from two different sources:
|
||||
|
||||
* **Binance Source** (`crypto_prices`): Real-time price data from Binance exchange
|
||||
* **Chainlink Source** (`crypto_prices_chainlink`): Price data from Chainlink oracle networks
|
||||
|
||||
Both streams deliver current market prices for various cryptocurrency trading pairs, but use different symbol formats and subscription structures.
|
||||
|
||||
## Binance Source (`crypto_prices`)
|
||||
|
||||
### Subscription Details
|
||||
|
||||
* **Topic**: `crypto_prices`
|
||||
* **Type**: `update`
|
||||
* **Authentication**: Not required
|
||||
* **Filters**: Optional (specific symbols can be filtered)
|
||||
* **Symbol Format**: Lowercase concatenated pairs (e.g., `solusdt`, `btcusdt`)
|
||||
|
||||
### Subscription Message
|
||||
|
||||
### With Symbol Filter
|
||||
|
||||
To subscribe to specific cryptocurrency symbols, include a filters parameter:
|
||||
|
||||
## Chainlink Source (`crypto_prices_chainlink`)
|
||||
|
||||
### Subscription Details
|
||||
|
||||
* **Topic**: `crypto_prices_chainlink`
|
||||
* **Type**: `*` (all types)
|
||||
* **Authentication**: Not required
|
||||
* **Filters**: Optional (JSON object with symbol specification)
|
||||
* **Symbol Format**: Slash-separated pairs (e.g., `eth/usd`, `btc/usd`)
|
||||
|
||||
### Subscription Message
|
||||
|
||||
### With Symbol Filter
|
||||
|
||||
To subscribe to specific cryptocurrency symbols, include a JSON filters parameter:
|
||||
|
||||
### Binance Source Message Format
|
||||
|
||||
When subscribed to Binance crypto prices (`crypto_prices`), you'll receive messages with the following structure:
|
||||
|
||||
### Chainlink Source Message Format
|
||||
|
||||
When subscribed to Chainlink crypto prices (`crypto_prices_chainlink`), you'll receive messages with the following structure:
|
||||
|
||||
| Field | Type | Description |
|
||||
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `symbol` | string | Trading pair symbol<br />**Binance**: lowercase concatenated (e.g., "solusdt", "btcusdt")<br />**Chainlink**: slash-separated (e.g., "eth/usd", "btc/usd") |
|
||||
| `timestamp` | number | Price timestamp in Unix milliseconds |
|
||||
| `value` | number | Current price value in the quote currency |
|
||||
|
||||
### Binance Source Examples
|
||||
|
||||
#### Solana Price Update (Binance)
|
||||
|
||||
#### Bitcoin Price Update (Binance)
|
||||
|
||||
### Chainlink Source Examples
|
||||
|
||||
#### Ethereum Price Update (Chainlink)
|
||||
|
||||
#### Bitcoin Price Update (Chainlink)
|
||||
|
||||
### Binance Source Symbols
|
||||
|
||||
The Binance source supports various cryptocurrency trading pairs using lowercase concatenated format:
|
||||
|
||||
* `btcusdt` - Bitcoin to USDT
|
||||
* `ethusdt` - Ethereum to USDT
|
||||
* `solusdt` - Solana to USDT
|
||||
* `xrpusdt` - XRP to USDT
|
||||
|
||||
### Chainlink Source Symbols
|
||||
|
||||
The Chainlink source supports cryptocurrency trading pairs using slash-separated format:
|
||||
|
||||
* `btc/usd` - Bitcoin to USD
|
||||
* `eth/usd` - Ethereum to USD
|
||||
* `sol/usd` - Solana to USD
|
||||
* `xrp/usd` - XRP to USD
|
||||
|
||||
* Price updates are sent as market prices change
|
||||
* The timestamp in the payload represents when the price was recorded
|
||||
* The outer timestamp represents when the message was sent via WebSocket
|
||||
* No authentication is required for crypto price data
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
### With Symbol Filter
|
||||
|
||||
To subscribe to specific cryptocurrency symbols, include a filters parameter:
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
## Chainlink Source (`crypto_prices_chainlink`)
|
||||
|
||||
### Subscription Details
|
||||
|
||||
* **Topic**: `crypto_prices_chainlink`
|
||||
* **Type**: `*` (all types)
|
||||
* **Authentication**: Not required
|
||||
* **Filters**: Optional (JSON object with symbol specification)
|
||||
* **Symbol Format**: Slash-separated pairs (e.g., `eth/usd`, `btc/usd`)
|
||||
|
||||
### Subscription Message
|
||||
```
|
||||
|
||||
Example 3 (unknown):
|
||||
```unknown
|
||||
### With Symbol Filter
|
||||
|
||||
To subscribe to specific cryptocurrency symbols, include a JSON filters parameter:
|
||||
```
|
||||
|
||||
Example 4 (unknown):
|
||||
```unknown
|
||||
## Message Format
|
||||
|
||||
### Binance Source Message Format
|
||||
|
||||
When subscribed to Binance crypto prices (`crypto_prices`), you'll receive messages with the following structure:
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## RTDS Comments
|
||||
|
||||
**URL:** llms-txt#rtds-comments
|
||||
|
||||
**Contents:**
|
||||
- Overview
|
||||
- Subscription Details
|
||||
- Subscription Message
|
||||
- Message Format
|
||||
- Message Types
|
||||
- comment\_created
|
||||
- comment\_removed
|
||||
- reaction\_created
|
||||
- reaction\_removed
|
||||
- Payload Fields
|
||||
|
||||
Source: https://docs.polymarket.com/developers/RTDS/RTDS-comments
|
||||
|
||||
<Note>Polymarket provides a Typescript client for interacting with this streaming service. [Download and view it's documentation here](https://github.com/Polymarket/real-time-data-client)</Note>
|
||||
|
||||
The comments subscription provides real-time updates for comment-related events on the Polymarket platform. This includes new comments being created, as well as other comment interactions like reactions and replies.
|
||||
|
||||
## Subscription Details
|
||||
|
||||
* **Topic**: `comments`
|
||||
* **Type**: `comment_created` (and potentially other comment event types like `reaction_created`)
|
||||
* **Authentication**: May require Gamma authentication for user-specific data
|
||||
* **Filters**: Optional (can filter by specific comment IDs, users, or events)
|
||||
|
||||
## Subscription Message
|
||||
|
||||
When subscribed to comments, you'll receive messages with the following structure:
|
||||
|
||||
Triggered when a user creates a new comment on an event or in reply to another comment.
|
||||
|
||||
Triggered when a comment is removed or deleted.
|
||||
|
||||
### reaction\_created
|
||||
|
||||
Triggered when a user adds a reaction to an existing comment.
|
||||
|
||||
### reaction\_removed
|
||||
|
||||
Triggered when a reaction is removed from a comment.
|
||||
|
||||
| Field | Type | Description |
|
||||
| ------------------ | ------ | ------------------------------------------------------------------------- |
|
||||
| `body` | string | The text content of the comment |
|
||||
| `createdAt` | string | ISO 8601 timestamp when the comment was created |
|
||||
| `id` | string | Unique identifier for this comment |
|
||||
| `parentCommentID` | string | ID of the parent comment if this is a reply (null for top-level comments) |
|
||||
| `parentEntityID` | number | ID of the parent entity (event, market, etc.) |
|
||||
| `parentEntityType` | string | Type of parent entity (e.g., "Event", "Market") |
|
||||
| `profile` | object | Profile information of the user who created the comment |
|
||||
| `reactionCount` | number | Current number of reactions on this comment |
|
||||
| `replyAddress` | string | Polygon address for replies (may be different from userAddress) |
|
||||
| `reportCount` | number | Current number of reports on this comment |
|
||||
| `userAddress` | string | Polygon address of the user who created the comment |
|
||||
|
||||
### Profile Object Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
| ----------------------- | ------- | ------------------------------------------------- |
|
||||
| `baseAddress` | string | User profile address |
|
||||
| `displayUsernamePublic` | boolean | Whether the username should be displayed publicly |
|
||||
| `name` | string | User's display name |
|
||||
| `proxyWallet` | string | Proxy wallet address used for transactions |
|
||||
| `pseudonym` | string | Generated pseudonym for the user |
|
||||
|
||||
## Parent Entity Types
|
||||
|
||||
The following parent entity types are supported:
|
||||
|
||||
* `Event` - Comments on prediction events
|
||||
* `Market` - Comments on specific markets
|
||||
* Additional entity types may be available
|
||||
|
||||
### New Comment Created
|
||||
|
||||
### Reply to Existing Comment
|
||||
|
||||
Comments support nested threading:
|
||||
|
||||
* **Top-level comments**: `parentCommentID` is null or empty
|
||||
* **Reply comments**: `parentCommentID` contains the ID of the parent comment
|
||||
* All comments are associated with a `parentEntityID` and `parentEntityType`
|
||||
|
||||
* Real-time comment feed displays
|
||||
* Discussion thread monitoring
|
||||
* Community sentiment analysis
|
||||
|
||||
* Comments include `reactionCount` and `reportCount`
|
||||
* Comment body contains the full text content
|
||||
|
||||
* The `createdAt` timestamp uses ISO 8601 format with timezone information
|
||||
* The outer `timestamp` field represents when the WebSocket message was sent
|
||||
* User profiles include both primary addresses and proxy wallet addresses
|
||||
|
||||
**Examples:**
|
||||
|
||||
Example 1 (unknown):
|
||||
```unknown
|
||||
## Message Format
|
||||
|
||||
When subscribed to comments, you'll receive messages with the following structure:
|
||||
```
|
||||
|
||||
Example 2 (unknown):
|
||||
```unknown
|
||||
## Message Types
|
||||
|
||||
### comment\_created
|
||||
|
||||
Triggered when a user creates a new comment on an event or in reply to another comment.
|
||||
|
||||
### comment\_removed
|
||||
|
||||
Triggered when a comment is removed or deleted.
|
||||
|
||||
### reaction\_created
|
||||
|
||||
Triggered when a user adds a reaction to an existing comment.
|
||||
|
||||
### reaction\_removed
|
||||
|
||||
Triggered when a reaction is removed from a comment.
|
||||
|
||||
## Payload Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
| ------------------ | ------ | ------------------------------------------------------------------------- |
|
||||
| `body` | string | The text content of the comment |
|
||||
| `createdAt` | string | ISO 8601 timestamp when the comment was created |
|
||||
| `id` | string | Unique identifier for this comment |
|
||||
| `parentCommentID` | string | ID of the parent comment if this is a reply (null for top-level comments) |
|
||||
| `parentEntityID` | number | ID of the parent entity (event, market, etc.) |
|
||||
| `parentEntityType` | string | Type of parent entity (e.g., "Event", "Market") |
|
||||
| `profile` | object | Profile information of the user who created the comment |
|
||||
| `reactionCount` | number | Current number of reactions on this comment |
|
||||
| `replyAddress` | string | Polygon address for replies (may be different from userAddress) |
|
||||
| `reportCount` | number | Current number of reports on this comment |
|
||||
| `userAddress` | string | Polygon address of the user who created the comment |
|
||||
|
||||
### Profile Object Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
| ----------------------- | ------- | ------------------------------------------------- |
|
||||
| `baseAddress` | string | User profile address |
|
||||
| `displayUsernamePublic` | boolean | Whether the username should be displayed publicly |
|
||||
| `name` | string | User's display name |
|
||||
| `proxyWallet` | string | Proxy wallet address used for transactions |
|
||||
| `pseudonym` | string | Generated pseudonym for the user |
|
||||
|
||||
## Parent Entity Types
|
||||
|
||||
The following parent entity types are supported:
|
||||
|
||||
* `Event` - Comments on prediction events
|
||||
* `Market` - Comments on specific markets
|
||||
* Additional entity types may be available
|
||||
|
||||
## Example Messages
|
||||
|
||||
### New Comment Created
|
||||
```
|
||||
|
||||
Example 3 (unknown):
|
||||
```unknown
|
||||
### Reply to Existing Comment
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## UMA Optimistic Oracle Integration
|
||||
|
||||
**URL:** llms-txt#uma-optimistic-oracle-integration
|
||||
|
||||
**Contents:**
|
||||
- Overview
|
||||
- Clarifications
|
||||
- Resolution Process
|
||||
- Actions
|
||||
- Possible Flows
|
||||
- Deployed Addresses
|
||||
- v3.0
|
||||
- v2.0
|
||||
- v1.0
|
||||
- Additional Resources
|
||||
|
||||
Polymarket leverages UMA's Optimistic Oracle (OO) to resolve arbitrary questions, permissionlessly. From [UMA's docs](https://docs.uma.xyz/protocol-overview/how-does-umas-oracle-work):
|
||||
|
||||
"UMA's Optimistic Oracle allows contracts to quickly request and receive data information ... The Optimistic Oracle acts as a generalized escalation game between contracts that initiate a price request and UMA's dispute resolution system known as the Data Verification Mechanism (DVM). Prices proposed by the Optimistic Oracle will not be sent to the DVM unless it is disputed. If a dispute is raised, a request is sent to the DVM. All contracts built on UMA use the DVM as a backstop to resolve disputes. Disputes sent to the DVM will be resolved within a few days -- after UMA tokenholders vote on what the correct outcome should have been."
|
||||
|
||||
To allow CTF markets to be resolved via the OO, Polymarket developed a custom adapter contract called `UmaCtfAdapter` that provides a way for the two contract systems to interface.
|
||||
|
||||
Recent versions (v2+) of the `UmaCtfAdapter` also include a bulletin board feature that allows market creators to issue "clarifications". Questions that allow updates will include the sentence in their ancillary data:
|
||||
|
||||
"Updates made by the question creator via the bulletin board on 0x6A5D0222186C0FceA7547534cC13c3CFd9b7b6A4F74 should be considered. In summary, clarifications that do not impact the question's intent should be considered."
|
||||
|
||||
Where the [transaction](https://polygonscan.com/tx/0xa14f01b115c4913624fc3f508f960f4dea252758e73c28f5f07f8e19d7bca066) reference outlining what outlining should be considered.
|
||||
|
||||
## Resolution Process
|
||||
|
||||
* **Initiate** - Binary CTF markets are initialized via the `UmaCtfAdapter`'s `initialize()` function. This stores the question parameters on the contract, prepares the CTF and requests a price for a question from the OO. It returns a `questionID` that is also used to reference on the `UmaCtfAdapter`. The caller provides:
|
||||
1. `ancillaryData` - data used to resolve a question (i.e the question + clarifications)
|
||||
2. `rewardToken` - ERC20 token address used for payment of rewards and fees
|
||||
3. `reward` - Reward amount offered to a successful proposer. The caller must have set allowance so that the contract can pull this reward in.
|
||||
4. `proposalBond` - Bond required to be posted by OO proposers/disputers. If 0, the default OO bond is used.
|
||||
5. `liveness` - UMA liveness period in seconds. If 0, the default liveness period is used.
|
||||
|
||||
* **Propose Price** - Anyone can then propose a price to the question on the OO. To do this they must post the `proposalBond`. The liveness period begins after a price is proposed.
|
||||
|
||||
* **Dispute** - Anyone that disagrees with the proposed price has the opportunity to dispute the price by posting a counter bond via the OO, this proposed will now be escalated to the DVM for a voter-wide vote.
|
||||
|
||||
When the first proposed price is disputed for a `questionID` on the adapter, a callback is made and posted as the reward for this new proposal. This means a second `questionID`, making a new `questionID` to the OO (the reward is returned before the callback is made and posted as the reward for this new proposal). This allows for a second round of resolution, and correspondingly a second dispute is required for it to go to the DVM. The thinking behind this is to doubles the cost of a potential griefing vector (two disputes are required just one) and also allows far-fetched (incorrect) first price proposals to not delay the resolution. As such there are two possible flows:
|
||||
|
||||
* **Initialize (CTFAdapter) -> Propose (OO) -> Resolve (CTFAdapter)**
|
||||
* **Initialize (CTFAdaptor) -> Propose (OO) -> Challenge (OO) -> Propose (OO) -> Resolve (CTFAdaptor)**
|
||||
* **Initialize (CTFAdaptor) -> Propose (OO) -> Challenge (OO) -> Propose (OO) -> Challenge (CtfAdapter) -> Resolve (CTFAdaptor)**
|
||||
|
||||
## Deployed Addresses
|
||||
|
||||
| Network | Address |
|
||||
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| Polygon Mainnet | [0x2F5e3684cb1F318ec51b00Edba38d79Ac2c0aA9d](https://polygonscan.com/address/0x2F5e3684cb1F318ec51b00Edba38d79Ac2c0aA9d) |
|
||||
|
||||
| Network | Address |
|
||||
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Polygon Mainnet | [0x6A9D0222186C0FceA7547534cC13c3CFd9b7b6A4F74](https://polygonscan.com/address/0x6A9D222616C90FcA5754cd1333cFD9b7fb6a4F74) |
|
||||
|
||||
| Network | Address |
|
||||
| --------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Polygon Mainnet | [0xC8B122858a4EF82C2d4eE2E6A276C719e692995130](https://polygonscan.com/address/0xCB1822859cEF82Cd2Eb4E6276C7916e692995130) |
|
||||
|
||||
## Additional Resources
|
||||
|
||||
* [Audit](https://github.com/Polymarket/uma-ctf-adapter/blob/main/audit/Polymarket_UMA_Optimistic_Oracle_Adapter_Audit.pdf)
|
||||
* [Source Code](https://github.com/Polymarket/uma-ctf-adapter)
|
||||
* [UMA Documentation](https://docs.uma.xyz/)
|
||||
* [UMA Oracle Portal](https://oracle.uma.xyz/)
|
||||
|
||||
---
|
||||
|
||||
## Resolution
|
||||
|
||||
**URL:** llms-txt#resolution
|
||||
|
||||
Source: https://docs.polymarket.com/developers/resolution/UMA
|
||||
|
||||
---
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user