polymarket-copytrading-bot
Health Warn
- No license — Repository has no license file
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 9 GitHub stars
Code Warn
- network request — Outbound network request in package-lock.json
- process.env — Environment variable access in src/config/env.ts
- network request — Outbound network request in src/services/clob.ts
- network request — Outbound network request in src/services/gamma.ts
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Comprehensive analytics dashboard for AI coding agents — Cursor, Windsurf, Claude Code, VS Code Copilot, Zed, Antigravity, OpenCode, Command Code
Polymarket Trading Bot (TypeScript)
A professional, configurable Polymarket trading bot built with TypeScript and the official CLOB client.
This repository is designed for developers who want a production-style starter for a Polymarket bot focused on crypto prediction markets, with clean environment setup, strategy configuration, and extensible trading logic.
This project can also be used as a foundation for a Polymarket copy trading bot workflow by extending the Trade engine and strategy modules.
What This Bot Does
- Connects to Polymarket CLOB using authenticated API credentials.
- Selects markets by coin and timeframe (BTC/ETH/SOL/XRP with 5/15/60/240/1440 minutes).
- Continuously fetches YES/NO prices for market tokens.
- Runs internal decision logic through the
Tradeclass. - Supports strategy and risk controls via config (TOML + environment variables).
Tech Stack
- Node.js (>= 20.6.0)
- TypeScript
@polymarket/clob-clientethersdotenvzod
Project Structure
src/index.ts- Main runtime loop: market selection, client initialization, polling, and strategy execution.src/types.ts- Shared market and type definitions.src/config/- Config and market slug generation.src/services/- API and service integration helpers.src/trade/- Core trading and decision engine..env.example- Required environment variables.
Requirements
- Node.js
>=20.6.0 - A funded Polymarket-compatible wallet setup
- Polymarket private key
- Proxy wallet address (only when proxy mode is enabled)
To get started, clone this repository:
git clone https://github.com/YraseUp/polymarket-copytrading-bot.git
cd polymarket-copytrading-bot
Environment Setup
Copy .env.example to .env and fill in your values:
POLYMARKET_PRIVATE_KEY=
PROXY_WALLET_ADDRESS= # needed only if execution.use_proxy_wallet=true
Installation
npm install
Run the Bot
Development mode:
npm run dev
Build and run:
npm run build
npm start
Available Scripts
npm run dev- Run the trading bot withtsx.npm run build- Compile TypeScript todist/.npm start- Run compiled JavaScript fromdist/index.js.
How It Works (Runtime Flow)
- Loads environment/config values.
- Initializes the Polymarket CLOB client and derives API credentials.
- Generates a market slug from configured coin + period.
- Fetches token IDs for UP/DOWN (YES/NO style) outcomes.
- Polls live prices in a loop.
- Updates strategy state and calls trade decision logic every second.
Configuration Notes
- Market coin and period are configurable in your TOML config.
- Position sizing uses the configured USD trade size.
- Trader-manageable controls are available in
trade.toml:execution.enabled- master kill switchexecution.buy_enabled/execution.sell_enabled- allow only buy/sell sideexecution.buy_price_range/execution.sell_price_range- enforce price windowsexecution.min_seconds_between_trades- cooldown between order attemptsexecution.use_proxy_wallet,execution.signature_type,execution.funder_address- wallet/proxy mode controlrisk.min_trade_usd/risk.max_trade_usd- bounds trade size automatically
- Strategy behavior is implemented in the
Tradeclass and can be customized for:- directional entries/exits
- threshold-based logic
- copy-trading style mirroring (custom extension)
Use Cases
- Build your own Polymarket trading bot
- Extend into a Polymarket copy trading bot
- Backtest or paper-trade custom market logic
- Integrate signal sources and execution rules
Keywords
- Polymarket trading bot
- Polymarket bot
- Polymarket copy trading bot
- Polymarket TypeScript bot
- Polymarket automation
Security and Operational Best Practices
- Never commit
.envor private keys. - Start with small position sizes.
- Add logging/alerts before running unattended.
- Test strategy behavior in safe conditions first.
Disclaimer
This software is for educational and research purposes only.
Trading on Polymarket involves significant financial risk. You are solely responsible for your strategy, execution, compliance, and losses.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found