A Polymarket copy bot for copy trading on Polymarket prediction markets. Watches a target wallet and automatically copies BUY and SELL trades with configurable sizing and risk caps.
Keywords: polymarket trading bot, polymarket copy bot, polymarket copy trading bot, prediction market bot, automated trading
- Watches a target wallet via REST polling.
- Uses WebSocket subscriptions for faster market updates when enabled.
- Copies
BUYand optionallySELLtrades (setCOPY_SELLS=trueto copy sells; requires holding position from copied BUYs). - Auto-checks/sets required token approvals in EOA mode.
- Applies position sizing, slippage, and optional notional risk caps.
- Node.js 18+ and npm
- Polygon EOA funded with
USDC.ecollateral andPOL(MATIC) for gas - Polymarket account tied to the same EOA/private key
- Polygon RPC URL (QuickNode recommended)
Polymarket restricts access in some regions. If you are in a restricted region, the bot will not work — you will see connection or Cloudflare/geo errors. In that case, route traffic through a proxy or VPN (many free proxy services are available). Run the bot from an environment where Polymarket is accessible.
- The bot derives/creates User CLOB credentials from
PRIVATE_KEYat startup. - Builder dashboard keys are for attribution and are not valid trading auth credentials for order placement.
- Install dependencies:
npm install- Create your local env file:
cp .env.example .env- Fill required values in
.env:
TARGET_WALLETPRIVATE_KEYRPC_URL
- (Optional) Generate and inspect user API credentials:
npm run generate-api-credsnpm startDev/watch mode:
npm run devBuild + run compiled output:
npm run build
npm run start:prodTARGET_WALLET: wallet to followPRIVATE_KEY: your EOA private key used for signing/approvals/tradesRPC_URL: Polygon JSON-RPC endpointUSE_WEBSOCKET:true|falseUSE_USER_CHANNEL:true|false(truerequires valid API creds for WS auth)POSITION_MULTIPLIER: copied size multiplier (e.g.0.1)MAX_TRADE_SIZE,MIN_TRADE_SIZESLIPPAGE_TOLERANCE: e.g.0.02ORDER_TYPE:LIMIT,FOK, orFAKCOPY_SELLS:true|false— copy SELL trades in addition to BUY (default: true)EXIT_AFTER_FIRST_SELL_COPY:true|false— exit successfully after first SELL is copied (default: false)MAX_SESSION_NOTIONAL,MAX_PER_MARKET_NOTIONAL:0disables caps
See .env.example for the full list.
- Also known as: polymarket copy bot, polymarket copy trading, polymarket copy trading bot.
- The bot starts copying only trades that happen after startup time.
- User API credentials are derived/generated from
PRIVATE_KEYat startup. - Frequent WebSocket disconnect/reconnect can happen; REST polling remains active as fallback.
- Never commit
.env. - Use a dedicated wallet for bot trading.
- Start with small limits before increasing size.