An automated trading assistant that monitors Telegram Key Opinion Leader (KOL) channels for Solana token calls, ranks channel performance by win rate, and executes trades through a configurable trading bot.
Crypto influencers ("KOLs") post token contract addresses (CAs) in Telegram channels. This bot:
- Monitors a curated list of KOL Telegram channels in real time
- Extracts Solana contract addresses from messages (direct CAs and DexScreener links)
- Filters calls by market cap (≤ $300k), blacklisted keywords, and channel performance
- Ranks channels by historical win rate using data scraped from SpyDefi / KOLscope
- Executes buys through a trading bot when a high-performing KOL posts a qualifying call
- Automates sells after a configurable hold period via
handlesell.py - Alerts you in a private Telegram group with win rate stats per call
solana-kol-tracker/
├── bot/
│ ├── bot.py # Entry point — dual TelegramClient setup, event handlers
│ ├── watcher.py # Core message handler — filters, deduplication, buy trigger
│ ├── extractor.py # Solana CA extraction (DexScreener links + direct regex)
│ ├── alert.py # Formats and sends Telegram alert messages
│ ├── twitter_checker.py # Optional Twitter sentiment analysis before buying
│ └── Blacklist.py # Curated whitelist / blacklist of KOL channels
├── admin_web/
│ └── app.py # Flask admin UI to add/remove tracked channels
├── scripts/
│ ├── create_session.py # Interactive Telegram session creator (run once per account)
│ ├── import_channels.py # Bulk import channels from CSV into Redis
│ ├── extract_data.py # Join and collect channels from SpyDefi
│ ├── find_channels_to_consider.py # Discover new KOL channels not yet tracked
│ ├── get_group_id.py # List all Telegram dialog IDs (setup helper)
│ └── test_alert.py # Send a test message to verify bot connectivity
├── config/
│ └── settings.json # Runtime configuration
├── wr-checker.py # Win rate calculator (SpyDefi data source)
├── wr-checker-kolscope.py # Win rate calculator (KOLscope data source)
├── wr_checker_spydefi_tester.py # Advanced win rate analysis with scoring
├── wr_checker_deepanalysis.py # Deep win rate analysis over extended time windows
├── track_actual_buys.py # Tracks real buy performance from alert history
├── daily_whitelist_extractor.py # Rebuilds the active KOL whitelist in Redis daily
├── resolve_to_id.py # Resolves channel usernames to Telegram IDs
├── handlesell.py # Automated sell execution via Telegram inline buttons
├── checker.py # Periodically validates tracked channel win rates
├── checkchannels.py # Queries SpyDefi/KOLscope for per-channel stats
├── requirements.txt
└── .env.example
The bot scrapes message history from SpyDefi / KOLscope aggregator bots to compute each KOL channel's historical win rate at a configurable multiplier target (default 1.4×). Channels exceeding a win rate threshold (default 70%) and a minimum call count (default 10) are placed on the active whitelist in Redis.
New message in tracked channel
└─ Extract Solana CA from text / DexScreener link
└─ Validate CA (base58, 32-byte check)
└─ Fetch market cap via DexScreener API (reject if > $300k)
└─ Check channel win rate from Redis
└─ Deduplicate (Redis key with 48h TTL)
└─ Send CA to trading bot group
└─ Wait for confirmation reply
└─ Record buy time in Redis + send alert
handlesell.py navigates the trading bot's inline keyboard UI — sends /positions, finds the target coin button, clicks it, then clicks Sell 100%. Called automatically after a configurable hold window.
- Python 3.10+
- Redis (local or remote)
- Two Telegram accounts (API credentials from my.telegram.org)
- A compatible Telegram trading bot
cd solana-kol-tracker
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtcp .env.example .env
# Fill in all values in .envpython scripts/create_session.pyRun this once per Telegram account to generate the .session files (stored locally, never committed).
python scripts/import_channels.py # bulk import from a CSV
# or use the admin web UI
python admin_web/app.py # then open http://localhost:5000python wr_checker_spydefi_tester.py # writes win rates to Rediscd bot
python bot.pySee .env.example for the full list. Key variables:
| Variable | Description |
|---|---|
TELEGRAM_API_ID / TELEGRAM_API_HASH |
Credentials for the main Telegram account |
TELEGRAM_API_ID_EL / TELEGRAM_API_HASH_EL |
Credentials for the listener account |
ALERT_GROUP_ID |
Telegram group where buy alerts are sent |
TRADING_BOT_GROUP_ID |
Group where the trading bot receives CAs |
BIRDEYE_API_KEY |
Birdeye API for token data |
REDIS_HOST / REDIS_PORT |
Redis connection (default: localhost:6379) |
| Component | Technology |
|---|---|
| Telegram client | Telethon (async MTProto) |
| State / caching | Redis |
| Market data | DexScreener API |
| Address validation | base58 + PyNaCl |
| Sentiment analysis | twikit (Twitter) |
| Admin UI | Flask |
| Data analysis | pandas |
- Session files (
.session) are generated locally on first auth and must never be committed — they are.gitignored. - The bot requires two Telegram accounts because one acts as a user-bot (listening to channels) while the other interacts with the trading bot UI.
- Win rate data is cached in Redis. Re-run the win rate checker periodically to keep the whitelist fresh.