Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Solana KOL Tracker Bot

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.

Overview

Crypto influencers ("KOLs") post token contract addresses (CAs) in Telegram channels. This bot:

  1. Monitors a curated list of KOL Telegram channels in real time
  2. Extracts Solana contract addresses from messages (direct CAs and DexScreener links)
  3. Filters calls by market cap (≤ $300k), blacklisted keywords, and channel performance
  4. Ranks channels by historical win rate using data scraped from SpyDefi / KOLscope
  5. Executes buys through a trading bot when a high-performing KOL posts a qualifying call
  6. Automates sells after a configurable hold period via handlesell.py
  7. Alerts you in a private Telegram group with win rate stats per call

Architecture

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

How It Works

Win Rate Calculation

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.

Buy Pipeline

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

Sell Automation

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.

Setup

Prerequisites

  • Python 3.10+
  • Redis (local or remote)
  • Two Telegram accounts (API credentials from my.telegram.org)
  • A compatible Telegram trading bot

Installation

cd solana-kol-tracker
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Configuration

cp .env.example .env
# Fill in all values in .env

Authenticate Telegram Sessions

python scripts/create_session.py

Run this once per Telegram account to generate the .session files (stored locally, never committed).

Populate Tracked Channels

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:5000

Fetch Win Rate Data

python wr_checker_spydefi_tester.py   # writes win rates to Redis

Run the Bot

cd bot
python bot.py

Environment Variables

See .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)

Tech Stack

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

Notes

  • 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.

About

Automated Solana trading bot — monitors Telegram KOL channels, scores by win rate, and executes trades

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages