A Telegram bot that monitors large trades (whale activity) on PolyMarket and sends real-time notifications.
- 📊 Real-time monitoring of whale trades on PolyMarket
- 🔔 Telegram notifications for significant trades
- 🎯 Customizable filters (minimum value, market IDs, keywords)
- 👥 Track multiple whale addresses
- 🔄 Automatic retry on API errors
- 💾 Trade deduplication to prevent duplicate notifications
- 🛡️ Single chat ID restriction for security
- ⚙️ Easy configuration via Telegram bot commands
- Python 3.8 or higher
- A Telegram bot token (get one from @BotFather)
- Your Telegram chat ID (get it from @userinfobot)
-
Clone the repository:
git clone https://github.com/ebc81/polymarket-whale-watcher.git cd polymarket-whale-watcher -
Create a virtual environment:
python -m venv venv venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure the bot:
- Copy
.env.exampleto.env - Edit
.envwith your Telegram bot token and chat ID
copy .env.example .env notepad .env
- Copy
-
Run the bot:
python -m src.main
-
Clone the repository:
git clone https://github.com/ebc81/polymarket-whale-watcher.git cd polymarket-whale-watcher -
Create a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Configure the bot:
- Copy
.env.exampleto.env - Edit
.envwith your credentials
cp .env.example .env nano .env
- Copy
-
Run the bot:
python -m src.main
-
Edit the service file:
nano service/polymarket-bot.service
Update the
UserandWorkingDirectorypaths to match your setup. -
Copy the service file:
sudo cp service/polymarket-bot.service /etc/systemd/system/
-
Enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable polymarket-bot.service sudo systemctl start polymarket-bot.service -
Check the status:
sudo systemctl status polymarket-bot.service
-
View logs:
sudo journalctl -u polymarket-bot.service -f
Edit the .env file to configure the bot:
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
# PolyMarket Configuration
POLL_INTERVAL=60 # How often to check for new trades (seconds)
MIN_TRADE_VALUE=0 # Minimum trade value to notify (USD)
HEARTBEAT_INTERVAL=600 # How often to send heartbeat notifications (seconds)
# Bootstrap whale addresses (comma-separated)
WHALE_ADDRESSES=0x0029ec6df644c87b7ba49e9627b04b8fa0f6bc93,0x003f24b98b1b54a49e3df4bb3a07a0f5fda4a3ed
# Market filters (optional, comma-separated market IDs)
MARKET_IDS=
# Market text filters (optional, comma-separated keywords)
MARKET_TEXT_FILTERS=
# Market exclusion filters (optional, comma-separated market IDs to exclude)
EXCLUDE_MARKET_IDS=
# Market text exclusion filters (optional, comma-separated keywords to exclude)
EXCLUDE_MARKET_TEXT_FILTERS=-
Bot Token:
- Open Telegram and search for @BotFather
- Send
/newbotand follow the instructions - Copy the bot token provided
-
Chat ID:
- Start a chat with your bot
- Send any message to it
- Open @userinfobot and get your user ID
- Use this ID as your
TELEGRAM_CHAT_ID
To effectively monitor whale activity, you need to identify and track addresses of top traders. Here are several methods to find high-value trader addresses:
- Visit the PolyMarket Leaderboard to see top traders ranked by profit
- Browse market-specific pages on PolyMarket to identify large positions
- Use third-party analytics platforms like Dune Analytics for deeper insights into trader behavior
- Copy wallet addresses directly from these platforms
You can use the PolyMarket trades API to identify frequent or large traders:
# Example: Fetch recent trades and inspect for large transactions
# First, explore the API response to understand available fields
curl "https://clob.polymarket.com/trades?limit=100"
# The response contains trade objects with fields like 'maker_address', 'size', 'price', etc.
# You can filter for large trades (adjust the size threshold as needed)
curl "https://clob.polymarket.com/trades?limit=100" | jq '.[] | select(.size > 10000)'- Monitor the trades endpoint for large transactions
- Note
maker_addressvalues that appear frequently with high-value trades - Track addresses from significant market movements
- Discord/Telegram Communities: Join PolyMarket community channels where traders share insights
- Twitter/X: Follow PolyMarket traders and analysts who share wallet addresses
- Blockchain Explorers: Use Polygonscan to verify addresses and inspect trading history
- Search for addresses you find to confirm their trading activity
- Check transaction history and volumes to validate they're active traders
- On-chain verification: Always verify addresses through blockchain explorers before adding them
Once you've identified whale addresses, add them using either method:
Via Environment Variable (at startup):
# Edit .env file
WHALE_ADDRESSES=0x1234...,0x5678...,0x9abc...Via Telegram Command (while running):
/addwhale 0x1234567890abcdef1234567890abcdef12345678
/listwhales
Tips:
- Start with 5-10 high-volume traders for focused monitoring
- Regularly review and update your whale list based on market activity
- Use
/listwhalesto manage your tracked addresses - Combine whale tracking with market filters for targeted alerts
Once the bot is running, you can manage it using these Telegram commands:
/startor/help- Show help message with all commands/status- Show current configuration
/addwhale <address>- Add a whale address to track/removewhale <address>- Remove a whale address/listwhales- List all tracked whale addresses
/addmarket <id>- Add a market ID filter/removemarket <id>- Remove a market ID filter/listmarkets- List all market filters
/addmex <id>- Exclude a market by ID/removemex <id>- Remove market ID exclusion/listmex- List excluded market IDs
/addtext <keyword>- Add a keyword filter for market names/removetext <keyword>- Remove a keyword filter/listtexts- List all text filters
/addtex <keyword>- Exclude markets by keyword/removetex <keyword>- Remove keyword exclusion/listtex- List excluded keywords
/setminvalue <value>- Set minimum trade value (USD)/setinterval <seconds>- Set poll interval (minimum 10 seconds)/setheartbeat <seconds>- Set heartbeat notification interval (minimum 60 seconds)
/addwhale 0x1234567890abcdef1234567890abcdef12345678
/setminvalue 1000
/setinterval 30
/addtext trump
/status
- Polling Loop: The bot continuously polls the PolyMarket trades API at the configured interval
- Trade Fetching: It fetches recent trades for all tracked whale addresses
- Filtering: Trades are filtered based on priority order:
- Minimum trade value threshold
- Market ID exclusions (reject if matched)
- Text exclusions (reject if matched)
- Market ID inclusions (if configured, must match)
- Text inclusions (if configured, must match)
- Deduplication: Each trade is checked against a local store to prevent duplicate notifications
- Notifications: Qualifying trades are formatted and sent to your Telegram chat
The bot applies filters in the following priority order:
- Minimum trade value: Trades below the minimum are always excluded
- Exclude market IDs: If a trade matches an excluded market ID, it's rejected
- Exclude text filters: If a trade matches an excluded keyword, it's rejected
- Include market IDs: If market ID filters are configured, only matching trades pass
- Include text filters: If text filters are configured, only matching trades pass
This means exclusion filters take priority over inclusion filters, allowing you to fine-tune which trades you want to be notified about.
polymarket-whale-watcher/
├── src/
│ ├── __init__.py # Package initialization
│ ├── config.py # Configuration management
│ ├── store.py # Trade storage and deduplication
│ ├── polymarket.py # PolyMarket API client
│ ├── telegram_bot.py # Telegram bot implementation
│ └── main.py # Main entry point
├── service/
│ └── polymarket-bot.service # Systemd service file
├── .env.example # Example environment configuration
├── .gitignore # Git ignore rules
├── requirements.txt # Python dependencies
└── README.md # This file
- Verify your
TELEGRAM_CHAT_IDis correct - Make sure you've started a chat with your bot first
- Check that the bot token is valid
- The bot uses
Applicationfrom PTB v22. For commands to work, the application must be initialized and started before polling. - Lifecycle in this project:
- Initialize:
await application.initialize() - Start:
await application.start()(activates handlers/dispatcher) - Poll:
await application.updater.start_polling(...)(runs asynchronously in a background task) - Stop:
await application.updater.stop()thenawait application.stop()andawait application.shutdown()
- Initialize:
- If you see "event loop already running", avoid calling
run_polling()insideasyncio.run(...). Use the async lifecycle above.
- Verify whale addresses are correctly configured
- Check if
MIN_TRADE_VALUEis set too high - Ensure the bot is running (check logs)
- Verify network connectivity to PolyMarket API
- Your Telegram chat ID doesn't match the configured
TELEGRAM_CHAT_ID - Only the configured chat ID can use the bot
- Check file permissions:
chmod +x src/main.py - Verify paths in the service file are correct
- Check logs:
sudo journalctl -u polymarket-bot.service -f
- Never commit your
.envfile to version control - Keep your bot token secret and secure
- The bot only responds to the configured chat ID
- Store whale addresses and API keys securely
- If your token is exposed: Immediately rotate it via @BotFather →
/mybots→ select your bot → "Bot Settings" → "Regenerate Token" - Always keep
.envand state files (likeconfig_state.json) local - they are ignored by Git for your security - See SECURITY.md for detailed security guidelines and best practices
The PolyMarket API has rate limits. The bot includes:
- Configurable poll intervals (default: 60 seconds)
- Automatic retry on errors with exponential backoff
- Request timeouts to prevent hanging
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
For issues, questions, or contributions, please open an issue on GitHub.
This bot is for informational purposes only. Use at your own risk. The authors are not responsible for any trading decisions made based on notifications from this bot.