A lightweight Python bot that monitors a specific Polymarket wallet's positions and sends real-time alerts to Telegram when changes are detected (new positions, increases, or decreases).
- Real-time Monitoring: Tracks the
/positionsendpoint of the Polymarket Data API. - State Tracking: Compares current positions with the last known state to detect changes.
- Telegram Alerts: Sends detailed notifications with emojis for:
- 🆕 New Positions
- 📈 Position Increases (Buying more shares)
- 📉 Position Decreases (Selling shares)
- Smart Filtering: Ignores negligible changes (dust) to avoid spam.
- Python 3.10+
- A Telegram Bot Token and Chat ID.
- The Wallet Address you want to monitor.
-
Clone the repository:
git clone <your-repo-url> cd polymarket-api
-
Install dependencies:
pip install -r requirements.txt
-
Configure Environment Variables: Create a
.envfile in the root directory:TELEGRAM_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_chat_id TARGET_WALLET=0x... # The wallet address to monitor
Run the bot manually:
python src/bot.pyOn the first run, it will detect all current positions and send alerts for them (to establish a baseline). Subsequent runs will only alert on changes.
This repository includes a GitHub Actions workflow (.github/workflows/monitor.yml) configured to run the bot every 5 minutes.
To enable it:
- Go to your repository Settings > Secrets and variables > Actions.
- Add the following repository secrets:
TELEGRAM_TOKENTELEGRAM_CHAT_IDTARGET_WALLET
src/bot.py: Main logic for fetching positions and sending alerts.last_positions.json: Local cache file to store the last known state of positions (created automatically).requirements.txt: Python dependencies.