Skip to main content

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, taxes, contract security (GoPlus), honeypot risk (honeypot.is), and whether a sale actually goes through (simulated against the chain).
  • Buys what passes, if trading is on, up to your limits.
  • Sells on take-profit, stop-loss, trailing stop, rug (liquidity drop), dead token, or a honeypot appearing later.
  • Strategy monitor (optional): buys established pools with strong one-hour momentum.
  • Alerts for every buy, sell, would-buy and health problem.
  • Screens: the scanner dashboard, pairs, positions, wallet balances (on Base and Ethereum), health, settings and CSV exports of every pair and position for your own records.

Safety

  • Watch-only by default. A new install finds and audits pairs and tells you what it would buy, but never buys. Turning trading on 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 trading is on, the health check switches the monitors off and alerts you. In watch-only the balance only shows on the Health screen, because nothing is bought.
  • Its own health check. Every health_check_interval minutes it checks the RPCs, the wallet balance, the database (size, read-only, offline) and the pairs feed, and only messages you when something's wrong. When the database nears db_cleanup_mb it clears the archive first. 🩺 Health on the dashboard shows the same check whenever you want.
  • Watch-only stops new buys, not sells. Positions it already holds keep their stop-losses.

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 look around before anything runs, set TEST_MODE=1 first.

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 stays watch-only
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
test_mode TEST_MODE 1 to try the screens safely: no background jobs, no alerts and no trades, even with a private key
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.

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=True gives 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.

Development

pip install -e ".[dev]"
pre-commit install
pytest

Licence

MIT.

Metadata

Release files for pair-scanner-bot 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pair-scanner-bot 1.0.0
File Size Uploaded Provenance Actions
pair_scanner_bot-1.0.0.tar.gz 77.2 kB With provenance Details for pair_scanner_bot-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pair-scanner-bot 1.0.0
File Interpreter ABI Platform Actions
pair_scanner_bot-1.0.0-py3-none-any.whl Python 3 none any Details for pair_scanner_bot-1.0.0-py3-none-any.whl

Total release size: 134.7 kB

Release files / pair_scanner_bot-1.0.0.tar.gz

Download URL pair_scanner_bot-1.0.0.tar.gz
Size 77.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2f264ad85e292ca21849902d7e005e466db8153c9e03c192556fa55d3e98436f
BLAKE2b-256 checksum
How to use checksums
af6fa9ab1e9b43eb430800d35d5fa1c0651e812494a0d917e357385967f82fdc
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 19, 2026.

Transparency log

Release files / pair_scanner_bot-1.0.0-py3-none-any.whl

Download URL pair_scanner_bot-1.0.0-py3-none-any.whl
Size 57.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef409dd6370a577b469562edb2c976afa1176be2417ba809d4cf270241715c15
BLAKE2b-256 checksum
How to use checksums
cf8697a47ad21460bb625c9acd0617efd4e9f0648037ee6107e764856f1507ba
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 19, 2026.

Transparency log

Security for pair-scanner-bot 1.0.0

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.

Select from 2 files

Attestation for pair_scanner_bot-1.0.0.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 19, 2026.

Transparency log

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

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page