pair-scanner-bot
A self-hosted Telegram bot that watches decentralised exchanges on Base for new token pairs, audits them, and can buy and sell them from your own wallet. It runs on its own, or inside another python-telegram-bot application.
Use at your own risk. This is not financial advice. Trading new tokens is extremely risky: most fail, many are scams, and you can lose everything you put in. The software comes with no warranty (see LICENSE). Only use a separate wallet holding money you can afford to lose. You're responsible for your own trades, and for any tax or legal rules where you live.
Not affiliated with Uniswap, Aerodrome, GoPlus, honeypot.is, GeckoTerminal, DEX Screener or any RPC provider.
Status: early work in progress.
What it does
- Finds new pairs. It watches the Uniswap V2, Uniswap V3 and Aerodrome factories on Base for new pools paired with WETH.
- Audits them. It checks liquidity, the liquidity-to-market-cap ratio, locked LP, whether one wallet holds too much of the supply, taxes, contract security (GoPlus), honeypot risk (honeypot.is), and whether a sale actually goes through (simulated against the chain).
- Buys what passes, when the monitor is on 💰 Live, up to your limits.
- Judges every position by what a sale would really return. Each minute it asks the exchange what selling would bring back and compares that with what the buy actually cost, so a thin pool's price can't fake a gain. If no quote comes back it falls back to the pool price.
- Sells half once a position is up by
half_sell_percent(30% by default; 0 turns it off). The rest then sells at break-even instead of the stop-loss, so a rug after that costs far less. - Sells on take-profit, stop-loss, trailing stop (it starts once a position is up by
trailing_start_percent, 20% by default, so gains are protected before take-profit), rug (liquidity drop), dead token, or a honeypot appearing later. - Strategy monitor (optional): buys established pools with strong one-hour momentum. It skips pools younger than
strat_min_pool_age_hours(24 by default) and checks the pool's real liquidity on-chain before buying. - Alerts for every buy, sell, would-buy and health problem. Sells come in two groups, 💰 Sell and 🚨 Lost. Buys, profit sells and loss sells each have their own switch in ⚙️ Settings → Monitors & Alerts. Would-buys, failed buys and health alerts are always sent.
- Screens: the scanner dashboard (
/startopens it), pairs, positions, wallet balances (on Base and Ethereum), health, settings and CSV exports of every pair and position for your own records.
Safety
- A mode for each monitor, set in ⚙️ Settings → Monitors & Alerts. The 🤖 Pairs Monitor and the 🧭 Strategy Monitor each pick one of three: ⏸️ Off: it doesn't run. 👀 Watch: it finds and checks tokens and tells you what it would buy, but never buys. Each pick is then followed as a pretend position with the same sell rules, so you get 👀 Would have sold alerts and a Would have made figure on the dashboard, and can see whether Live would have paid before spending anything. 💰 Live: it buys. So one can buy while the other only watches. A new install starts with Pairs on Watch and Strategy Off. Switching to Live asks you to confirm, and needs
PRIVATE_KEY. - Owner only. The bot answers only
OWNER_ID. - Your key stays yours. It's read from your environment, used to sign your own transactions, and never printed, stored or sent anywhere else.
- Cautious defaults: 0.001 ETH per buy, at most 3 positions, 5% slippage, and the strategy off.
- Balance floor. If the wallet falls below the minimum balance (0.01 ETH by default) while a monitor is on Live, the health check switches it to Watch and alerts you. In Watch the balance only shows on the Health screen, because nothing is bought.
- Its own health check. Every
health_check_intervalminutes, while either monitor is on Watch or Live, it checks the RPCs, the wallet balance, the database (size, read-only, offline) and the pairs feed. It tells you once when something breaks, once more when it's fixed, and reminds you once if it's still broken after 12 hours. When the database nearsdb_cleanup_mbit clears the archive first. 🩺 Health on the dashboard shows the same check whenever you want. - Open positions are looked after. While either monitor is on Watch or Live, the sell monitor keeps working on your stop-loss, take-profit and the other sell rules for every open position, whichever monitor bought it. Changing a mode with open positions reminds you what happens to them; only both monitors Off stops selling.
What it connects to
There's no telemetry: nothing is sent to the authors. The bot itself talks to:
- Telegram, for your messages and alerts.
- Your RPC nodes (Alchemy or Ankr if you give it keys, otherwise public nodes), to read the chain, check your balance and send your own transactions.
- GeckoTerminal, for pool prices and momentum, and GoPlus and honeypot.is, for token safety checks. These are sent token and pool addresses, never your wallet or key.
- Your MySQL database, where everything it remembers is kept.
Run it on its own
You need Python 3.12+, a MySQL database and a bot token from @BotFather.
pip install pair-scanner-bot
python -m pair_scanner
Run it from a folder with a .env file holding the settings below. .env.example is a starting point. To find your Telegram user ID for OWNER_ID, message @userinfobot. Then send /start to your bot to open the dashboard.
To look around before anything runs, set MODE=off first: both monitors start ⏸️ Off for that run, whatever modes are saved.
Settings
| Setting | Environment variable | Purpose |
|---|---|---|
token |
BOT_TOKEN |
Required. Your bot's token |
owner_id |
OWNER_ID |
Required. Your Telegram user ID; the bot answers nobody else |
db_url |
DB_URL |
Required. mysql://user:pass@host:3306/db. Tables are created on first start: pairs, positions and scanner_settings |
wallet_address |
WALLET_ADDRESS |
Required. The wallet it watches and trades from |
private_key |
PRIVATE_KEY |
Only to trade. Without it the bot can't go Live |
alerts_chat_id |
ALERTS_CHAT_ID |
Where alerts go. Defaults to your private chat. For a group or channel, add the bot to it first (as an admin, for a channel) |
alchemy_api_key, ankr_api_key |
ALCHEMY_API_KEY, ANKR_API_KEY |
Optional RPC keys, tried before the public nodes |
timezone |
TIMEZONE |
Default Europe/London |
SENTRY_DSN (standalone) |
Optional error reporting when run on its own | |
mode |
MODE |
off or watch to cap both monitors at that mode for this run only, without changing the saved modes. A host passes mode="off" for local runs |
db_dashboard_url |
DB_DASHBOARD_URL |
Optional web page for your database, such as its Heroku resources page. Database health alerts get a 🔧 Open database dashboard button. Never put DB_URL here: it holds the password |
Trading limits, audit thresholds, sell rules and schedules are changed in the bot under ⚙️ Settings and saved in scanner_settings.
Upgrading from 1.0 or 1.1: start 1.2 once first. It converts the old switches to a mode per monitor, splits the sell alerts switch, and adds the half_eth column; later versions no longer have those steps.
Use it inside another bot
from pair_scanner import start_scanner_bot, stop_scanner_bot
await start_scanner_bot(
share_with=application,
owner_id=OWNER_ID,
alerts_chat_id=ALERTS_CHAT_ID,
)
...
await stop_scanner_bot()
Inside a host (with share_with), the scanner reads the same names with a SCANNER_ prefix, such as SCANNER_DB_URL and SCANNER_WALLET_ADDRESS, so it never clashes with the host's own settings. Pass env_prefix= to use a different prefix. Settings the host already has, like the owner and alerts chat, can be passed as keywords instead.
Inside a host, the bot token is optional. Without it, the scanner uses the host's bot: its jobs run on the host's job queue and its alerts come from the host's bot. With it, the scanner runs its own bot alongside the host's. Any setting can be passed as a keyword instead of an environment variable. The host can show the scanner's screens in its own menus, and forward any button whose data starts with scanner: to handle_button, and text replies to handle_text_input:
scanner_block(context, brief=False)is the scanner dashboard;brief=Truegives a short summary for a daily message.balances_block(brief=False)shows the wallet's balance on each network.scanner_health()returns the RPC, wallet and monitor status as text, plus its alerts, so a host can show them in its own health check if it wants. It only reads: it never changes settings or cleans the database.scanner_modes()returns each monitor's mode for this run, such as{"pairs": "watch", "strategy": "off"}, so a host can tell whether the scanner is doing anything.
Development
pip install -e ".[dev]"
pre-commit install
pytest
pre-commit runs Ruff, mypy and a file-size check. See CONTRIBUTING.md for where things go and how releases work, and SECURITY.md to report a security problem privately.
Licence
MIT.
Metadata
Release files for pair-scanner-bot 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pair_scanner_bot-1.4.1.tar.gz | 69.4 kB | With provenance | Details for pair_scanner_bot-1.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pair_scanner_bot-1.4.1-py3-none-any.whl | Python 3 | none | any | Details for pair_scanner_bot-1.4.1-py3-none-any.whl |
Total release size: 137.7 kB
Release files / pair_scanner_bot-1.4.1.tar.gz
| Download URL | pair_scanner_bot-1.4.1.tar.gz |
|---|---|
| Size | 69.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
797df0824c2f6d5a8027ab3be334e4ddc9c0b808ec272ac3a7996e09d358fbb0
|
|
BLAKE2b-256 checksum How to use checksums |
c3723b7e3f21063901a9bcc73a242fa75ece78aefed65b32b74cf04f307394f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / pair_scanner_bot-1.4.1-py3-none-any.whl
| Download URL | pair_scanner_bot-1.4.1-py3-none-any.whl |
|---|---|
| Size | 68.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d932d224f4d321931dfaee1a15c141c6f09f142efe065e712451acf676bd3557
|
|
BLAKE2b-256 checksum How to use checksums |
e69d8d7ca42096299a261768f57866f0b09791dd1ac6428de75cc06d4d6572d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for pair-scanner-bot 1.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pair_scanner_bot-1.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.