Skip to content

momo4802354/polymarket-trading-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polymarket Copy Trading Bot

A TypeScript-based CLI bot for automatically copying trades from selected traders on Polymarket.

Telegram: @brunomadrigal49
GitHub: https://github.com/brunomadrigal0/polymarket-trading-bot

Features

  • 🤖 CLI Interface - Easy-to-use command-line interface
  • 📊 Copy Trading - Automatically copy trades from selected traders
  • 📝 Console Logging - All trade activities logged to console
  • ⚙️ Configurable - Set min/max trade amounts, slippage tolerance, and more
  • 📈 Real-time Monitoring - Monitor multiple traders simultaneously

Installation

  1. Clone the repository:
git clone https://github.com/brunomadrigal0/polymarket-trading-bot.git
cd polymarket-trading-bot
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Configuration

  1. Copy the example environment file:
cp env.example .env
  1. Edit .env with your configuration:
# Polymarket Configuration
POLYMARKET_API_URL=https://clob.polymarket.com

# Wallet Private Key (for executing trades)
PRIVATE_KEY=your_private_key_here

# Copy Trading Settings
COPY_ENABLED=true
MIN_TRADE_AMOUNT=0.01
MAX_TRADE_AMOUNT=100
SLIPPAGE_TOLERANCE=0.01

# Traders to Copy (JSON array)
TRADERS=[{"address":"0x123...","name":"Trader1","minTradeAmount":0.1,"maxTradeAmount":10}]

⚠️ Important: the bot will not start unless at least one trader is configured. If you see the error

Error initializing bot: At least one trader must be configured

either set a valid JSON array in TRADERS or run the interactive setup with npm run cli setup.

Usage

CLI Commands

Start the bot:

npm run cli start

Start in daemon mode (non-interactive):

npm run cli start -- --daemon

Check bot status:

npm run cli status

View recent trades:

npm run cli trades

View active markets:

npm run cli markets

View configuration:

npm run cli config

Interactive setup wizard:

npm run cli setup

Stop the bot:

npm run cli stop

Interactive Menu

When you start the bot without --daemon flag, you'll see an interactive menu:

╔═══════════════════════════════════════════════════════════╗
║                    Interactive Menu                       ║
╠═══════════════════════════════════════════════════════════╣
║  1. Check Status                                          ║
║  2. View Recent Trades                                    ║
║  3. View Markets                                          ║
║  4. View Configuration                                    ║
║  5. Stop Bot                                              ║
║  0. Exit                                                  ║
╚═══════════════════════════════════════════════════════════╝

Development

Run in development mode:

npm run dev

Watch mode (auto-rebuild):

npm run watch

Project Structure

polymarket-copy-trading-bot/
├── src/
│   ├── cli.ts              # CLI interface
│   ├── index.ts            # Main bot class
│   ├── config/             # Configuration management
│   ├── services/           # Service classes
│   │   ├── polymarket.ts   # Polymarket API client
│   │   └── tradeExecutor.ts # Trade execution logic
│   └── types/              # TypeScript type definitions
├── dist/                   # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md

How It Works

  1. Monitoring: The bot continuously monitors trades from configured trader addresses
  2. Filtering: Trades are filtered based on your configuration (min/max amounts, markets, etc.)
  3. Execution: Approved trades are automatically executed on your behalf
  4. Logging: All trade activities are logged to the console with detailed information

Support

For issues and questions, contact @brunomadrigal49 on Telegram.

About

Polymarket Trading Bot: monitors specified trader addresses, ingests trade events via API polling, evaluates signals against configurable risk and amount rules, and (optionally) executes mirrored orders. Built with TypeScript, dotenv, axios; designed for auditable secure, minimal-privilege ops.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors