Skip to content

fsol1/tg-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tg-scraper

tg-scraper is a trading bot which listens for messages from specific Telegram channels, parse them for Solana addresses, and forward the addresses to BonkBot.

⚠️ Warning: This bot is for educational purposes only. You should not expect to make a profit from it, and I am not responsible for any potential losses.

Context

Between November 2023 and March 2024, the Solana ecosystem was booming and at the core of it, there were callers (influencers) who shared token addresses (think of it like a stock ticker) within their Telegram channels, each of which had thousands of subscribers. These posts typically caused the value of the shared tokens to surge within seconds to minutes, as people quickly bought into the tokens.

The purpose of this bot was to purchase the token immediately after the caller posted it, before others could, hold it briefly, and then sell it for a profit. As other bots are now way faster than this one, I decided to open source this project for educational purposes.

Demo

Here is a demonstration of the bot in action: a token address is sent through a test channel, the bot detects it, quickly buys the token, and then sells it 10 seconds later for a potential profit.

202409291617.mp4

Performance and Deployment

The bot is capable of executing a buy within 2 to 4 seconds. Initially, I ran it on my laptop, being careful not to close the VS Code tab. Later on, I deployed the bot on a small DigitalOcean droplet, running up to 3 instances at the same time, each with a different Telegram account and strategy. During peak market activity, this bot was making over 200 SOL a month.

Getting Started

What you'll need

  • A Telegram account with access to BonkBot (McQueen)
  • Telegram API credentials (API ID and API Hash)
  • A Telegram private channel to use as a test channel
  • A list of Telegram channels you want the bot to listen to

Setting Up the Python Environment (Linux and macOS)

Create a virtual environment:

python3 -m venv myenv

Activate the virtual environment:

source myenv/bin/activate

Install the required dependencies from requirements.txt:

pip install -r requirements.txt

Retrieve the Channels Your Account Is Subscribed To

This command will print out all the channels your account is subscribed to, along with their IDs:

python dialogs.py

You can then place those IDs in util.py within the ids_to_names dictionary.

Fill Up the .env File

API_ID=  # Your Telegram API ID
API_HASH=  # Your Telegram API Hash
PUBKEY=  # Your BonkBot public key
TEST_CHANNEL=  # ID of your test channel
HOLDING_TIME=  # Holding time for trades in seconds
BAN_WORDS=potatotest,bananatest  # List of banned words

Setting Up BonkBot

  • Make sure you have some SOL in your wallet.
  • Configure the bot settings as needed.
  • Make sure to enable the auto-buy feature.

Running the bot

Start the bot:

python lanaos.py

Once running, the bot will begin listening for messages and will log every trade both in the terminal and in the logs.csv file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages