polymarket-copy-trading-bot
БесплатноБез исполняемых скриптовНе проверенTypeScript bot that monitors a Polymarket wallet and mirrors BUY trades to your own account via the Polymarket CLOB API on Polygon.
от reason-machines★ 99 звёзд на GitHubОб этом скилле
Polymarket Copy Trading Bot
Skill by ara.so — Daily 2026 Skills collection.
A TypeScript bot that continuously monitors a target Polymarket wallet, detects trades in real time via REST polling and/or WebSocket, and mirrors BUY orders to your own account using the Polymarket CLOB SDK on Polygon mainnet.
What It Does
- Monitors a target wallet via Polymarket Data API (REST polling every ~2s) and optionally WebSocket
- Mirrors BUY trades only — SELL trades are detected but skipped by default
- Sizes copies using a configurable
POSITION_MULTIPLIER(default 10%) with min/max caps - Submits orders as FOK, FAK, or LIMIT via the Polymarket CLOB client
- Enforces risk limits — per-session and per-market notional caps
- Supports three auth modes — EOA (
SIG_TYPE=0), Poly Proxy (SIG_TYPE=1), Poly Polymorphic (SIG_TYPE=2)
Installation
git clone https://github.com/Neron888/Polymarket-copy-trading-bot.git
cd Polymarket-copy-trading-bot
npm install
Requires Node.js v18+. The CLOB SDK requires ethers v5 (already pinned in package.json).
Configuration
cp .env.example .env
Edit .env:
# Required
TARGET_WALLET=0xTargetWalletAddressToMonitor
WALLET_PRIVATE_KEY=0xYourPrivateKey
RPC_URL=https://your-quicknode-polygon-endpoint.quiknode.pro/your-key/
# Auth mode (0=EOA default, 1=Poly Proxy, 2=Poly Polymorphic)
SIG_TYPE=0
# Required only for SIG_TYPE=1 or 2
PROXY_WALLET_ADDRESS=
# Sizing
POSITION_MULTIPLIER=0.1 # 10% of target's trade size
MAX_TRADE_SIZE=100 # Max USDC per copied trade
MIN_TRADE_SIZE=1 # Min USDC per copied trade
# Order behavior
ORDER_TYPE=FOK # FOK | FAK | LIMIT
SLIPPAGE_TOLERANCE=0.02 # 2%
# Risk caps (0 = disabled)
MAX_SESSION_NOTIONAL=500 # Total USDC for entire session
MAX_PER_MARKET_NOTIONAL=100 # Per market USDC cap
# Monitoring
USE_WEBSOCKET=true
POLL_INTERVAL=2000 # ms between REST polls
USE_USER_CHANNEL=false # true = user WS channel, false = market channel
# Optional
POLYMARKET_GEO_TOKEN=
WS_ASSET_IDS= # comma-separated asset IDs for market WS
WS_MARKET_IDS= # comma-separated condition IDs for user channel
MIN_PRIORITY_FEE_GWEI=30
MIN_MAX_FEE_GWEI=60
Key Commands
# Start the bot (development mode with ts-node)
npm start
# Generate and persist API credentials to .polymarket-api-creds
npm run generate-api-creds
# Validate existing API credentials
npm run test-api-creds
# Compile TypeScript to dist/
npm run build
# Run compiled production build
npm run start:prod
Architecture Overview
index.ts
└── TradeMonitor — REST polls Polymarket Data API for new target trades
└── WebSocketMonitor — Optional low-latency WS subscription (market or user channel)
└── TradeExecutor — Sizes trade, checks balance/allowance, submits CLOB order
└── PositionTracker — In-memory positions updated on fills
└── RiskManager — Session + per-market notional enforcement
Execution flow:
detect trade → BUY? → subscribe WS if needed → compute copy size
→ risk check → execute order (FOK/FAK/LIMIT) → record fill → update stats
Code Examples
Starting the bot programmatically
import { startBot } from './src/index';
// The bot reads all config from process.env / .env
startBot();
TradeMonitor — polling pattern
import { TradeMonitor } from './src/TradeMonitor';
const monitor = new TradeMonitor({
targetWallet: process.env.TARGET_WALLET!,
pollInterval: Number(process.env.POLL_INTERVAL ?? 2000),
});
monitor.on('trade', (trade) => {
console.log('New trade detected:', trade);
// trade.side: 'BUY' | 'SELL'
// trade.asset: token ID (outcome token address)
// trade.size: USDC size
// trade.price: fill price (0–1)
});
monitor.start();
TradeExecutor — placing a copy order
import { TradeExecutor } from './src/TradeExecutor';
import { ClobClient } from '@polymarket/clob-client';
import { ethers } from 'ethers';
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
const signer = new ethers.Wallet(process.env.WALLET_PRIVATE_KEY!, provider);
const clobClient = new ClobClient(
'https://clob.polymarket.com',
137, // Polygon chainId
signer,
apiCreds, // loaded from .polymarket-api-creds
Number(process.env.SIG_TYPE ?? 0),
process.env.PROXY_WALLET_ADDRESS || undefined,
);
const executor = new TradeExecutor({
client: clobClient,
positionMultiplier: Number(process.env.POSITION_MULTIPLIER ?? 0.1),
maxTradeSize: Number(process.env.MAX_TRADE_SIZE ?? 100),
minTradeSize: Number(process.env.MIN_TRADE_SIZE ?? 1),
orderType: (process.env.ORDER_TYPE ?? 'FOK') as 'FOK' | 'FAK' | 'LIMIT',
slippageTolerance: Number(process.env.SLIPPAGE_TOLERANCE ?? 0.02),
});
// Copy a detected trade
await executor.copyTrad
Установить polymarket-copy-trading-bot в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл polymarket-copy-trading-bot?
TypeScript bot that monitors a Polymarket wallet and mirrors BUY trades to your own account via the Polymarket CLOB API on Polygon.
Как установить скилл polymarket-copy-trading-bot?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл polymarket-copy-trading-bot запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic